我有以下代码,但是位置不会随鼠标悬停而变化 - 我错过了什么?
function drawOverlay() {
var stage = new Kinetic.Stage({container: 'overlay'});
var layer = new Kinetic.Layer();
var rect = new Kinetic.Rect({
x: 239, y: 75,
width: 100, height: 50,
fill: 'green', stroke: 'black', strokeWidth: 4
});
rect.on('mouseover', function(e) {rect.setPosition({x: 50, y: 5 0});});
layer.add(rect);
stage.add(layer);
}