Moveable
    Preparing search index...

    Interface ResizableEvents

    Index
    onBeforeResize: OnBeforeResize

    When resizing, beforeResize is called before resize occurs. In beforeResize, you can get and set the pre-value before resizing.

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

    const moveable = new Moveable(document.body, { resizable: true });
    moveable.on("beforeResize", ({ setFixedDirection }) => {
    if (shiftKey) {
    setFixedDirection([0, 0]);
    }
    });
    moveable.on("resize", ({ target, width, height, drag }) => {
    target.style.width = `${width}px`;
    target.style.height = `${height}px`;
    target.style.transform = drag.transform;
    });
    onBeforeResizeGroup: OnBeforeResizeGroup

    When resizing the group, beforeResizeGroup is called before resizeGroup occurs. In beforeResizeGroup, you can get and set the pre-value before resizing.

    onResize: OnResize

    When resizing, the resize event is called.

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

    const moveable = new Moveable(document.body, { resizable: true });
    moveable.on("resize", ({ target, width, height }) => {
    target.style.width = `${e.width}px`;
    target.style.height = `${e.height}px`;
    });
    onResizeEnd: OnResizeEnd

    When the resize finishes, the resizeEnd event is called.

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

    const moveable = new Moveable(document.body, { resizable: true });
    moveable.on("resizeEnd", ({ target, isDrag }) => {
    console.log(target, isDrag);
    });
    onResizeGroup: OnResizeGroup

    When the group resize, the resizeGroup event is called.

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

    const moveable = new Moveable(document.body, {
    target: [].slice.call(document.querySelectorAll(".target")),
    resizable: true
    });
    moveable.on("resizeGroup", ({ targets, events }) => {
    console.log("onResizeGroup", targets);
    events.forEach(ev => {
    const offset = [
    direction[0] < 0 ? -ev.delta[0] : 0,
    direction[1] < 0 ? -ev.delta[1] : 0,
    ];
    // ev.drag is a drag event that occurs when the group resize.
    const left = offset[0] + ev.drag.beforeDist[0];
    const top = offset[1] + ev.drag.beforeDist[1];
    const width = ev.width;
    const top = ev.top;
    });
    });
    onResizeGroupEnd: OnResizeGroupEnd

    When the group resize finishes, the resizeGroupEnd event is called.

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

    const moveable = new Moveable(document.body, {
    target: [].slice.call(document.querySelectorAll(".target")),
    resizable: true
    });
    moveable.on("resizeGroupEnd", ({ targets, isDrag }) => {
    console.log("onResizeGroupEnd", targets, isDrag);
    });
    onResizeGroupStart: OnResizeGroupStart

    When the group resize starts, the resizeGroupStart event is called.

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

    const moveable = new Moveable(document.body, {
    target: [].slice.call(document.querySelectorAll(".target")),
    resizable: true
    });
    moveable.on("resizeGroupStart", ({ targets }) => {
    console.log("onResizeGroupStart", targets);
    });
    onResizeStart: OnResizeStart

    When the resize starts, the resizeStart event is called.

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

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