class GeometrySelection public
Represents a selectable area with coordinates. Used from with Util::Selection
Examples
geom = Hokusai::Util::GeometrySelection.new
geom.start(0.0, 0.0)
geom.stop(100.0, 100.0)
geom.down? # true
geom.selected(20.0, 20.0, 20.0, 20.0) # true#start(x, y) public
Starts a selection
Arguments
- x - the x coordinate selected (Float)
- y - the y coordinate selected (Float)
Returns
Returns nothing
#move_up(height) public
Moves the stop y coordinate up by (height)
Arguments
- height - the amount to move up (Float)
Returns
Returns nothing
#move_down(height) public
Moves the stop y coordinate down by (height)
Arguments
- height - the amount to move down (Float)
Returns
Returns nothing
#stop(x, y) public
Stops the selection
Arguments
- x - the stop x coordinate (Float)
- y - the stop y coordinate (Float)
Returns
Returns nothing
#up? public
Is the selection going upward?
Returns
Returns boolean
#down? public
Is the selection going downward?
Returns
Returns boolean
#left? public
Is the selection going left?
Returns
Returns boolean
#right? public
Is the selection going right?
Returns
Returns boolean
#changed_direction? public
Did the selection change direction?
(ie: selecting down but now going up)
Returns
Returns boolean
#clear public
Resets the selection state
Returns
Returns nothing
#clicked(x, y, w, h) public
Is this region clicked?
Note: need to set `click_pos` to use this.
Arguments
- x - start x of the region (Float)
- y - start y of the region (Float)
- w - width of the region (Float)
- h - height of the region (Float)
Returns
Returns boolean
#selected(x, y, w, h) public
Is this region selected?
Arguments
- x - start x of the region (Float)
- y - start y of the region (Float)
- w - width of the region (Float)
- h - height of the region (Float)
Returns
Returns boolean
#start(x, y) public
Starts a selection
Arguments
- x - the x coordinate selected (Float)
- y - the y coordinate selected (Float)
Returns
Returns nothing
#move_up(height) public
Moves the stop y coordinate up by (height)
Arguments
- height - the amount to move up (Float)
Returns
Returns nothing
#move_down(height) public
Moves the stop y coordinate down by (height)
Arguments
- height - the amount to move down (Float)
Returns
Returns nothing
#stop(x, y) public
Stops the selection
Arguments
- x - the stop x coordinate (Float)
- y - the stop y coordinate (Float)
Returns
Returns nothing
#up? public
Is the selection going upward?
Returns
Returns boolean
#down? public
Is the selection going downward?
Returns
Returns boolean
#left? public
Is the selection going left?
Returns
Returns boolean
#right? public
Is the selection going right?
Returns
Returns boolean
#changed_direction? public
Did the selection change direction?
(ie: selecting down but now going up)
Returns
Returns boolean
#clear public
Resets the selection state
Returns
Returns nothing
#clicked(x, y, w, h) public
Is this region clicked?
Note: need to set `click_pos` to use this.
Arguments
- x - start x of the region (Float)
- y - start y of the region (Float)
- w - width of the region (Float)
- h - height of the region (Float)
Returns
Returns boolean
#selected(x, y, w, h) public
Is this region selected?
Arguments
- x - start x of the region (Float)
- y - start y of the region (Float)
- w - width of the region (Float)
- h - height of the region (Float)
Returns
Returns boolean