Class: Ea::Svg::EaEmitter::LayerSequencer
- Inherits:
-
Object
- Object
- Ea::Svg::EaEmitter::LayerSequencer
- Defined in:
- lib/ea/svg/ea_emitter/layer_sequencer.rb
Overview
Sequences SVG layer output in EA's canonical order:
1. Background <g>
2. (optional) Diagram frame: border + tab + label
3. Per-element groups (shape, header, divider, attrs)
4. Connector + marker groups (merged by style)
5. Labels <g>
Reads diagram.theme once and passes to all child renderers so theme settings (font, colors, stroke width) apply uniformly across the entire SVG output.
Document delegates the layer assembly here so the Document class shrinks to SVG envelope construction.
Constant Summary collapse
- DEFAULT_STROKE_WIDTH =
2
Instance Attribute Summary collapse
-
#canvas ⇒ Object
readonly
Returns the value of attribute canvas.
-
#diagram ⇒ Object
readonly
Returns the value of attribute diagram.
-
#document ⇒ Object
readonly
Returns the value of attribute document.
-
#frame_enabled ⇒ Object
readonly
Returns the value of attribute frame_enabled.
-
#model_index ⇒ Object
readonly
Returns the value of attribute model_index.
-
#theme ⇒ Object
readonly
Returns the value of attribute theme.
Instance Method Summary collapse
-
#initialize(diagram, model_index:, canvas:, frame: false, document: nil) ⇒ LayerSequencer
constructor
A new instance of LayerSequencer.
- #layers ⇒ Object
Constructor Details
#initialize(diagram, model_index:, canvas:, frame: false, document: nil) ⇒ LayerSequencer
Returns a new instance of LayerSequencer.
26 27 28 29 30 31 32 33 |
# File 'lib/ea/svg/ea_emitter/layer_sequencer.rb', line 26 def initialize(diagram, model_index:, canvas:, frame: false, document: nil) @diagram = diagram @model_index = model_index @canvas = canvas @frame_enabled = frame @theme = diagram.theme @document = document end |
Instance Attribute Details
#canvas ⇒ Object (readonly)
Returns the value of attribute canvas.
23 24 25 |
# File 'lib/ea/svg/ea_emitter/layer_sequencer.rb', line 23 def canvas @canvas end |
#diagram ⇒ Object (readonly)
Returns the value of attribute diagram.
23 24 25 |
# File 'lib/ea/svg/ea_emitter/layer_sequencer.rb', line 23 def diagram @diagram end |
#document ⇒ Object (readonly)
Returns the value of attribute document.
23 24 25 |
# File 'lib/ea/svg/ea_emitter/layer_sequencer.rb', line 23 def document @document end |
#frame_enabled ⇒ Object (readonly)
Returns the value of attribute frame_enabled.
23 24 25 |
# File 'lib/ea/svg/ea_emitter/layer_sequencer.rb', line 23 def frame_enabled @frame_enabled end |
#model_index ⇒ Object (readonly)
Returns the value of attribute model_index.
23 24 25 |
# File 'lib/ea/svg/ea_emitter/layer_sequencer.rb', line 23 def model_index @model_index end |
#theme ⇒ Object (readonly)
Returns the value of attribute theme.
23 24 25 |
# File 'lib/ea/svg/ea_emitter/layer_sequencer.rb', line 23 def theme @theme end |
Instance Method Details
#layers ⇒ Object
35 36 37 38 39 40 41 42 43 |
# File 'lib/ea/svg/ea_emitter/layer_sequencer.rb', line 35 def layers layers = [Background.render(canvas)] layers += frame_layers if frame_enabled layers += element_layers layers += connector_layers layers << labels_layer layers << ghost_labels_layer layers end |