lib/drawio_dsl/schema/shapes/shape.rb in drawio_dsl-0.5.7 vs lib/drawio_dsl/schema/shapes/shape.rb in drawio_dsl-0.6.0
- old
+ new
@@ -35,11 +35,10 @@
attr_accessor :fill_color
attr_accessor :stroke_color
attr_accessor :font_color
attr_accessor :gradient
- attr_accessor :type
attr_accessor :text_only
attr_accessor :x
attr_accessor :y
attr_accessor :w
attr_accessor :h
@@ -83,42 +82,45 @@
@font_color = args[:font_color] || theme_palette.font_color
end
def style
key_values = []
- key_values << style_modifiers unless style_modifiers.empty?
key_values << "whiteSpace=#{white_space}" if white_space
key_values << "html=#{html}" if html
key_values << "rounded=#{rounded}" if rounded
key_values << "shadow=#{shadow}" if shadow
key_values << "sketch=#{sketch}" if sketch
key_values << "glass=#{glass}" if glass
key_values << "fillColor=#{fill_color}" if fill_color
key_values << "strokeColor=#{stroke_color}" if stroke_color
key_values << "fontColor=#{font_color}" if font_color
key_values << "gradient=#{gradient}" if gradient
+ key_values << style_modifiers unless style_modifiers.empty?
key_values.join(';')
end
# rubocop:enable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
def as_xml(xml)
- xml.mxCell(id: id, value: title, style: style, vertex: 1, parent: "#{page.id}-B") do
+ xml.mxCell(id: id, value: title, style: style, vertex: 1, parent: parent&.id) do
xml.mxGeometry(x: x, y: y, width: w, height: h, as: 'geometry')
end
end
def to_h
- {
+ result = {
id: id,
+ parent_id: parent&.id,
classification: classification,
type: type,
x: x,
y: y,
w: w,
h: h,
style: style
}
+ result[:nodes] = nodes.to_h if nodes.any?
+ result
end
# :nocov:
def debug(format: :detail)
if format == :detail