我想用 DragBounds 拖动我的舞台,限制顶部、左侧、右侧、底部,但它不起作用
var stage = new Kinetic.Stage({
container: 'container',
width: 578,
height: 363,
draggable: true,
dragBoundFunc: function(pos) {
var newY = pos.y < 50 ? 50 : pos.y;
return {
x: pos.x,
y: newY
};
},
dragBounds: { // it's not running
top: 10,
bottom: 300,
left: 0,
right: 500
}
});