Package | com.yworks.graph.input |
Class | public class PortLocationModelParameterHandle |
Inheritance | PortLocationModelParameterHandle Object |
Implements | IHandle |
Subclasses | CroppedPortLocationModelParameterHandle |
IHandle
that can be used to move an IPort
interactively
by assigning new IPortLocationModelParameter
s to the IPort.locationModelParameter
property.
This class also provides snapping facilities and can be used in conjunction with both
OrthogonalEdgeEditingContext
as well as GraphSnapContext
.
See also
Property | Defined By | ||
---|---|---|---|
cursor : Cursor [read-only]
Provides the cursor to display when the mouse hovers over or drags this
handle. | PortLocationModelParameterHandle | ||
type : uint [read-only]
Returns the type of the handle that can be used by the rendering engine
to render types differently. | PortLocationModelParameterHandle | ||
x : Number [read-only]
Returns the x coordinate of the current position of the element. | PortLocationModelParameterHandle | ||
y : Number [read-only]
Returns the y coordinate of the current position of the element. | PortLocationModelParameterHandle |
Property | Defined By | ||
---|---|---|---|
_cursor : Cursor | PortLocationModelParameterHandle | ||
_dummyLocation : IPoint | PortLocationModelParameterHandle | ||
_graph : IGraph | PortLocationModelParameterHandle | ||
_lastParameter : IPortLocationModelParameter | PortLocationModelParameterHandle | ||
_model : IPortLocationModel | PortLocationModelParameterHandle | ||
_oldParameter : IPortLocationModelParameter | PortLocationModelParameterHandle | ||
_port : IPort | PortLocationModelParameterHandle | ||
port : IPort [read-only]
The port this handle does move. | PortLocationModelParameterHandle | ||
_type : uint = 0x001 | PortLocationModelParameterHandle |
Method | Defined By | ||
---|---|---|---|
Initializes a new instance to change the IPortLocationModelParameter of the given IPort
| PortLocationModelParameterHandle | ||
cancelDrag(context:IInputModeContext, originalX:Number, originalY:Number):void
Called by clients to indicate that the dragging has been canceled by the user. | PortLocationModelParameterHandle | ||
dragFinished(context:IInputModeContext, originalX:Number, originalY:Number, newX:Number, newY:Number):void
Called by clients to indicate that the repositioning has just been finished. | PortLocationModelParameterHandle | ||
handleMove(context:IInputModeContext, originalX:Number, originalY:Number, newX:Number, newY:Number):Boolean
Called by clients to indicate that the element has been dragged and its position
should be updated. | PortLocationModelParameterHandle | ||
initializeDrag(context:IInputModeContext):void
Called by clients to indicate that the element is going to be dragged. | PortLocationModelParameterHandle | ||
setPosition(x:Number, y:Number):void | PortLocationModelParameterHandle |
Method | Defined By | ||
---|---|---|---|
collectSnapResults(evt:CollectSnapResultEvent):void
Called during the drag to collect snap results. | PortLocationModelParameterHandle | ||
Gets the graph to use for setting the parameter via IGraph.setPortLocationModelParameter from the context. | PortLocationModelParameterHandle | ||
getMoveType(port:IPort):uint
Determines the type of the movement for the given port. | PortLocationModelParameterHandle | ||
getNewParameter(port:IPort, model:IPortLocationModel, newLocation:IPoint):IPortLocationModelParameter
Callback method that obtains the new parameter for the given location and port. | PortLocationModelParameterHandle | ||
Callback method that applies the parameter
| PortLocationModelParameterHandle |
_cursor | property |
protected var _cursor:Cursor
_dummyLocation | property |
protected var _dummyLocation:IPoint
_graph | property |
protected var _graph:IGraph
_lastParameter | property |
protected var _lastParameter:IPortLocationModelParameter
_model | property |
protected var _model:IPortLocationModel
_oldParameter | property |
protected var _oldParameter:IPortLocationModelParameter
_port | property |
protected var _port:IPort
_type | property |
protected var _type:uint = 0x001
cursor | property |
cursor:Cursor
[read-only] Provides the cursor to display when the mouse hovers over or drags this handle.
public function get cursor():Cursor
port | property |
port:IPort
[read-only] The port this handle does move.
protected function get port():IPort
type | property |
type:uint
[read-only] Returns the type of the handle that can be used by the rendering engine to render types differently.
public function get type():uint
x | property |
x:Number
[read-only] Returns the x coordinate of the current position of the element.
The point describes the current world coordinate position of the element.
It is up to the implementation how this position is interpreted.
The values returned by this method will be used for the "originalX
" parameter
in the handleMove
, cancelDrag
and dragFinished
methods.
public function get x():Number
y | property |
y:Number
[read-only] Returns the y coordinate of the current position of the element.
The point describes the current world coordinate position of the element.
It is up to the implementation how this position is interpreted.
The values returned by this method will be used for the "originalY
" parameter
in the handleMove
, cancelDrag
and dragFinished
methods.
public function get y():Number
PortLocationModelParameterHandle | () | Constructor |
public function PortLocationModelParameterHandle(port:IPort)
Initializes a new instance to change the IPortLocationModelParameter
of the given IPort
port:IPort — The port to adjust the location parameter of.
|
cancelDrag | () | method |
public function cancelDrag(context:IInputModeContext, originalX:Number, originalY:Number):void
Called by clients to indicate that the dragging has been canceled by the user.
This method may be called after the initial initializeDrag
and zero or
more invocations of handleMove
.
Implementations should reset the position of the items they modify to their initial state.
Alternatively to this method the dragFinished
method might be called.
Parameters
context:IInputModeContext — The context to retrieve information about the drag from.
| |
originalX:Number — The value of the x property at the time of initializeDrag .
| |
originalY:Number — The value of the y property at the time of initializeDrag .
|
collectSnapResults | () | method |
protected function collectSnapResults(evt:CollectSnapResultEvent):void
Called during the drag to collect snap results.
This implementation will delegate to the IPortSnapResultProvider
that has been received from the port
this instance is bound to.
Parameters
evt:CollectSnapResultEvent — The event argument to obtain the necessary information from and add results to.
|
dragFinished | () | method |
public function dragFinished(context:IInputModeContext, originalX:Number, originalY:Number, newX:Number, newY:Number):void
Called by clients to indicate that the repositioning has just been finished.
This method may be called after the initial initializeDrag
and zero or
more invocations of handleMove
.
Alternatively to this method the cancelDrag
method might be called.
Parameters
context:IInputModeContext — The context to retrieve information about the drag from.
| |
originalX:Number — The value of the x property at the time of initializeDrag .
| |
originalY:Number — The value of the y property at the time of initializeDrag .
| |
newX:Number — The value of the x coordinate in the world coordinate system that the client wants the handle to be at.
Depending on the implementation the x and y properties or may not be modified to reflect the new value.
This is the same value as delivered in the last invocation of handleMove .
| |
newY:Number — The value of the y coordinate in the world coordinate system that the client wants the handle to be at.
Depending on the implementation the x and y properties or may not be modified to reflect the new value.
This is the same value as delivered in the last invocation of handleMove .
|
getGraph | () | method |
protected function getGraph(context:IInputModeContext):IGraph
Gets the graph to use for setting the parameter via IGraph.setPortLocationModelParameter
from the context.
Parameters
context:IInputModeContext — The input mode context to use.
|
IGraph — The graph or null if the graph could not be obtained.
|
getMoveType | () | method |
protected function getMoveType(port:IPort):uint
Determines the type of the movement for the given port.
This is used for the PortMovementInfo
that is passed to the
OrthogonalEdgeEditingContext.addMovedPort
method.
Parameters
port:IPort — The port to determine the move type for.
|
uint — This implementation returns MoveTypes.LINEAR_MOVE for models of type
NodeScaledPortLocationModel and MoveTypes.NON_LINEAR_MOVE for all others.
|
See also
getNewParameter | () | method |
protected function getNewParameter(port:IPort, model:IPortLocationModel, newLocation:IPoint):IPortLocationModelParameter
Callback method that obtains the new parameter for the given location and port.
Parameters
port:IPort — The port to obtain a parameter for.
| |
model:IPortLocationModel — The model to use.
| |
newLocation:IPoint — The new location.
|
IPortLocationModelParameter — The new parameter to use.
|
handleMove | () | method |
public function handleMove(context:IInputModeContext, originalX:Number, originalY:Number, newX:Number, newY:Number):Boolean
Called by clients to indicate that the element has been dragged and its position should be updated.
This method may be called more than once after an initial initializeDrag
and will be followed by either dragFinished
or cancelDrag
.
Parameters
context:IInputModeContext — The value of the x property at the time of initializeDrag .
| |
originalX:Number — The value of the y property at the time of initializeDrag .
| |
originalY:Number — The value of the x coordinate in the world coordinate system that the client wants the handle to be at.
Depending on the implementation the x property may or may not be modified to reflect the new value.
| |
newX:Number — The value of the y coordinate in the world coordinate system that the client wants the handle to be at.
Depending on the implementation the y property may or may not be modified to reflect the new value.
| |
newY:Number |
Boolean — Whether the move had any visual effect. This is a hint to the engine to optimize invalidation.
|
initializeDrag | () | method |
public function initializeDrag(context:IInputModeContext):void
Called by clients to indicate that the element is going to be dragged.
This call will be followed by one or more calls to handleMove
,
and a final dragFinished
or cancelDrag
.
Parameters
context:IInputModeContext — The context to retrieve information about the drag from.
|
setParameter | () | method |
protected function setParameter(graph:IGraph, port:IPort, newParameter:IPortLocationModelParameter):void
Callback method that applies the parameter
Parameters
graph:IGraph — The graph to use for applying.
| |
port:IPort — The port to apply the parameter to.
| |
newParameter:IPortLocationModelParameter — The new parameter to apply.
|
setPosition | () | method |
public function setPosition(x:Number, y:Number):void
Parameters
x:Number | |
y:Number |