Moveable
    Preparing search index...

    Interface ScalableEvents

    Index
    onBeforeScale: OnBeforeScale

    When scaling, beforeScale is called before scale occurs. In beforeScale, you can get and set the pre-value before scaling.

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

    const moveable = new Moveable(document.body, { scalable: true });
    moveable.on("beforeScale", ({ setFixedDirection }) => {
    if (shiftKey) {
    setFixedDirection([0, 0]);
    }
    });
    moveable.on("scale", ({ target, transform, dist }) => {
    target.style.transform = transform;
    });
    onBeforeScaleGroup: OnBeforeScaleGroup

    When scaling the group, beforeScaleGroup is called before scaleGroup occurs. In beforeScaleGroup, you can get and set the pre-value before scaling.

    onScale: OnScale

    When scaling, the scale event is called.

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

    const moveable = new Moveable(document.body, { scalable: true });
    moveable.on("scale", ({ target, transform, dist }) => {
    target.style.transform = transform;
    });
    onScaleEnd: OnScaleEnd

    When the scale finishes, the scaleEnd event is called.

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

    const moveable = new Moveable(document.body, { scalable: true });
    moveable.on("scaleEnd", ({ target, isDrag }) => {
    console.log(target, isDrag);
    });
    onScaleGroup: OnScaleGroup

    When the group scale, the scaleGroup event is called.

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

    const moveable = new Moveable(document.body, {
    target: [].slice.call(document.querySelectorAll(".target")),
    scalable: true
    });
    moveable.on("scaleGroup", ({ targets, events }) => {
    console.log("onScaleGroup", targets);
    events.forEach(ev => {
    const target = ev.target;
    // ev.drag is a drag event that occurs when the group scale.
    const left = ev.drag.beforeDist[0];
    const top = ev.drag.beforeDist[1];
    const scaleX = ev.scale[0];
    const scaleY = ev.scale[1];
    });
    });
    onScaleGroupEnd: OnScaleGroupEnd

    When the group scale finishes, the scaleGroupEnd event is called.

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

    const moveable = new Moveable(document.body, {
    target: [].slice.call(document.querySelectorAll(".target")),
    scalable: true
    });
    moveable.on("scaleGroupEnd", ({ targets, isDrag }) => {
    console.log("onScaleGroupEnd", targets, isDrag);
    });
    onScaleGroupStart: OnScaleGroupStart

    When the group scale starts, the scaleGroupStart event is called.

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

    const moveable = new Moveable(document.body, {
    target: [].slice.call(document.querySelectorAll(".target")),
    scalable: true
    });
    moveable.on("scaleGroupStart", ({ targets }) => {
    console.log("onScaleGroupStart", targets);
    });
    onScaleStart: OnScaleStart

    When the scale starts, the scaleStart event is called.

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

    const moveable = new Moveable(document.body, { scalable: true });
    moveable.on("scaleStart", ({ target }) => {
    console.log(target);
    });