Packagecom.yworks.canvas
Classpublic class ViewportLimiter
InheritanceViewportLimiter Inheritance Object
Implements flash.events.IEventDispatcher

Helper class used by 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

bounds
CanvasComponent.viewportLimiter
CanvasComponent.setLimitedZoom()
CanvasComponent.setLimitedViewpoint()
CanvasComponent.setLimitedViewport()
CanvasComponent.setLimitedCenter()


Public Properties
 PropertyDefined 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
Public Methods
 MethodDefined 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
  
limitViewport(canvasComponent:CanvasComponent, suggestedViewport:IRectangle):IRectangle
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
Protected Methods
 MethodDefined By
  
getBounds(canvasComponent:CanvasComponent, suggestedViewport:IRectangle):IRectangle
Gets the to bounds that should be honored for the upcoming call.
ViewportLimiter
Property Detail
boundsproperty
bounds:IRectangle

Gets 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.


Implementation
    public function get bounds():IRectangle
    public function set bounds(value:IRectangle):void
honorBothDimensionsproperty 
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.


Implementation
    public function get honorBothDimensions():Boolean
    public function set honorBothDimensions(value:Boolean):void
Method Detail
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

Returns
Boolean
getBounds()method 
protected function getBounds(canvasComponent:CanvasComponent, suggestedViewport:IRectangle):IRectangle

Gets 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.

Returns
IRectangle — The bounds to honor or null
hasEventListener()method 
public function hasEventListener(type:String):Boolean

Parameters

type:String

Returns
Boolean
limitViewport()method 
public function limitViewport(canvasComponent:CanvasComponent, suggestedViewport:IRectangle):IRectangle

Inspects 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.

Returns
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

Returns
Boolean