|
|||||
SUMMARY: FIELD | CONSTR | METHOD| EVENT | DETAIL: FIELD | CONSTR | METHOD| EVENT |
Helper class used by GraphCanvas to limit the interactive movement of the viewport.
The GraphCanvas.viewportLimiter instance should be consulted whenever the user tries to change the viewport. Using method "limitViewport" the desired viewport can be validated by the implementation.
Field Summary | |
---|---|
Object |
bounds
The maximal allowed navigable bounds for the viewport. This value will be used by the default implementation of "limitViewport" to crop the desired viewport to. If this value is "null" (default value) then the viewport will not be cropped. If it is not "null", then this object must provide the fields "x", "y", "width" and "height". |
boolean |
honorBothDimensions
Indicates whether both dimensions of the bounds need to be honored. "true" if both dimensions need to be honored; otherwise, "false". The default value is "true". |
Constructor Summary | |
---|---|
ViewportLimiter()
Initializes a new instance of the ViewportLimiter class. |
Method Summary | |
---|---|
Object |
getBounds(yfiles/client/tiles/widget/GraphCanvas canvas, Object suggestedViewport)
Gets the bounds that should be honored for the upcoming call. |
Object |
limitViewport(yfiles/client/tiles/widget/GraphCanvas canvas, Object suggestedViewport)
Inspects the desired or suggested viewport for the given control and returns a valid viewport to use. |
Field Detail |
---|
Object bounds
The maximal allowed navigable bounds for the viewport. This value will be used by the default implementation of "limitViewport" to crop the desired viewport to. If this value is "null" (default value) then the viewport will not be cropped. If it is not "null", then this object must provide the fields "x", "y", "width" and "height".
boolean honorBothDimensions
Indicates whether both dimensions of the bounds need to be honored. "true" if both dimensions need to be honored; otherwise, "false". The default value is "true".
Constructor Detail |
---|
ViewportLimiter()
Initializes a new instance of the ViewportLimiter class.
Method Detail |
---|
Object getBounds(yfiles/client/tiles/widget/GraphCanvas canvas, Object suggestedViewport)
Gets the bounds that should be honored for the upcoming call.
This method is used as a callback by "limitViewport" for each request. The default implementation just yields the value of the "bounds" field. Returns The bounds to honor (object with properties "x", "y", "width" and "height") or "null".
canvas
- The graph canvas
suggestedViewport
- The suggested viewport. Must be an object with "x", "y", "width" and "height" properties where all of them are of type Number.
Object limitViewport(yfiles/client/tiles/widget/GraphCanvas canvas, Object suggestedViewport)
Inspects the desired or suggested viewport for the given control and returns a valid viewport to use.
Returns the viewport that should be used (object with properties "x", "y", "width" and "height")
canvas
- The graph canvas on which the viewport should be applied.
suggestedViewport
- The suggested viewport. Must be an object with "x", "y", "width" and "height" properties where all of them are of type Number.