Fixed issue with moving layer content

This commit is contained in:
Devine Lu Linvega 2016-12-26 15:53:20 -07:00
parent 23ed4b5b41
commit decf475dbf
2 changed files with 4 additions and 17 deletions

View File

@ -35,17 +35,6 @@ function Layer(name,host = "user")
return this.element.toDataURL('image/png'); return this.element.toDataURL('image/png');
} }
this.merge = function()
{
console.log(ronin.surface.render_layer);
var ctx = ronin.surface.render_layer.context();
var img = new Image();
img.onload = function(){
ctx.drawImage(img,10,10);
};
img.src = this.element.toDataURL();
}
// //
this.widget_cursor = function() this.widget_cursor = function()
@ -74,11 +63,9 @@ function Layer(name,host = "user")
var offset_x = this.move_from.x - position.x; var offset_x = this.move_from.x - position.x;
var offset_y = this.move_from.y - position.y; var offset_y = this.move_from.y - position.y;
var content = this.context().canvas; var imageData = this.context().getImageData(0, 0, ronin.surface.size.width * 2, ronin.surface.size.height * 2);
this.clear();
this.context().globalCompositeOperation = "copy"; this.context().putImageData(imageData, -offset_x * 2, -offset_y * 2);
this.context().globalCompositeOperation = "source-over";
this.context().drawImage(content,-offset_x,-offset_y,ronin.surface.size.width,ronin.surface.size.height);
this.move_from = new Position(position.x,position.y); this.move_from = new Position(position.x,position.y);
} }

View File

@ -2,7 +2,7 @@ function Typographe(rune)
{ {
Module.call(this,rune); Module.call(this,rune);
this.parameters = [Position,Color]; this.parameters = [Position,Color,Value];
this.variables = {"text" : null}; this.variables = {"text" : null};
this.active = function(cmd) this.active = function(cmd)