Class: Plushie::Canvas::Shape::HitRect
- Inherits:
-
Data
- Object
- Data
- Plushie::Canvas::Shape::HitRect
- Defined in:
- lib/plushie/canvas/shape/hit_rect.rb
Overview
Explicit hit test rectangle override for interactive canvas shapes.
Instance Attribute Summary collapse
-
#h ⇒ Object
readonly
Returns the value of attribute h.
-
#w ⇒ Object
readonly
Returns the value of attribute w.
-
#x ⇒ Object
readonly
Returns the value of attribute x.
-
#y ⇒ Object
readonly
Returns the value of attribute y.
Instance Method Summary collapse
-
#[](key) ⇒ Object
Backward-compatible hash-style access.
-
#initialize(x:, y:, w:, h:) ⇒ HitRect
constructor
A new instance of HitRect.
-
#to_wire ⇒ Hash
Wire-ready hit rect map.
Constructor Details
#initialize(x:, y:, w:, h:) ⇒ HitRect
Returns a new instance of HitRect.
11 12 13 |
# File 'lib/plushie/canvas/shape/hit_rect.rb', line 11 def initialize(x:, y:, w:, h:) super end |
Instance Attribute Details
#h ⇒ Object (readonly)
Returns the value of attribute h
10 11 12 |
# File 'lib/plushie/canvas/shape/hit_rect.rb', line 10 def h @h end |
#w ⇒ Object (readonly)
Returns the value of attribute w
10 11 12 |
# File 'lib/plushie/canvas/shape/hit_rect.rb', line 10 def w @w end |
#x ⇒ Object (readonly)
Returns the value of attribute x
10 11 12 |
# File 'lib/plushie/canvas/shape/hit_rect.rb', line 10 def x @x end |
#y ⇒ Object (readonly)
Returns the value of attribute y
10 11 12 |
# File 'lib/plushie/canvas/shape/hit_rect.rb', line 10 def y @y end |
Instance Method Details
#[](key) ⇒ Object
Backward-compatible hash-style access.
16 |
# File 'lib/plushie/canvas/shape/hit_rect.rb', line 16 def [](key) = to_wire[key] |
#to_wire ⇒ Hash
Returns wire-ready hit rect map.
19 20 21 |
# File 'lib/plushie/canvas/shape/hit_rect.rb', line 19 def to_wire {x: x, y: y, w: w, h: h} end |