trait SnapOptions extends Object
Using the snap option while dragging, The coordinates of the pointer that the drag event listeners receive will be modified to meet the coordinates of the snap targets. This option can also be used with resizable targets, but may not yield intuitive results. The snapSize option is specifically for snapping the dimensions of targets when resizing. With both snap and snapSize, the snapping targets is an array of objects and functions. There are more options listed below.
- Annotations
- @JSType()
- Alphabetic
- By Inheritance
- SnapOptions
- Object
- Any
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Value Members
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##: Int
- Definition Classes
- AnyRef → Any
- final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @native() @IntrinsicCandidate()
- val endOnly: UndefOr[Boolean]
The endOnly option is used to snap just before the end of a drag or resize.
The endOnly option is used to snap just before the end of a drag or resize. Before the end event is fired, an extra <action>move event is snapped and fired.
If inertia is enabled and endOnly is set to true then the pointer will follow a curve to the snap target.
- Annotations
- @JSOptional()
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef → Any
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @native() @IntrinsicCandidate()
- def hasOwnProperty(v: String): Boolean
- Definition Classes
- Object
- def hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native() @IntrinsicCandidate()
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- def isPrototypeOf(v: Object): Boolean
- Definition Classes
- Object
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @IntrinsicCandidate()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @IntrinsicCandidate()
- val offset: UndefOr[Point]
A snap offsets lets you shift the coordinates of all snap targets by the x and y properties of a given object or if the string 'startCoords' is given, then pageX and pageY at the start of the action are used.
A snap offsets lets you shift the coordinates of all snap targets by the x and y properties of a given object or if the string 'startCoords' is given, then pageX and pageY at the start of the action are used.
- Annotations
- @JSOptional()
- def propertyIsEnumerable(v: String): Boolean
- Definition Classes
- Object
- val range: UndefOr[Double]
The range of a snap target is the distance the pointer must be from the target’s coordinates for a snap to be possible.
The range of a snap target is the distance the pointer must be from the target’s coordinates for a snap to be possible.
i.e. inRange = distance <= range.
If a snap target doesn’t have it’s own range, the default range is used.
- Annotations
- @JSOptional()
- val relatvePoints: UndefOr[Seq[Point]]
If you want to specify for snap (not snapSize) the points on the element which snapping should be relative to, then use an array of relativePoints.
If you want to specify for snap (not snapSize) the points on the element which snapping should be relative to, then use an array of relativePoints. Each item in the array should be an object with x and y properties which are scalars specifying the position on the element to which snapping should be relative. If no relativePoints array is specified or the array is empty then snapping is relative to the pointer coordinates (default).
There are effectively targets.length * max( relativePoints.length, 1 ) snap targets while snap calculations are done. Snap functions are called multiple times with the coordinates of each relativePoint.
- Annotations
- @JSOptional()
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- val targets: UndefOr[Seq[|[|[SnapTarget, Function2[Double, Double, SnapTarget]], SnapTargetGrid]]]
The elements of this array can be any combination of points and functions which return points to snap to.
The elements of this array can be any combination of points and functions which return points to snap to. If there are multiple snap targets, then the nearest snap target that is in range is used.
POINT TARGETS A snap target can be an object with x, y and range properties. snapSize targets may have either width and height, or x and y. If a target specifies a coordinate in only one axis then snapping will be on a line.
If a target is defined as { y: 100, range Infinity } then the snapped movement will be horizontal at (100, pageX).
FUNCTION TARGETS If a snap target is a function, then it called and given the pageX and pageY coordinates of the event. If the function returns an object, that function is used like a point target.
SNAP GRIDS Use the interact.createSnapGrid method to create a target that snaps to a grid. The method takes an object describing a grid and returns a function that snaps to the corners of that grid.
The properties of the grid are: x, y – the spacing between the horizontal and vertical grid lines. range – (optional) the distance from the grid corners within which the pointer coords will be snapped. offset – (optional) an object with x and y props to offset the grid lines
- Annotations
- @JSOptional()
- def toLocaleString(): String
- Definition Classes
- Object
- def toString(): String
- Definition Classes
- AnyRef → Any
- def valueOf(): Any
- Definition Classes
- Object
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException]) @native()
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
Deprecated Value Members
- def finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable]) @Deprecated
- Deprecated