Module: DrawioDsl::DrawioExtensionsActive

Included in:
DrawioExtensions
Defined in:
lib/drawio_dsl/drawio_extensions_active.rb

Instance Method Summary collapse

Instance Method Details

#apply_active_flagsObject



5
6
7
8
9
10
11
12
# File 'lib/drawio_dsl/drawio_extensions_active.rb', line 5

def apply_active_flags
  sections.each do |section|
    section[:shapes].each do |shape|
      shape[:active] = check_if_active(shape)
    end
    section[:active] = section[:shapes].any? { |s| s[:active] }
  end
end

#check_if_active(shape) ⇒ Object



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/drawio_dsl/drawio_extensions_active.rb', line 14

def check_if_active(shape)
  style = shape[:style]

  ban = %w[
    mxCompositeShape
    strokeColor=none;fillColor=none
    shape=image
    shadow=1
    shape=partialRectangle;right=0
    shape=partialRectangle;right=0;left=0
  ]

  return false if style.empty?
  return false if ban.include?(style)

  true
end