Members
Constructors
Creates a new instance which wraps the specified HTML element.
Parameters
- element: HTMLElement
- The HTML element which this visual wraps.
Properties
Gets or sets the HTML element that is wrapped by this visual.
Static Methods
Creates a new TypedHtmlVisual<TElement> for the given element.
element.The purpose of this factory method is to get an instance of HtmlVisual but with a better matching type for the element property.
Note that this method still returns an instance of the HtmlVisual class, since TypedHtmlVisual<TElement> is just a typeScript type. The main benefit is the added type-safety.
Parameters
- element: TElement
- The element to wrap.
Return Value
- TypedHtmlVisual<TElement>
- A properly typed HtmlVisual for the given element.
See Also
API
- from
The purpose of this factory method is to get an instance of HtmlVisual but with a better matching type of the element property and the ability to store a user-provided object as tag with type-safety.
Note that this method still returns an instance of the HtmlVisual class, since TaggedHtmlVisual<TElement, TTag> is just a typeScript type. The main benefit is the added type-safety.
Parameters
- element: TElement
- The element to wrap.
- tag: TTag
- The object to set to the HtmlVisual as tag.
Return Value
- TaggedHtmlVisual<TElement, TTag>
- A properly typed HtmlVisual for the given element and tag value.
See Also
Developer's Guide
API
- from
Sets the translation and size values of a given HtmlElement to the provided values so that it works well inside an HtmlVisual in a CanvasComponent.
This implementation uses caching if possible and thus performs better than using the plain DOM API when called frequently.
This implementation uses the style property of the element to set the position to absolute and specify left, top, width, and height to specified the px values.
Parameters
- element: HTMLElement
- The element that should be arranged in the HtmlVisual.
- layout: IRectangle
- The values for the rectangle.
Sets the translation and size values of a given HtmlElement to the provided values so that it works well inside an HtmlVisual in a CanvasComponent.
This implementation uses caching if possible and thus performs better than using the plain DOM API when called frequently.
This implementation uses the style property of the element to set the position to absolute and specify left, top, width, and height to specified the px values.
Parameters
- element: HTMLElement
- The element that should be arranged in the HtmlVisual.
- dx: number
- The offset on the x-axis.
- dy: number
- The offset on the y-axis.
- width: number
- The width to set to the element.
- height: number
- The height to set to the element.
Sets the translation values of a given HtmlElement to the provided values so that it works well inside an HtmlVisual in a CanvasComponent.
Parameters
- element: HTMLElement
- The element that should be translated.
- dx: number
- The offset on the x-axis.
- dy: number
- The offset on the y-axis.