Sha256: 69486ee8d6f7999a879e3e5a32add24ea0c20d5fa01befcaf59091a1017ffb5f

Contents?: true

Size: 949 Bytes

Versions: 4

Compression:

Stored size: 949 Bytes

Contents

class Shoes
  module Common
    module Positioning
      # Moves an element to a specific pixel position. The element is still in the slot,
      # but will no longer be stacked or flowed with the other stuff in the slot.
      def move(left, top)
        self.left = left
        self.top  = top
        self
      end

      # NOT part of the public interface e.g. no Shoes APP should use this
      # however we need it from the Slot code to position elements
      def _position(left, top)
        self.absolute_left = left
        self.absolute_top  = top
        gui.update_position if gui && gui.respond_to?(:update_position)
      end

      # displace(left: a number, top: a number) ยป self
      # Displacing an element moves it.  But without changing the layout around it.
      def displace(left, top)
        self.displace_left = left
        self.displace_top = top
        gui.update_position
        self
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
shoes-core-4.0.0.pre6 lib/shoes/common/positioning.rb
shoes-core-4.0.0.pre5 lib/shoes/common/positioning.rb
shoes-core-4.0.0.pre4 lib/shoes/common/positioning.rb
shoes-core-4.0.0.pre3 lib/shoes/common/positioning.rb