How to limit the drag range using react-moveable
Environments
- Framework name:
- Framework version:
- Moveable Component version:
- Testable Address(optional):
Description
container:Invalid attribute

@liuxuehuax
Use bounds props.
{ left : 0, right: width, top: 0, bottom: height }
@daybrush Doesn't seem to be of much use Would you like to try it? https://codesandbox.io/s/fervent-microservice-vj86d

@daybrush sorry,my question! Thank you~
this.moveable.bounds = {
left: offset.left,
right: offset.left + (bg.width() || 0),
top: offset.top,
bottom: offset.top + (bg.height() || 0)
}
it not work
new Moveable(this.$refs.workspace, {bounds:{
left: offset.left,
right: offset.left + (bg.width() || 0),
top: offset.top,
bottom: offset.top + (bg.height() || 0)
}})
it works
how to reset the bounds?
@leeboo
use bounds with snappable.
new Moveable(..., {
snappable: true,
bounds: { .... },
});
@daybrush sorry,my question! Thank you~
怎么解决的?