Feature Fencing

This is a re-comit after the previous pull was reverted.
This commit is contained in:
griffpatch 2017-02-15 15:59:54 +00:00
parent 61d1872642
commit 7bc141e76e

View file

@ -167,15 +167,20 @@ RenderedTarget.prototype.setXY = function (x, y) {
} }
var oldX = this.x; var oldX = this.x;
var oldY = this.y; var oldY = this.y;
this.x = x;
this.y = y;
if (this.renderer) { if (this.renderer) {
var position = this.renderer.getFencedPositionOfDrawable(this.drawableID, [x, y]);
this.x = position[0];
this.y = position[1];
this.renderer.updateDrawableProperties(this.drawableID, { this.renderer.updateDrawableProperties(this.drawableID, {
position: [this.x, this.y] position: position
}); });
if (this.visible) { if (this.visible) {
this.runtime.requestRedraw(); this.runtime.requestRedraw();
} }
} else {
this.x = x;
this.y = y;
} }
this.emit(RenderedTarget.EVENT_TARGET_MOVED, this, oldX, oldY); this.emit(RenderedTarget.EVENT_TARGET_MOVED, this, oldX, oldY);
this.runtime.spriteInfoReport(this); this.runtime.spriteInfoReport(this);