interface RVG · Core
RvgGroup
interface RvgGroup extends RvgVisual
A layer of a graphic: it creates shapes, visuals, texts, values and handles, and moves, turns and scales them together through its anchor.
The canvas of a graphic is a group; layer(…) creates a group inside it. Things are created
through the factories of a group (shapes, visuals, text, values, handles, viewports)
and belong to it: reactive points of one group can't be vertices of a shape in another group.
The anchor places the group's coordinates in its parent's: setting it moves, turns and scales
everything in the group at once. A layer is therefore the way to turn something (a clock hand, a
label): put it in a layer and set the layer's anchor. zIndex orders the group among the visuals
of its parent; visible and mounted act on all of its content. dispose() removes it.
Properties
anchorreadonly
anchor: PinGets the anchor pin for this group, which describes a Cartesian coordinate system.
The pin defines the transformation between this group's local coordinate system and its parent's coordinate system:
- The anchor location corresponds to the origin (0,0) in the parent's coordinate system.
- The length of the pin's orientation vector corresponds to the scaling factor applied to the group.
- The direction of the pin's orientation vector corresponds to the rotation of the group.
By default the anchor is at (0, 0) with direction (1, 0): the group's coordinates are those of its parent.
graphicreadonly
graphic: RvgGraphicThe graphic the group belongs to, the object returned by VisQuill.create.
handlesreadonly
handles: RvgHandleFactoryGets the handle factory for creating interactive manipulation handles within this group.
maskreadonly
mask: RvgMaskGets the mask controller for this group.
The mask allows defining geometric regions that restrict the visibility of elements within
this group. Only content inside the configured mask shapes will be rendered. Mask regions can
be defined using polygons, circles, or boxes. Calling RvgMask.clear removes all mask
regions.
shapesreadonly
shapes: RvgShapeFactoryGets the shape factory for creating geometric shapes within this group.
textreadonly
text: RvgTextFactoryGets the text factory for creating text elements within this group.
valuesreadonly
values: RvgValueFactoryGets the value factory for creating reactive value containers within this group.
viewportsreadonly
viewports: RvgViewportFactoryGets the viewport factory for creating viewports (box or circle) within this group.
visiblereadonly
visible: BoolWhether the group and its content are drawn.
The visuals in the group keep their own visible, so showing the group again shows them as
they were.
visualsreadonly
visuals: RvgVisualFactoryGets the visual factory for creating styled visual elements within this group.
Methods
dispose
dispose(): voidRemoves the group, its layers and all visuals in them from the graphic and ends their reactive links.
Don't use the group or anything created in it afterwards.
Known issue: a Reactive.do or Attach whose first sender lies outside the group keeps
running, and stays in memory until that sender is disposed; list one of the group's own
objects first.
layer
layer(classPrefix?: string | null): RvgGroupCreates a group inside this one, drawn above the visuals created before it (see zIndex).
classPrefixoptional- Added to this group's class prefix for the visuals of the new layer: in a graphic created with
"t-",layer("lab-")gives the classt-lab-labelfor the style"label".
Returns The new group.
refreshContent
refreshContent(): voidForces an update of all reactive elements within this group.
This method triggers a refresh of the group's content, ensuring that all visual elements are
updated to reflect their current state. Use it after writing into a vertex of a shape visual
that was created without points or from plain coordinates ([x, y]): such a write is not
drawn until something else redraws the group.
The refresh does not propagate through child layers and their contents.
Inherited
From RvgVisual applyStyleDirective, fromGraphic, getVisualBoundingBox, mounted, toGraphic, zIndex
