| Package | com.yworks.canvas |
| Class | public class ViewportLimiter |
| Inheritance | ViewportLimiter Object |
| Implements | flash.events.IEventDispatcher |
CanvasComponent to limit the interactive movement of the viewport.
The CanvasComponent.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.
Note that setting the CanvasComponent.zoom property or CanvasComponent.viewPoint property will
not be influenced by implementations of this class. It is up to the caller to perform verification.
On CanvasComponent, there are convenience methods setLimitedZoom(),
setLimitedViewport(), setLimitedViewpoint(), and setLimitedCenter() for this purpose.
See also
| Property | Defined By | ||
|---|---|---|---|
| bounds : IRectangle
Gets or sets the maximal allowed navigable bounds for the viewport. | ViewportLimiter | ||
| honorBothDimensions : Boolean
Gets or sets a value indicating whether both dimensions of bounds
need to be honored. | ViewportLimiter | ||
| Method | Defined By | ||
|---|---|---|---|
addEventListener(type:String, listener:Function, useCapture:Boolean = false, priority:int = 0, weakRef:Boolean = false):void | ViewportLimiter | ||
dispatchEvent(event:Event):Boolean | ViewportLimiter | ||
hasEventListener(type:String):Boolean | ViewportLimiter | ||
Inspects the desired or suggested new viewport for the given control and returns a valid viewport to use. | ViewportLimiter | ||
removeEventListener(type:String, listener:Function, useCapture:Boolean = false):void | ViewportLimiter | ||
willTrigger(type:String):Boolean | ViewportLimiter | ||
| Method | Defined By | ||
|---|---|---|---|
Gets the to bounds that should be honored for the upcoming call. | ViewportLimiter | ||
| bounds | property |
bounds:IRectangleGets or sets the maximal allowed navigable bounds for the viewport.
The bounds or null. This value will be used by the default implementation of
limitViewport to crop the desired viewport to.
public function get bounds():IRectangle public function set bounds(value:IRectangle):void| honorBothDimensions | property |
honorBothDimensions:Boolean
Gets or sets a value indicating whether both dimensions of bounds
need to be honored.
true if both dimensions need to be honored; otherwise, false
The default value is false.
This property can be used as the source for data binding.
public function get honorBothDimensions():Boolean public function set honorBothDimensions(value:Boolean):void| addEventListener | () | method |
public function addEventListener(type:String, listener:Function, useCapture:Boolean = false, priority:int = 0, weakRef:Boolean = false):void
Parameters
type:String | |
listener:Function | |
useCapture:Boolean (default = false) | |
priority:int (default = 0) | |
weakRef:Boolean (default = false) |
| dispatchEvent | () | method |
public function dispatchEvent(event:Event):Boolean
Parameters
event:Event |
Boolean |
| getBounds | () | method |
protected function getBounds(canvasComponent:CanvasComponent, suggestedViewport:IRectangle):IRectangleGets the to bounds that should be honored for the upcoming call.
This method is used as callback by limitViewport for each request.
The default implementation just yields bounds.
Parameters
canvasComponent:CanvasComponent — The canvas component.
| |
suggestedViewport:IRectangle — The suggested viewport.
|
IRectangle — The bounds to honor or null
|
| hasEventListener | () | method |
public function hasEventListener(type:String):Boolean
Parameters
type:String |
Boolean |
| limitViewport | () | method |
public function limitViewport(canvasComponent:CanvasComponent, suggestedViewport:IRectangle):IRectangleInspects the desired or suggested new viewport for the given control and returns a valid viewport to use.
Parameters
canvasComponent:CanvasComponent — The canvas component to which the viewport should be applied.
| |
suggestedViewport:IRectangle — The suggested viewport.
|
IRectangle — The viewport that should be used.
|
| removeEventListener | () | method |
public function removeEventListener(type:String, listener:Function, useCapture:Boolean = false):void
Parameters
type:String | |
listener:Function | |
useCapture:Boolean (default = false) |
| willTrigger | () | method |
public function willTrigger(type:String):Boolean
Parameters
type:String |
Boolean |