SheetXL - v0.8.0-beta.9+sites.210.e2d420901
    Preparing search index...

    Interface IGeometry

    A shape's geometry evaluated at one size: its paths, text rectangle, adjust handles and connection sites, in pixels in the shape's own frame (its top-left is 0,0).

    Returned by IShape.getGeometry, which loads whatever the shape needs to evaluate. Once it has resolved, everything here is synchronous: a renderer re-evaluates at a new size (resize) or with new adjust values (withAdjustments) on every frame of a drag.

    const geometry = await shape.getGeometry(200, 100);
    const parts: string[] = [];
    geometry?.forEachPath((path) => {
    if (path.layer === IGeometry.PathLayer.Stroke) parts.push(`<path d="${path.d}" fill="none" stroke="black"/>`);
    });
    interface IGeometry {
        adjustmentsFromHandle(
            index: number,
            x: number,
            y: number,
        ): Record<string, number>;
        forEachConnection(visit: (connection: IConnection) => void): void;
        forEachHandle(visit: (handle: IHandle) => void): void;
        forEachPath(visit: (path: IPath) => void): void;
        getHeight(): number;
        getPathBounds(): Rect;
        getTextRect(): Rect;
        getWidth(): number;
        resize(width: number, height: number): IGeometry;
        withAdjustments(
            adjustments: Readonly<Record<string, number>> | null,
        ): IGeometry;
    }
    Index
    • The adjust values that put a handle as near as it can go to a point: what dragging it there sets. Values the handle does not move are kept as they are.

      Parameters

      • index: number
      • x: number

        In pixels, in the shape's frame.

      • y: number

        In pixels, in the shape's frame.

      Returns Record<string, number>

      Values to pass to IShape.setAdjustments or withAdjustments.

    • Visits the connection sites, in the order a connector's ends index them.

      Parameters

      Returns void

    • Visits the adjust handles, in the order adjustmentsFromHandle indexes them.

      Parameters

      Returns void

    • Visits every path in paint order: a shape's fills, then its strokes, then its markers.

      Parameters

      • visit: (path: IPath) => void

      Returns void

    • The height the geometry was evaluated at, in pixels.

      Returns number

    • The box that holds every path, line ends included, in the shape's frame.

      Returns Rect

      It can reach outside the frame, as a callout's tail does, so its edges may be negative or past getWidth and getHeight. The line's own width is not included. A geometry that draws nothing answers its whole frame.

    • Where text is laid out: the definition's text rectangle, or the whole frame when it declares none.

      Returns Rect

    • The width the geometry was evaluated at, in pixels.

      Returns number

    • The same shape evaluated at another size.

      Parameters

      • width: number
      • height: number

      Returns IGeometry

    • The same shape evaluated with other adjust values.

      Parameters

      • adjustments: Readonly<Record<string, number>> | null

        Values by name, as IShape.setAdjustments takes them (what a handle drag produced); null for the preset's defaults.

      Returns IGeometry