An interface that describes the current context for rendering routines.
Type Details
- yfiles module
- view-component
- yfiles-umd modules
- All view modules
- Legacy UMD name
- yfiles.view.IRenderContext
See Also
Properties
Gets the Canvas that is associated with this context.
Remarks
Defined in
Gets the clipping rectangle in world coordinates.
Remarks
Rendering outside of this clip may be skipped altogether.
Usually this is the viewport rectangle of the canvasComponent, but may also be a sub-region of it. For image export or printing, this is the rectangle that's exported or printed on a page.
Provides access to the defs
element in the SVG DOM that is managed by this instance.
See Also
Gets the radius for hit tests and marquee selection tests in world coordinates.
Remarks
In the default implementations this property automatically distinguishes whether to refer to hitTestRadius (for mouse), or hitTestRadiusTouch (for touch).
This value already takes the zoom level into account.
See Also
Defined in
Gets a transform that can be added to the transform list of a visual to be displayed in the intermediate coordinate system (which still has the same axes directions as the world coordinate system, but doesn't include the projection).
Remarks
Provides access to the SvgDefsManager that manages this instance.
Gets a transform that can be added to the transform list of a visual to be displayed in the view coordinate system.
Remarks
See Also
Provides access to the WebGLSupport that provides convenience methods for WebGL rendering.
Gets the current zoom level that is the ratio of world coordinates to screen pixels.
Defined in
Methods
Notifies the context that the visual
has been removed from the visual tree.
Remarks
This has to be done in a IVisualCreator's updateVisual method if a IVisualCreator's createVisual is called or a previously added visual will be removed or replaced. Calling this method will call a previously registered dispose visual callback that the visual
has been removed and needs to free its resources.
If the visual
has not been registered previously this method will do nothing.
Parameters
A map of options to pass to the method.
- visual - Visual
- The visual which has been removed.
See Also
Adds an element to the defs section of the document, if it has not been added yet.
Parameters
A map of options to pass to the method.
- defsSupport - ISvgDefsCreator
- The instance that is used to create and update the element and to query if the element is still referenced
Returns
- ↪string
- The id of the element with which it can be referenced using an url reference.
Defined in
Converts the given set of intermediate coordinates to a coordinate pair that can be used to render within the viewTransform.
Remarks
Parameters
A map of options to pass to the method.
- intermediatePoint - Point
- The coordinates in the intermediate coordinate system.
Returns
- ↪Point
- The coordinates in the view coordinate system.
Returns an instance that implements the given type or null
.
Remarks
null
implementations for the types, nor does it have to return the same instance any time. Also it depends on the type and context whether the instance returned stays up to date or needs to be reobtained for subsequent use.Type Parameters
- T: any
Parameters
A map of options to pass to the method.
- type - Class<T>
- The type for which an instance shall be returned.
Returns
- ↪T
- an instance that is assignable to type or
null
See Also
$class
property on JavaScript classes inheriting from yFiles classes is only valid once an instance of this subclass was created. Call fixType, first or instantiate the class at least once.Implements
registerForChildrenIfNecessary
<TVisualextends Visual>(visual: TVisual, callback: function(IRenderContext, TVisual, boolean):TVisual)Registers a visual if children have registered themselves for disposal.
Remarks
This is necessary for visual creators which delegate to another visual creator to create one or more child visuals, like style decorators.
Implementors have to add a call to this method at the end of their createVisual and updateVisual methods.
The registered callback
has to call childVisualRemoved on all child visuals of the visual
.
Type Parameters
- TVisual: Visual
Parameters
A map of options to pass to the method.
- visual - TVisual
- The visual to be registered. This is the visual which is returned by the createVisual or updateVisual method which calls this method.
- callback - function(IRenderContext, TVisual, boolean):TVisual
- A dispose visual callback which calls childVisualRemoved on all child visuals of the registered
visual
.Signature Details
function(context: IRenderContext, removedVisual: TVisual, dispose: boolean) : TVisual
A callback which will be called to free the resources which are occupied by the givenremovedVisual
when the visual will be removed.Clients have to register this callback in a createVisual method using method setDisposeCallback if the visual occupies resources which have to be cleaned up after the visual is no longer needed.
The method will be called when the
removedVisual
is removed to free the resources which are allocated by that visual.This callback can also be used to support caching for temporarily removed visuals. A visual is removed temporarily when it is moved out of the viewport and re-added when it is moved back into the viewport.
If the visual should be cached the callback has to return the visual. When it is re-added updateVisual is called for the visual. Note that it is possible that the visual will not be cached or discarded without further notice. Thus, this callback has to free its resources (if necessary) for temporarily removed visuals, too. As a consequence, for cached visuals the updateVisual method has to be able to re-allocate the necessary resources.
Parameters
- context - IRenderContext
- A valid render context.
- removedVisual - TVisual
- The visual whose resources need to be freed.
- dispose - boolean
- Indicates that the visual is not going to be used again in any case and can be disposed for good. In the case that this parameter is set to
true
clients should take this as a signal to free the resources used by theremovedVisual
. If this parameter is set to false, the visual is eventually made visible in the scene graph of theagain and may therefore be reused.
Returns
- TVisual
- The removed visual if it should be cached,
null
otherwise.
setDisposeCallback
<TVisualextends Visual>(visual: TVisual, callback: function(IRenderContext, TVisual, boolean):TVisual)Registers a callback
which will be called when the visual
will be removed from the visual tree.
Remarks
This applies to a IVisualCreator's createVisual method if the created visual
allocates resources which should be freed after the visual is no longer used. In this case the visual has to be registered together with a dispose visual callback which can free the allocated resources. The callback will be called by the framework when the visual is removed from the visual tree.
The callback can also be used to support caching for temporarily removed visuals. See dispose visual callback.
Type Parameters
- TVisual: Visual
Parameters
A map of options to pass to the method.
- visual - TVisual
- The visual which needs to be disposed after removal.
- callback - function(IRenderContext, TVisual, boolean):TVisual
- A callback which will dispose the
visual
.Signature Details
function(context: IRenderContext, removedVisual: TVisual, dispose: boolean) : TVisual
A callback which will be called to free the resources which are occupied by the givenremovedVisual
when the visual will be removed.Clients have to register this callback in a createVisual method using method setDisposeCallback if the visual occupies resources which have to be cleaned up after the visual is no longer needed.
The method will be called when the
removedVisual
is removed to free the resources which are allocated by that visual.This callback can also be used to support caching for temporarily removed visuals. A visual is removed temporarily when it is moved out of the viewport and re-added when it is moved back into the viewport.
If the visual should be cached the callback has to return the visual. When it is re-added updateVisual is called for the visual. Note that it is possible that the visual will not be cached or discarded without further notice. Thus, this callback has to free its resources (if necessary) for temporarily removed visuals, too. As a consequence, for cached visuals the updateVisual method has to be able to re-allocate the necessary resources.
Parameters
- context - IRenderContext
- A valid render context.
- removedVisual - TVisual
- The visual whose resources need to be freed.
- dispose - boolean
- Indicates that the visual is not going to be used again in any case and can be disposed for good. In the case that this parameter is set to
true
clients should take this as a signal to free the resources used by theremovedVisual
. If this parameter is set to false, the visual is eventually made visible in the scene graph of theagain and may therefore be reused.
Returns
- TVisual
- The removed visual if it should be cached,
null
otherwise.
See Also
Converts the given set of world coordinates to a coordinate pair that can be used to render within the viewTransform.
Converts the given set of world coordinates to a coordinate pair that can be used to render within the intermediateTransform.