This interface describes the context for many operations performed on items in a canvasComponent.
Remarks
This interface extends the ILookup interface to provide dynamic lookup capability.
Type Details
- yfiles module
- view-component
- yfiles-umd modules
- All view modules
- Legacy UMD name
- yfiles.view.ICanvasContext
Properties
Gets the Canvas that is associated with this context.
Remarks
This value may be null in those cases where no control can be associated with the current context.
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
Methods
Adds an element to the defs section of the document, if it has not been added yet.
Parameters
options - Object
A map of options to pass to the method.
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.
Returns an instance that implements the given type or null
.
Remarks
Typically, this method will be called in order to obtain a different view or aspect of the current instance. This is quite similar to casting or using a super type or interface of this instance, but is not limited to inheritance or compile time constraints. An instance implementing this method is not required to return non-
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
options - Object
A map of options to pass to the method.
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
Note that the
$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.Defined in
Constants
Provides a default immutable context with a hit radius of 3 and a zoom level of 1.
Static Methods
createCanvasContext
(canvas: CanvasComponent, zoom?: number, hitTestRadius?: number) : ICanvasContextProvides a default immutable ICanvasContext with the given values.
Remarks
If the values for zoom or hitTestRadius are not specified, the values will be obtained from the given canvas.
Parameters
options - Object
A map of options to pass to the method.
A map of options to pass to the method.
- canvas - CanvasComponent
- the canvas
- zoom - number
- the zoom level
- hitTestRadius - number
- the hit test radius