Moveable
    Preparing search index...

    Interface ClippableProps

    interface ClippableProps {
        clipArea?: boolean;
        clipHorizontalGuidelines?: (string | number)[];
        clippable?: boolean | ClippableOptions;
        clipRelative?: boolean;
        clipSnapThreshold?: number;
        clipTargetBounds?: boolean;
        clipVerticalGuidelines?: (string | number)[];
        customClipPath?: string;
        defaultClipPath?: string;
        dragWithClip?: boolean;
        keepRatio?: boolean;
        onClip?: (e: OnClip) => any;
        onClipEnd?: (e: OnClipEnd) => any;
        onClipStart?: (e: OnClipStart) => any;
    }

    Hierarchy (View Summary)

    Index
    clipArea?: boolean

    You can drag the clip by setting clipArea.

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

    const moveable = new Moveable(document.body, {
    clippable: true,
    defaultClipPath: "inset",
    customClipPath: "",
    clipRelative: false,
    clipArea: false,
    dragWithClip: true,
    });
    moveable.on("clipStart", e => {
    console.log(e);
    }).on("clip", e => {
    if (e.clipType === "rect") {
    e.target.style.clip = e.clipStyle;
    } else {
    e.target.style.clipPath = e.clipStyle;
    }
    }).on("clipEnd", e => {
    console.log(e);
    });
    clipHorizontalGuidelines?: (string | number)[]

    Add clip guidelines in the horizontal direction.

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

    const moveable = new Moveable(document.body, {
    clippable: true,
    defaultClipPath: "inset",
    customClipPath: "",
    clipRelative: false,
    clipArea: false,
    dragWithClip: true,
    clipVerticalGuidelines: [0, 100, 200],
    clipHorizontalGuidelines: [0, 100, 200],
    clipSnapThreshold: 5,
    });
    clippable?: boolean | ClippableOptions

    Whether to clip the target.

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

    const moveable = new Moveable(document.body, {
    clippable: true,
    defaultClipPath: "inset",
    customClipPath: "",
    clipRelative: false,
    clipArea: false,
    dragWithClip: true,
    });
    moveable.on("clipStart", e => {
    console.log(e);
    }).on("clip", e => {
    if (e.clipType === "rect") {
    e.target.style.clip = e.clipStyle;
    } else {
    e.target.style.clipPath = e.clipStyle;
    }
    }).on("clipEnd", e => {
    console.log(e);
    });
    clipRelative?: boolean

    % Can be used instead of the absolute px (rect not possible)

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

    const moveable = new Moveable(document.body, {
    clippable: true,
    defaultClipPath: "inset",
    customClipPath: "",
    clipRelative: false,
    clipArea: false,
    dragWithClip: true,
    });
    moveable.on("clipStart", e => {
    console.log(e);
    }).on("clip", e => {
    if (e.clipType === "rect") {
    e.target.style.clip = e.clipStyle;
    } else {
    e.target.style.clipPath = e.clipStyle;
    }
    }).on("clipEnd", e => {
    console.log(e);
    });
    clipSnapThreshold?: number

    Distance value that can snap to clip guidelines.

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

    const moveable = new Moveable(document.body, {
    clippable: true,
    defaultClipPath: "inset",
    customClipPath: "",
    clipRelative: false,
    clipArea: false,
    dragWithClip: true,
    clipVerticalGuidelines: [0, 100, 200],
    clipHorizontalGuidelines: [0, 100, 200],
    clipSnapThreshold: 5,
    });
    clipTargetBounds?: boolean

    Whether the clip is bound to the target.

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

    const moveable = new Moveable(document.body, {
    clippable: true,
    defaultClipPath: "inset",
    customClipPath: "",
    clipRelative: false,
    clipArea: false,
    dragWithClip: true,
    clipTargetBounds: true,
    });
    moveable.on("clipStart", e => {
    console.log(e);
    }).on("clip", e => {
    if (e.clipType === "rect") {
    e.target.style.clip = e.clipStyle;
    } else {
    e.target.style.clipPath = e.clipStyle;
    }
    }).on("clipEnd", e => {
    console.log(e);
    });
    clipVerticalGuidelines?: (string | number)[]

    Add clip guidelines in the vertical direction.

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

    const moveable = new Moveable(document.body, {
    clippable: true,
    defaultClipPath: "inset",
    customClipPath: "",
    clipRelative: false,
    clipArea: false,
    dragWithClip: true,
    clipVerticalGuidelines: [0, 100, 200],
    clipHorizontalGuidelines: [0, 100, 200],
    clipSnapThreshold: 5,
    });
    customClipPath?: string

    You can force the custom clipPath. (defaultClipPath < style < customClipPath < dragging clipPath)

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

    const moveable = new Moveable(document.body, {
    clippable: true,
    defaultClipPath: "inset",
    customClipPath: "",
    clipRelative: false,
    clipArea: false,
    dragWithClip: true,
    });
    moveable.on("clipStart", e => {
    console.log(e);
    }).on("clip", e => {
    if (e.clipType === "rect") {
    e.target.style.clip = e.clipStyle;
    } else {
    e.target.style.clipPath = e.clipStyle;
    }
    }).on("clipEnd", e => {
    console.log(e);
    });
    defaultClipPath?: string

    If clippath is not set, the default value can be set. (defaultClipPath < style < customClipPath < dragging clipPath)

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

    const moveable = new Moveable(document.body, {
    clippable: true,
    defaultClipPath: "inset",
    customClipPath: "",
    clipRelative: false,
    clipArea: false,
    dragWithClip: true,
    });
    moveable.on("clipStart", e => {
    console.log(e);
    }).on("clip", e => {
    if (e.clipType === "rect") {
    e.target.style.clip = e.clipStyle;
    } else {
    e.target.style.clipPath = e.clipStyle;
    }
    }).on("clipEnd", e => {
    console.log(e);
    });
    dragWithClip?: boolean

    When dragging the target, the clip also moves.

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

    const moveable = new Moveable(document.body, {
    clippable: true,
    defaultClipPath: "inset",
    customClipPath: "",
    clipRelative: false,
    clipArea: false,
    dragWithClip: true,
    });
    moveable.on("clipStart", e => {
    console.log(e);
    }).on("clip", e => {
    if (e.clipType === "rect") {
    e.target.style.clip = e.clipStyle;
    } else {
    e.target.style.clipPath = e.clipStyle;
    }
    }).on("clipEnd", e => {
    console.log(e);
    });
    keepRatio?: boolean

    Whether to keep the ratio of size if your clipPath is 'inset', 'rect', 'ellipse' type

    false
    
    onClip?: (e: OnClip) => any

    When drag the clip area or controls, the clip event is called.

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

    const moveable = new Moveable(document.body, {
    clippable: true,
    defaultClipPath: "inset",
    customClipPath: "",
    clipRelative: false,
    clipArea: false,
    dragWithClip: true,
    });
    moveable.on("clipStart", e => {
    console.log(e);
    }).on("clip", e => {
    if (e.clipType === "rect") {
    e.target.style.clip = e.clipStyle;
    } else {
    e.target.style.clipPath = e.clipStyle;
    }
    }).on("clipEnd", e => {
    console.log(e);
    });
    onClipEnd?: (e: OnClipEnd) => any

    When drag end the clip area or controls, the clipEnd event is called.

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

    const moveable = new Moveable(document.body, {
    clippable: true,
    defaultClipPath: "inset",
    customClipPath: "",
    clipRelative: false,
    clipArea: false,
    dragWithClip: true,
    });
    moveable.on("clipStart", e => {
    console.log(e);
    }).on("clip", e => {
    if (e.clipType === "rect") {
    e.target.style.clip = e.clipStyle;
    } else {
    e.target.style.clipPath = e.clipStyle;
    }
    }).on("clipEnd", e => {
    console.log(e);
    });
    onClipStart?: (e: OnClipStart) => any

    When drag start the clip area or controls, the clipStart event is called.

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

    const moveable = new Moveable(document.body, {
    clippable: true,
    defaultClipPath: "inset",
    customClipPath: "",
    clipRelative: false,
    clipArea: false,
    dragWithClip: true,
    });
    moveable.on("clipStart", e => {
    console.log(e);
    }).on("clip", e => {
    if (e.clipType === "rect") {
    e.target.style.clip = e.clipStyle;
    } else {
    e.target.style.clipPath = e.clipStyle;
    }
    }).on("clipEnd", e => {
    console.log(e);
    });