PositionHelper
Source: positionHelper.js:51
Position helper.
Constructor
new PositionHelper(view: View): PositionHelperParameters
view(View) — The associated view.
Instance Methods
getGeometry(): Geometry
Get the geometry.
Returns
Geometry— The geometry.
getScrollDimIndex(): number
Get the scroll index.
Returns
number— The scroll index.
getMaximumDimValue(dim: number): number
Get the maximum dimension value.
Parameters
dim(number) — The dimension.
Returns
number— The maximum value.
getMaximumScrollValue(): number
Get the maximum scroll value.
Returns
number— The maximum value.
getCurrentPosition(): Point
Get the current position.
Returns
Point— The current position.
getCurrentPositionDimValue(dim: number): number
Get the value at dimension index for the current position.
Parameters
dim(number) — The dimension.
Returns
number— The value.
getCurrentPositionScrollValue(): number
Get the value at scroll index for the current position.
Returns
number— The value.
getCurrentPositionAtDimValue(dim: number, value: number): Point
Get the current position updated at the provided dimension index with the input value.
Parameters
dim(number) — The dimension.value(number) — The value to use at dimension index.
Returns
Point— The position.
getCurrentPositionAtScrollValue(value: number): Point
Get the current position updated at scroll index with the input value.
Parameters
value(number) — The value to use at scroll index.
Returns
Point— The position.
getCurrentIndex(): Index
Get the current index.
Returns
Index— The current index.
setCurrentPosition(position: Point, silent?: boolean): boolean
Set the current position.
Parameters
position(Point) — The position.silent(boolean, optional) — Flag to fire event or not.
Returns
boolean— True if possible and in bounds.
setCurrentPositionSafe(
position: Point,
silent?: boolean,
): boolean
Set the current position only if it is in the geometry bounds.
Parameters
position(Point) — The position.silent(boolean, optional) — Flag to fire event or not.
Returns
boolean— True if possible and in bounds.
merge(rhs: PositionHelper)
Merge with another helper.
Parameters
rhs(PositionHelper) — The helper to merge with this one.
isPositionInBounds(position: Point): boolean
Check if the current position (default) or the provided position is in bounds.
Parameters
position(Point) — Optional position.
Returns
boolean— True is the position is in bounds.
getIncrementPosition(dim: number): Point
Get the current position incremented in the input direction.
Parameters
dim(number) — The direction in which to increment.
Returns
Point— The resulting point.
getDecrementPosition(dim: number): Point
Get the current position decremented in the input direction.
Parameters
dim(number) — The direction in which to decrement.
Returns
Point— The resulting point.
incrementPosition(dim: number): boolean
Increment the current position along the provided dim.
Parameters
dim(number) — The direction in which to increment.
Returns
boolean— True if possible and in bounds.
decrementPosition(dim: number): boolean
Decrement the current position along the provided dim.
Parameters
dim(number) — The direction in which to decrement.
Returns
boolean— True if possible and in bounds.
incrementPositionAlongScroll(): boolean
Increment the current position along the scroll dimension.
Returns
boolean— True if possible and in bounds.
decrementPositionAlongScroll(): boolean
Decrement the current position along the scroll dimension.
Returns
boolean— True if possible and in bounds.