Sha256: 7dac2542db09db3732cfd7078760c72bdc16a1138369f57e97bac740f032cb67

Contents?: true

Size: 1.09 KB

Versions: 4

Compression:

Stored size: 1.09 KB

Contents

module Motion ; module Xray

  class UIPlugin < Plugin
    name 'UI'

    def initialize
      @editor_instances = []
    end

    def plugin_view(canvas)
      @editors = XrayTypewriterView.alloc.initWithFrame(canvas.bounds)
      @editors.scroll_view = canvas
      @editors
    end

    def edit(target)
      super
      @editors.subviews.each &:removeFromSuperview
      @editor_instances = []

      properties = @target.xray
      sections = properties.keys
      properties.each do |section, editors|
        section_view = XraySectionHeader.alloc.initWithFrame([[0, 0], [Xray.ui.full_screen_width, 20]])
        section_view.text = section
        @editors << section_view
        editors.each do |property, editor_class|
          next unless editor_class

          editor_instance = editor_class.with_target(@target, property:property)
          @editor_instances << editor_instance
          section_view.tracking_view << editor_instance.get_edit_view(@editors.bounds.size.width)
        end
        @editors << section_view.tracking_view
      end
      @editors.layoutIfNeeded
    end

  end

end end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
motion-xray-1.0.8 lib/motion-xray/plugins/ui_plugin.rb
motion-xray-1.0.7 lib/motion-xray/plugins/ui_plugin.rb
motion-xray-1.0.6 lib/motion-xray/plugins/ui_plugin.rb
motion-xray-1.0.4 lib/motion-xray/plugins/ui_plugin.rb