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);
});
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);
});
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);
});
When drag the clip area or controls, the
clipevent is called.