Foundry Virtual Tabletop - API Documentation - Version 14
    Preparing search index...

    Interface RegionPlacementOptions

    interface RegionPlacementOptions {
        allowEmpty?: boolean;
        allowRotation?: boolean;
        attachToToken?: boolean;
        create?: boolean;
        createOptions?: Partial<Omit<DatabaseCreateOperation, "parent">>;
        onChange?: (
            args: {
                document: RegionDocument;
                preview: Region;
                regionCount: number;
                regionIndex: number;
                shape: BaseShapeData;
                shapeCount: number;
                shapeIndex: number;
            },
        ) => void;
        onMove?: (
            args: {
                document: RegionDocument;
                event: FederatedEvent;
                position: Point;
                preview: Region;
                regionCount: number;
                regionIndex: number;
                shape: BaseShapeData;
                shapeCount: number;
                shapeIndex: number;
                snap: boolean;
            },
        ) => boolean
        | void;
        onRotate?: (
            args: {
                document: RegionDocument;
                event: WheelEvent;
                precise: boolean;
                preview: Region;
                regionCount: number;
                regionIndex: number;
                shape: BaseShapeData;
                shapeCount: number;
                shapeIndex: number;
            },
        ) => boolean
        | void;
        preCommit?: (documents: readonly RegionDocument[]) => void | Promise<any>;
        preConfirm?: (
            args: {
                document: RegionDocument;
                event: FederatedEvent;
                regionCount: number;
                regionIndex: number;
                shape: BaseShapeData;
                shapeCount: number;
                shapeIndex: number;
            },
        ) => boolean
        | void;
        preSkip?: (
            args: {
                document: RegionDocument;
                event: FederatedEvent;
                regionCount: number;
                regionIndex: number;
                shape: BaseShapeData;
                shapeCount: number;
                shapeIndex: number;
            },
        ) => boolean
        | void;
    }
    Index

    Properties

    allowEmpty?: boolean

    Create/return an empty Region if all shapes are skipped? Default: false.

    allowRotation?: boolean

    Allow rotation of the Region? Default: true.

    attachToToken?: boolean

    Attach the Region to Tokens? If true, the initial elevation range passed in data is relative to the attached Token. Default: false.

    create?: boolean

    Create the Region? If false, the preview document is returned. Default: true. Non-GMs cannot create Regions while the game is paused.

    createOptions?: Partial<Omit<DatabaseCreateOperation, "parent">>

    Optional creation options. By default the creation option controlObject is true.

    onChange?: (
        args: {
            document: RegionDocument;
            preview: Region;
            regionCount: number;
            regionIndex: number;
            shape: BaseShapeData;
            shapeCount: number;
            shapeIndex: number;
        },
    ) => void

    Called when the Region shape that is placed has changed.

    onMove?: (
        args: {
            document: RegionDocument;
            event: FederatedEvent;
            position: Point;
            preview: Region;
            regionCount: number;
            regionIndex: number;
            shape: BaseShapeData;
            shapeCount: number;
            shapeIndex: number;
            snap: boolean;
        },
    ) => boolean
    | void

    Called when the pointer is moved and after starting the placement of the next shape on confirm and skip. This callback replaces the default behavior if false is returned. If false is returned, the callback should modify the passed shape and may additionally modify preview.document and set the render flags on preview corresponding to the applied changes.

    onRotate?: (
        args: {
            document: RegionDocument;
            event: WheelEvent;
            precise: boolean;
            preview: Region;
            regionCount: number;
            regionIndex: number;
            shape: BaseShapeData;
            shapeCount: number;
            shapeIndex: number;
        },
    ) => boolean
    | void

    Called when the mouse wheel is scrolled. This callback replaces the default behavior if false is returned. If false is returned, the callback should modify the shape and may additionally modify preview.document and set the render flags on preview corresponding to the applied changes.

    preCommit?: (documents: readonly RegionDocument[]) => void | Promise<any>

    Called at the end of the workflow before the Region documents are created/returned. This callback may return a falsely value other than undefined to prevent the Regions from being created/returned.

    preConfirm?: (
        args: {
            document: RegionDocument;
            event: FederatedEvent;
            regionCount: number;
            regionIndex: number;
            shape: BaseShapeData;
            shapeCount: number;
            shapeIndex: number;
        },
    ) => boolean
    | void

    Called before the confirmation (left-click) of a shape placement. This callback may return false to prevent the placement of the Region shape and display a warning.

    preSkip?: (
        args: {
            document: RegionDocument;
            event: FederatedEvent;
            regionCount: number;
            regionIndex: number;
            shape: BaseShapeData;
            shapeCount: number;
            shapeIndex: number;
        },
    ) => boolean
    | void

    Called before skipping (right-click) of a shape placement. This callback may return false to prevent skipping of the Region shape and display a warning.