Packagecom.yworks.canvas.drawing
Classpublic class BoundsProvider
InheritanceBoundsProvider Inheritance Object
Implements IBoundsProvider

Simple default implementation of IBoundsProvider that returns a constant rectangle instance.



Public Methods
 MethodDefined By
  
Creates an instance that return the given model as the bounds.
BoundsProvider
  
Returns the internal instance.
BoundsProvider
Public Constants
 ConstantDefined By
  EMPTY : IBoundsProvider
[static] IBoundsProvider that yields "Empty" bounds.
BoundsProvider
  UNBOUND : IBoundsProvider
[static] An IBoundsProvider that yields "infinite"/unbound bounds.
BoundsProvider
Constructor Detail
BoundsProvider()Constructor
public function BoundsProvider(rect:IRectangle)

Creates an instance that return the given model as the bounds.

Parameters
rect:IRectangle — The rectangle this instance will return.
Method Detail
calculateBounds()method
public function calculateBounds(scratch:IMutableRectangle, ctx:ICanvasContext):IRectangle

Returns the internal instance. Returns a tight rectangular area where the whole rendering would fit into.

Implementations can use the scratch rectangle to put their results in and return it as the result of the operation. Client has to always provide a non-null instance as a parameter. They may however decide to return an internally cached or dynamically created IRectangle implementation and disregard the scratch parameter. If calculating the bounds is too expensive or the painting is not bound to a certain area, this method may return null. If nothing is painted, this method should return an empty rectangle, where either or both the width and height is non-positive or ImmutableRectangle.Empty.

Parameters

scratch:IMutableRectangle — An instance that can optionally be used to fill with the corresponding values and be returned
 
ctx:ICanvasContext — The context to calculate the bounds for (currently not used)

Returns
IRectangle — The bounds or null to indicate an unbound area
Constant Detail
EMPTYConstant
public static const EMPTY:IBoundsProvider

IBoundsProvider that yields "Empty" bounds.

UNBOUNDConstant 
public static const UNBOUND:IBoundsProvider

An IBoundsProvider that yields "infinite"/unbound bounds.