Sha256: 208b754b994353cc6bf3603e1e9c6bd936ad8fed67da023a3cc2be1135d70eea

Contents?: true

Size: 709 Bytes

Versions: 7

Compression:

Stored size: 709 Bytes

Contents

# frozen_string_literal: true

module DrawioDsl
  module DrawIoExtensionsActive
    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

    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
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
drawio_dsl-0.8.4 lib/drawio_dsl/drawio_extensions_active.rb
drawio_dsl-0.8.3 lib/drawio_dsl/drawio_extensions_active.rb
drawio_dsl-0.8.2 lib/drawio_dsl/drawio_extensions_active.rb
drawio_dsl-0.8.1 lib/drawio_dsl/drawio_extensions_active.rb
drawio_dsl-0.8.0 lib/drawio_dsl/drawio_extensions_active.rb
drawio_dsl-0.7.0 lib/drawio_dsl/drawio_extensions_active.rb
drawio_dsl-0.6.0 lib/drawio_dsl/drawio_extensions_active.rb