Create a rectangle with mousedown event in KineticJS
问题 I am trying to create a rectangle shape using KineticJS with mousedown and drag events but not having much luck with it. Has anyone done anything similar? 回答1: http://jsfiddle.net/AYHSM/6/ var stage = new Kinetic.Stage({ container: 'container', width: 600, height: 400 }); var layer = new Kinetic.Layer(); layer.add(new Kinetic.Rect({ x:0, y:0, width:600, height:400 })); // this rect will allow us to use mouse events on the layer. There's probably a better way to do this, but I don't know it.