Hi, I implemented some functionality to handle dragging the sprite on the surface, which works...but has a bug, as shown on the attached screenshot.
Once the sprite is locked in drag_mode and I update its position using [x,y] coordinates from Ext.EventObject it goes into some sort of constant fluctuations around X-Axis.
Here is the code which implements dragging:
Code:
move : function (eventXY) {
if (SpriteMovingModule.isMoving()) {
var bBox = spriteNowInMove.getBBox(),
dx = eventXY[0],
dy = eventXY[1];
console.log('Sprite \nBBox=', bBox,
'\nEventXY=', eventXY,
'\nOffset=', [dx - bBox.x, dy - bBox.y]);
spriteNowInMove.setAttributes({
translate: {
x: (dx - bBox.x),
y: (dy - bBox.y)
}
}, true);
}
}
What's the issue here ?
Untitled.jpg