Fix image dropper when image has to be moved

This commit is contained in:
juliandescottes 2017-01-13 13:22:21 +01:00
parent 03f37d46ac
commit bf91c4ef62

View File

@ -67,12 +67,10 @@
var droppedFrame = pskl.utils.FrameUtils.createFromImage(this.importedImage_);
var currentFrame = this.piskelController.getCurrentFrame();
var dropCoordinates = this.adjustDropPosition_(this.dropPosition_, droppedFrame);
currentFrame.forEachPixel(function (color, x, y) {
var fColor = droppedFrame.getPixel(x - dropCoordinates.x, y - dropCoordinates.y);
if (fColor && fColor != Constants.TRANSPARENT_COLOR) {
currentFrame.setPixel(x, y, fColor);
var origin = this.adjustDropPosition_(this.dropPosition_, droppedFrame);
droppedFrame.forEachPixel(function (color, x, y) {
if (color != pskl.utils.colorToInt(Constants.TRANSPARENT_COLOR)) {
currentFrame.setPixel(origin.x + x, origin.y + y, color);
}
});