OptionaldisplayOptionaledgeWhether to scale and resize through edge lines. You can use "n", "w", "s", "e" in LineDirection array.
OptionalkeepWhen resize or scale, keeps a ratio of the width, height.
OptionalonWhen 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;
});
OptionalonWhen scaling the group, beforeScaleGroup is called before scaleGroup occurs. In beforeScaleGroup, you can get and set the pre-value before scaling.
OptionalonWhen scaling, the scale event is called.
OptionalonWhen the scale finishes, the scaleEnd event is called.
OptionalonWhen 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];
});
});
OptionalonWhen the group scale finishes, the scaleGroupEnd event is called.
OptionalonWhen the group scale starts, the scaleGroupStart event is called.
OptionalonWhen the scale starts, the scaleStart event is called.
OptionalrenderSet directions to show the control box.
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"];
OptionalscalableWhether or not target can be scaled.
Optionalthrottlethrottle of scaleX, scaleY when scale.
You can expand the area around the control. Either
rotateAroundControlsordisplayAroundControlscan be used. You can set the area through thecontrolPaddingvalue.