Interface IDrawingModel<J>

AnchoredItem belong to a sheet and is anchored to a range of cells.

interface IDrawingModel<J> {
    addListener: ((listener) => RemoveListener);
    isAnchoredItem: true;
    isDrawing: true;
    moveBackward: (() => void);
    moveForward: (() => void);
    moveToBack: (() => void);
    moveToFront: (() => void);
    type: string;
    uuid: string;
    zIndex: number;
    close(): void;
    copyTo?(sheet, destination, options?): void;
    delete(): void;
    getAnchor(): CellRangeCoords;
    getAnchorType?(): AnchorType;
    getBounds(): Bounds;
    getDescription(): string;
    getName(): string;
    getRotation(): number;
    isClosed(): boolean;
    isHidden(): boolean;
    isLockAspectRatio(): boolean;
    isProtected(): boolean;
    setAnchorType?(anchorType): void;
    setBounds(bounds, options?): void;
    setDescription(description): void;
    setHidden(hidden): void;
    setLockAspectRatio(locked): void;
    setName(name): void;
    setRotation(rotation): void;
    toJSON?(toResourceId?): DrawingAnchorJSON<J>;
}

Type Parameters

Hierarchy (view full)

Implemented by

Properties

addListener: ((listener) => RemoveListener)

All for listen to changes to the sheet. To remove listener call the returned function.

Type declaration

Returns

An unsubscribe function

isAnchoredItem: true

For runtime type checking

isDrawing: true

For runtime inspection.

moveBackward: (() => void)

Move drawing backward one layer in the zIndex.

Type declaration

    • (): void
    • Returns void

moveForward: (() => void)

Move drawing forward one layer in the zIndex.

Type declaration

    • (): void
    • Returns void

moveToBack: (() => void)

Move drawing to the back in the zIndex.

Type declaration

    • (): void
    • Returns void

moveToFront: (() => void)

Move drawing to the font in the zIndex.

Type declaration

    • (): void
    • Returns void

type: string

Unique type for the drawing object.

uuid: string

A specific uuid for use in memory.

Remarks

Useful for caches and react keys. This is not persisted.

zIndex: number

The order in the z plane. To adjust this use the move methods.

Methods

  • Similar to delete but cleans resources and can't be undone..

    Returns void

  • Return the absolute bounds of the drawing object in pixels.

    Returns Bounds

  • Returns string

    See

    #setDescription

  • Returns string

    See

    #setName

  • Returns number

    See

    #setHidden

  • Returns if the model has been closed

    Returns boolean

  • Returns boolean

    See

    #setHidden

  • Returns boolean

    See

    #setLockAspectRatio

  • Set the absolution position of a drawing in pixels. If only some of the points are provided then only those will be moved.

    Parameters

    Returns void

  • This is the alternative text use for assistive technologies.

    Parameters

    • description: string

    Returns void

    Default Value

    null
    
  • If true then the drawing object is hidden.

    Parameters

    • hidden: boolean

    Returns void

    Default Value

    false
    
  • If true then the aspect should be maintained during resize if using the corners or if the api only specifies one dimension.

    Parameters

    • locked: boolean

    Returns void

    Default Value

    depends on the drawing type.
    
  • Set the name for a drawing object.

    Parameters

    • name: string

    Returns void

  • Set the rotation in degrees.

    Parameters

    • rotation: number

    Returns void

    Default Value

    0
    
  • If defined this will be called when the containing sheet is being serialized.

    Parameters

    • Optional toResourceId: ((resource) => number)

    Returns DrawingAnchorJSON<J>