interface RVG · Core

RvgGraphic

interface RvgGraphic

The graphic returned by VisQuill.create: its canvas group, frame and center, and ready for the fonts.

Properties

canvasreadonly

canvas: RvgGroup

Gets the root group of the graphic hierarchy.

centerreadonly

center: Point

The center of the graphic's frame.

Reactive: it follows the frame when the container is resized.

framereadonly

frame: Box

The frame of the graphic: the box from (0, 0) to the width and height of its container, in pixels.

Reactive: it follows resizes of the container (all coordinates in one update), and code that depends on it (Reactive.do([graphic.frame], …), Attach) runs again. Use it to fit content to the space.

readyreadonly

ready: Bool

True once the fonts of the page are loaded, so that texts are measured with their real font; false again while new fonts load. Reactive.

Text extents (label.extent) update on their own when the fonts change, so reactive code needs nothing else. Use ready for code that runs once: Reactive.do([graphic.ready], () => { if (graphic.ready.value) layoutOnce(); }).

Methods

dispose

dispose(): void

Releases resources associated with the graphic. The graphic is removed from the DOM.

layer

layer(classPrefix: string): RvgGroup

Creates or retrieves a layer group with a prefix for styling.

classPrefix
Optional class prefix to apply to the layer for styling purposes. Defaults to an empty string. Example: If classPrefix is set to "example-" and a polygon is created with group.Polygon("my-polygon"), the visual element will be assigned the class "example-my-polygon".

Returns A group representing the layer.

layer(): RvgGroup

Creates or retrieves a layer group.

Returns A group representing the layer.