Sha256: d0574ed1a26b2194100bead9b19e1afb1ffa6a65b519af3a3ade598a8ae32c8c

Contents?: true

Size: 980 Bytes

Versions: 1

Compression:

Stored size: 980 Bytes

Contents

# frozen_string_literal: true

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

1 entries across 1 versions & 1 rubygems

Version Path
shoes-core-4.0.0.rc1 lib/shoes/common/positioning.rb