Package | com.yworks.canvas.input.snapLines |
Class | public class SnapResult |
Inheritance | SnapResult flash.events.EventDispatcher |
Subclasses | SnapLineSnapResult |
SnapContext
to model the result
of the mouse being snapped to a certain coordinate.
It carries a weight and can be used to obtain an IDisplayObjectCreator
that will be included in the view
if the result is actually snapped after all other results with higher weight have been snapped.
See also
Property | Defined By | ||
---|---|---|---|
nullResult : SnapResult [static] [read-only]
A SnapResult representing that there is no snapping of the x or y coordinate. | SnapResult | ||
tag : Object [read-only]
The tag associated with this result. | SnapResult | ||
weight : Number [read-only]
Yields the weight of this result, the higher the weight, the more important it is. | SnapResult |
Property | Defined By | ||
---|---|---|---|
_tag : Object
The tag associated with this result. | SnapResult | ||
_weight : Number
Yields the weight of this result, the higher the weight, the more important it is. | SnapResult |
Method | Defined By | ||
---|---|---|---|
compareTo(snapResultA:Object, snapResultB:Object):int [static]
Compares the weights of the two SnapResults. | SnapResult | ||
createPointSnapResult(location:IPoint, weight:Number, tag:Object, creator:IDisplayObjectCreator, snapType:uint):SnapResult [static]
Factory method that creates a SnapResult that snaps to a given location. | SnapResult | ||
createResizeSnapResult(weight:Number, delta:Number, tag:Object, rectangles:Iterable, size:Number, orientation:SnapLineOrientation, resourceKey:ResourceKey):SnapResult [static]
Factory method that creates a SnapResult that snaps to a given size. | SnapResult | ||
Returns a display object creator to visualize this snap result. | SnapResult | ||
Checks whether this instance is still snapped given the final mouse coordinates. | SnapResult | ||
Core method that performs the actual snapping. | SnapResult | ||
valueOf():Object
Returns the weight of this result. | SnapResult |
_tag | property |
protected var _tag:Object
The tag associated with this result.
If more than one result uses the same tag (not null
), only the one with the highest
weight will be rendered.
_weight | property |
protected var _weight:Number
Yields the weight of this result, the higher the weight, the more important it is.
nullResult | property |
nullResult:SnapResult
[read-only]
A SnapResult
representing that there is no snapping of the x or y coordinate.
public static function get nullResult():SnapResult
tag | property |
tag:Object
[read-only]
The tag associated with this result.
If more than one result uses the same tag (not null
), only the one with the highest
weight will be rendered.
public function get tag():Object
See also
weight | property |
weight:Number
[read-only] Yields the weight of this result, the higher the weight, the more important it is.
public function get weight():Number
compareTo | () | method |
public static function compareTo(snapResultA:Object, snapResultB:Object):int
Compares the weight
s of the two SnapResult
s.
Parameters
snapResultA:Object — The first SnapResult to compare.
| |
snapResultB:Object — The second SnapResult to compare.
|
int — The comparison of the weight s of the two SnapResult s.
|
createPointSnapResult | () | method |
public static function createPointSnapResult(location:IPoint, weight:Number, tag:Object, creator:IDisplayObjectCreator, snapType:uint):SnapResult
Factory method that creates a SnapResult
that snaps to a given location.
Parameters
location:IPoint — The location to snap to.
| |
weight:Number — The weight to assign to the result.
| |
tag:Object — The tag to use.
| |
creator:IDisplayObjectCreator — The display object creator to use.
| |
snapType:uint — The type of the snapping operation to apply.
|
SnapResult — A result that snaps to the provided location using the provided mode.
|
See also
createResizeSnapResult | () | method |
public static function createResizeSnapResult(weight:Number, delta:Number, tag:Object, rectangles:Iterable, size:Number, orientation:SnapLineOrientation, resourceKey:ResourceKey):SnapResult
Factory method that creates a SnapResult
that snaps to a given size.
Parameters
weight:Number — The weight to assign to the result.
| |
delta:Number — The value to add to the mouse coordinates to snap to that result.
| |
tag:Object — The tag associated with this result. If more than one result uses the same tag (not null ),
only the one with the highest weight will be rendered.
| |
rectangles:Iterable — An Iterable of IRectangle s containing the bounds of the resized objects
as well as the bounds of the (non-resizing) rectangular objects the snapped size was based upon.
| |
size:Number — The equal size the resized objects snapped to.
| |
orientation:SnapLineOrientation — The orientation of the resize gesture.
| |
resourceKey:ResourceKey — The key that shall be used to create an appropriate IDisplayObjectCreator implementation
for this snap result.
|
SnapResult — A result that snaps to the provided size using the provided mode.
|
getDisplayObjectCreator | () | method |
public function getDisplayObjectCreator(snapContext:SnapContext):IDisplayObjectCreator
Returns a display object creator to visualize this snap result. This method has to be overridden by subclasses.
Parameters
snapContext:SnapContext |
IDisplayObjectCreator |
isSnapped | () | method |
public function isSnapped(unsnappedCoordinates:IPoint, finalSnapState:SnapState):Boolean
Checks whether this instance is still snapped given the final mouse coordinates.
This implementation simply returns false
.
Parameters
unsnappedCoordinates:IPoint — The unsnapped coordinates.
| |
finalSnapState:SnapState — The final snap state that has been used by the client.
|
Boolean — Whether the coordinates are still snapped for this instance.
|
snap | () | method |
public function snap(unsnappedCoordinates:IPoint, currentSnapState:SnapState):void
Core method that performs the actual snapping. This implementation does nothing.
Parameters
unsnappedCoordinates:IPoint — The coordinates prior to the snapping.
| |
currentSnapState:SnapState — The currently snapped coordinates and the state of the snapping.
This instance can be modified by subclasses.
|
See also
valueOf | () | method |
public function valueOf():Object
Returns the weight
of this result.
Object — The weight of this result.
|
See also