gestures/item#
Interfaces#
ItemPress#
Defined in: arranger/src/gestures/item.ts:19
What an item press holds.
Properties#
place#
readonlyplace:Point
Defined in: arranger/src/gestures/item.ts:23
The item’s place {x, y} as drawn at the press.
scale#
readonlyscale:number
Defined in: arranger/src/gestures/item.ts:26
screen#
readonlyscreen:Point
Defined in: arranger/src/gestures/item.ts:28
The pointer’s client point at the press.
together#
together: readonly
PlaceKey[]
Defined in: arranger/src/gestures/item.ts:30
The other items the drag moves with it, read from the selection as it starts.
view#
readonlyview:View
Defined in: arranger/src/gestures/item.ts:21
The view as stored at the press, which the command is built on.
zoom#
readonlyzoom:number
Defined in: arranger/src/gestures/item.ts:25
The canvas zoom and the block’s scale at the press.
Type Aliases#
MovedPress#
MovedPress = {
arranged:false;press:ItemPress; } | {arranged:true;press:ArrangedPress; }
Defined in: arranger/src/gestures/item.ts:99
A press on an item: a free one’s or an arranged one’s, each with its strategy’s press.
MovedValue#
MovedValue = {
arranged:false;value:Point; } | {arranged:true;value:ArrangedValue; }
Defined in: arranger/src/gestures/item.ts:104
Where a pressed item goes: a free place, or a place of the arrangement.
Functions#
itemGesture()#
itemGesture(
host,key):GestureStrategy<ItemPress,Point>
Defined in: arranger/src/gestures/item.ts:48
The item drag of the item key. A press is taken while the canvas moves
items (rulesOf(...).move). When the press becomes a drag, an item in the
selection moves with every other item in it by the same travel and leaves
the selection as it is (itemsMovedWith); an item outside it moves alone
and is selected.
The item’s place moves by the pointer’s screen travel since the press,
divided by the canvas zoom into canvas units and by the block’s scale into
drawing units, both as they were at the press, and quantized to
GRID_FREE. The drawing’s screen CTM is not read: an engine lays the
<svg> out at its own layout unit, so the CTM’s scale differs from the
zoom times the scale in the last digits, and a whole-pixel travel would
not come out as a whole number of units.
Parameters#
host#
key#
Returns#
movedItemGesture()#
movedItemGesture(
host,key):GestureStrategy<MovedPress,MovedValue>
Defined in: arranger/src/gestures/item.ts:115
The drag of the item key, whichever way its block’s items lie: the
press is the arranged drag’s (arrangedGesture) while the level’s
contents are arranged (rulesOf(...).arranged), else the free drag’s
(itemGesture), decided at each press, so one attachment serves the
item through every change of its block’s arrangement.