|
Search this API | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object y.view.AbstractSnapContext y.view.HotSpotSnapContext
public class HotSpotSnapContext
The context that is used by HotSpotMode
and the like that manages snap lines and the snapping
of node bounds during a node resize operation.
Constructor Summary | |
---|---|
HotSpotSnapContext()
Creates a new instance of this class using no initial view . |
|
HotSpotSnapContext(Graph2DView view)
Creates a new instance of this class using the provided view for the initial view . |
Method Summary | |
---|---|
protected void |
addFixedSnapLines(Node node,
java.util.Collection snapLines)
Callback used by getFixedSnapLines(java.util.Collection) that
collects SnapLine instances for a given fixed node. |
protected void |
addFixedSnapLines(NodeRealizer realizer,
java.util.Collection result)
Simple method that will add SnapLine methods to the result
Collection for the given NodeRealizer . |
YPoint |
adjustMouseCoordinates(YPoint currentLocation,
byte hotSpotType,
boolean aspectRatioResize,
boolean centerResize)
Main method used by clients to actually perform the snapping of the mouse coordinates after this instances has been initialized . |
void |
cleanUp()
Called after the snapping operation is done to clean up internal data structures. |
protected java.util.List |
getFixedSnapLines(java.util.Collection fixedNodes)
Collects the SnapLine s of the nodes that will not be resized during
the current resize operation. |
void |
initializeResize(YPoint initialCoordinates,
java.util.Collection nodesToResize,
DataProvider originalNodeBoundsDP)
Initializes this context object for a node resize operation. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public HotSpotSnapContext()
view
.
The view needs to be set
before this context can
be initializeResize(y.geom.YPoint, java.util.Collection, y.base.DataProvider)
initialized}.
public HotSpotSnapContext(Graph2DView view)
view
.
view
- the view to use.initializeResize(y.geom.YPoint, java.util.Collection, y.base.DataProvider)
Method Detail |
---|
public void cleanUp()
AbstractSnapContext
AbstractSnapContext.initialize()
. Note that subclasses
provide more specialized initialization and cleanup methods.
cleanUp
in class AbstractSnapContext
public void initializeResize(YPoint initialCoordinates, java.util.Collection nodesToResize, DataProvider originalNodeBoundsDP)
initialCoordinates
- The initial mouse coordinates.nodesToResize
- The collections of Node
s to resize during the resize operationoriginalNodeBoundsDP
- The bounds of the nodes before the operation. This DataProvider
needs to yield for each Node
an instance of Rectangle2D
that describes
the bounds of the node at the beginning of the resize operation.protected java.util.List getFixedSnapLines(java.util.Collection fixedNodes)
SnapLine
s of the nodes that will not be resized during
the current resize operation.
fixedNodes
- The collection of Node
s that will stay fixed during the operation.
SnapLine
s that are induced by the fixed nodes.addFixedSnapLines(y.base.Node, java.util.Collection)
protected void addFixedSnapLines(Node node, java.util.Collection snapLines)
getFixedSnapLines(java.util.Collection)
that
collects SnapLine
instances for a given fixed node.
This will only add the lines of the node to the collection if the node
intersects the view
.
node
- The node to collect lines for.snapLines
- The collection to add the SnapLine
instances to.addFixedSnapLines(NodeRealizer, java.util.Collection)
protected void addFixedSnapLines(NodeRealizer realizer, java.util.Collection result)
SnapLine
methods to the result
Collection for the given NodeRealizer
.
realizer
- The realizer of a fixed noderesult
- The collection to add SnapLine
instances to.public YPoint adjustMouseCoordinates(YPoint currentLocation, byte hotSpotType, boolean aspectRatioResize, boolean centerResize)
initialized
.
currentLocation
- The actual location of the mouse in the world coordinate system.hotSpotType
- The type of the hot spot the mouse is adjusting, see HotSpotMode
.aspectRatioResize
- Whether the resize operation is an aspect ratio fixed resize.centerResize
- Whether the resize operation keeps the center of the nodes fixed.
AbstractSnapContext.resetResults()
|
© Copyright 2000-2022, yWorks GmbH. All rights reserved. |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |