Class: Plushie::Canvas::Shape::DragBounds
- Inherits:
-
Data
- Object
- Data
- Plushie::Canvas::Shape::DragBounds
- Defined in:
- lib/plushie/canvas/shape/drag_bounds.rb
Overview
Drag constraint bounds for interactive canvas shapes.
Instance Attribute Summary collapse
-
#max_x ⇒ Object
readonly
Returns the value of attribute max_x.
-
#max_y ⇒ Object
readonly
Returns the value of attribute max_y.
-
#min_x ⇒ Object
readonly
Returns the value of attribute min_x.
-
#min_y ⇒ Object
readonly
Returns the value of attribute min_y.
Instance Method Summary collapse
-
#[](key) ⇒ Object
Backward-compatible hash-style access.
-
#initialize(min_x: nil, max_x: nil, min_y: nil, max_y: nil) ⇒ DragBounds
constructor
A new instance of DragBounds.
-
#to_wire ⇒ Hash
Wire-ready bounds map (nil fields stripped).
Constructor Details
#initialize(min_x: nil, max_x: nil, min_y: nil, max_y: nil) ⇒ DragBounds
Returns a new instance of DragBounds.
12 13 14 |
# File 'lib/plushie/canvas/shape/drag_bounds.rb', line 12 def initialize(min_x: nil, max_x: nil, min_y: nil, max_y: nil) super end |
Instance Attribute Details
#max_x ⇒ Object (readonly)
Returns the value of attribute max_x
11 12 13 |
# File 'lib/plushie/canvas/shape/drag_bounds.rb', line 11 def max_x @max_x end |
#max_y ⇒ Object (readonly)
Returns the value of attribute max_y
11 12 13 |
# File 'lib/plushie/canvas/shape/drag_bounds.rb', line 11 def max_y @max_y end |
#min_x ⇒ Object (readonly)
Returns the value of attribute min_x
11 12 13 |
# File 'lib/plushie/canvas/shape/drag_bounds.rb', line 11 def min_x @min_x end |
#min_y ⇒ Object (readonly)
Returns the value of attribute min_y
11 12 13 |
# File 'lib/plushie/canvas/shape/drag_bounds.rb', line 11 def min_y @min_y end |
Instance Method Details
#[](key) ⇒ Object
Backward-compatible hash-style access.
17 |
# File 'lib/plushie/canvas/shape/drag_bounds.rb', line 17 def [](key) = to_wire[key] |
#to_wire ⇒ Hash
Returns wire-ready bounds map (nil fields stripped).
20 21 22 23 24 25 26 27 |
# File 'lib/plushie/canvas/shape/drag_bounds.rb', line 20 def to_wire h = {} h[:min_x] = min_x if min_x h[:max_x] = max_x if max_x h[:min_y] = min_y if min_y h[:max_y] = max_y if max_y h end |