Moveable
    Preparing search index...

    Interface RotatableProps

    interface RotatableProps {
        displayAroundControls?: boolean;
        edge?: boolean | LineDirection[];
        onBeforeRotate?: (e: OnBeforeRotate) => any;
        onBeforeRotateGroup?: (e: OnBeforeRotateGroup) => any;
        onRotate?: (e: OnRotate) => any;
        onRotateEnd?: (e: OnRotateEnd) => any;
        onRotateGroup?: (e: OnRotateGroup) => any;
        onRotateGroupEnd?: (e: OnRotateGroupEnd) => any;
        onRotateGroupStart?: (e: OnRotateGroupStart) => any;
        onRotateStart?: (e: OnRotateStart) => any;
        renderDirections?: boolean | string[];
        resolveAblesWithRotatable?: Record<string, LineDirection[]> | null;
        rotatable?: boolean | RotatableOptions;
        rotateAroundControls?: boolean;
        rotationPosition?: RotationPosition | RotationPosition[];
        rotationTarget?:
            | false
            | MoveableRefType<SVGElement | HTMLElement>
            | ArrayFormat<MoveableRefType<SVGElement | HTMLElement>>;
        throttleRotate?: number;
    }

    Hierarchy (View Summary)

    Index
    displayAroundControls?: boolean

    You can expand the area around the control. Either rotateAroundControls or displayAroundControls can be used. You can set the area through the controlPadding value.

    0.44.0

    false
    
    edge?: boolean | LineDirection[]

    Whether to scale and resize through edge lines. You can use "n", "w", "s", "e" in LineDirection array.

    false
    
    import Moveable from "@moveable-next/vanilla";

    const moveable = new Moveable(document.body);
    moveable.edge = true;
    onBeforeRotate?: (e: OnBeforeRotate) => any

    When rotating, beforeRotate is called before rotate occurs. In beforeRotate, you can get and set the pre-value before rotating.

    onBeforeRotateGroup?: (e: OnBeforeRotateGroup) => any

    When rotating the group, beforeRotateGroup is called before rotateGroup occurs. In beforeRotateGroup, you can get and set the pre-value before rotating.

    onRotate?: (e: OnRotate) => any

    When rotating, the rotate event is called.

    import Moveable from "@moveable-next/vanilla";

    const moveable = new Moveable(document.body, { rotatable: true });
    moveable.on("rotate", ({ target, transform, dist }) => {
    target.style.transform = transform;
    });
    onRotateEnd?: (e: OnRotateEnd) => any

    When the rotate finishes, the rotateEnd event is called.

    import Moveable from "@moveable-next/vanilla";

    const moveable = new Moveable(document.body, { rotatable: true });
    moveable.on("rotateEnd", ({ target, isDrag }) => {
    console.log(target, isDrag);
    });
    onRotateGroup?: (e: OnRotateGroup) => any

    When the group rotate, the rotateGroup event is called.

    import Moveable from "@moveable-next/vanilla";

    const moveable = new Moveable(document.body, {
    target: [].slice.call(document.querySelectorAll(".target")),
    rotatable: true
    });
    moveable.on("rotateGroup", ({ targets, events }) => {
    console.log("onRotateGroup", targets);
    events.forEach(ev => {
    const target = ev.target;
    // ev.drag is a drag event that occurs when the group rotate.
    const left = ev.drag.beforeDist[0];
    const top = ev.drag.beforeDist[1];
    const deg = ev.beforeDist;
    });
    });
    onRotateGroupEnd?: (e: OnRotateGroupEnd) => any

    When the group rotate finishes, the rotateGroupEnd event is called.

    import Moveable from "@moveable-next/vanilla";

    const moveable = new Moveable(document.body, {
    target: [].slice.call(document.querySelectorAll(".target")),
    rotatable: true
    });
    moveable.on("rotateGroupEnd", ({ targets, isDrag }) => {
    console.log("onRotateGroupEnd", targets, isDrag);
    });
    onRotateGroupStart?: (e: OnRotateGroupStart) => any

    When the group rotate starts, the rotateGroupStart event is called.

    import Moveable from "@moveable-next/vanilla";

    const moveable = new Moveable(document.body, {
    target: [].slice.call(document.querySelectorAll(".target")),
    rotatable: true
    });
    moveable.on("rotateGroupStart", ({ targets }) => {
    console.log("onRotateGroupStart", targets);
    });
    onRotateStart?: (e: OnRotateStart) => any

    When the rotate starts, the rotateStart event is called.

    import Moveable from "@moveable-next/vanilla";

    const moveable = new Moveable(document.body, { rotatable: true });
    moveable.on("rotateStart", ({ target }) => {
    console.log(target);
    });
    renderDirections?: boolean | string[]

    Set directions to show the control box.

    false if rotatable, ["n", "nw", "ne", "s", "se", "sw", "e", "w"] otherwise
    
    import Moveable from "@moveable-next/vanilla";

    const moveable = new Moveable(document.body, {
    warpable: true,
    renderDirections: ["n", "nw", "ne", "s", "se", "sw", "e", "w"],
    });

    moveable.renderDirections = ["nw", "ne", "sw", "se"];
    import Moveable from "@moveable-next/vanilla";

    const moveable = new Moveable(document.body, {
    scalable: true,
    renderDirections: ["n", "nw", "ne", "s", "se", "sw", "e", "w"],
    });

    moveable.renderDirections = ["nw", "ne", "sw", "se"];
    import Moveable from "@moveable-next/vanilla";

    const moveable = new Moveable(document.body, {
    resizable: true,
    renderDirections: ["n", "nw", "ne", "s", "se", "sw", "e", "w"],
    });

    moveable.renderDirections = ["nw", "ne", "sw", "se"];
    resolveAblesWithRotatable?: Record<string, LineDirection[]> | null

    Sets the control that will cause resize along with rotate. (Only Single Target, Only resizable, Beta)

    null
    
    rotatable?: boolean | RotatableOptions

    Whether or not target can be rotated.

    false
    
    import Moveable from "@moveable-next/vanilla";

    const moveable = new Moveable(document.body);

    moveable.rotatable = true;
    rotateAroundControls?: boolean

    You can rotate around direction controls. Either rotateAroundControls or displayAroundControls can be used.

    0
    
    rotationPosition?: RotationPosition | RotationPosition[]

    You can specify the position of the rotation.

    "top"
    
    import Moveable from "@moveable-next/vanilla";

    const moveable = new Moveable(document.body, {
    rotationPosition: "top",
    });

    moveable.rotationPosition = "bottom"
    rotationTarget?:
        | false
        | MoveableRefType<SVGElement | HTMLElement>
        | ArrayFormat<MoveableRefType<SVGElement | HTMLElement>>

    Set additional rotationTargets.

    null
    
    throttleRotate?: number

    throttle of angle(degree) when rotate.

    0
    
    import Moveable from "@moveable-next/vanilla";

    const moveable = new Moveable(document.body);

    moveable.throttleRotate = 1;