Fixed drag mode.

This commit is contained in:
Devine Lu Linvega 2016-12-19 15:05:49 -07:00
parent cdbd9e9c0b
commit 2494946d95
3 changed files with 9 additions and 4 deletions

View File

@ -36,4 +36,9 @@ function Ronin()
{
return new Position(e.clientX - parseFloat(ronin.surface.style.left) - parseFloat(ronin.canvas.element.style.left),e.clientY- parseFloat(ronin.surface.style.top) - parseFloat(ronin.canvas.element.style.top));
}
this.position_in_window = function(p)
{
return new Position(p.x + parseFloat(ronin.surface.style.left) + parseFloat(ronin.canvas.element.style.left),p.y + parseFloat(ronin.surface.style.top) + parseFloat(ronin.canvas.element.style.top));
}
}

View File

@ -8,15 +8,15 @@ function Mode_Drag()
this.mouse_down = function(position)
{
this.drag_from = position;
this.drag_from = ronin.position_in_window(position);
}
this.mouse_move = function(position)
{
console.log(position);
return;
if(this.drag_from === null){ return; }
position = ronin.position_in_window(position);
var offset_x = this.drag_from.x - position.x;
var offset_y = this.drag_from.y - position.y;

View File

@ -18,7 +18,7 @@ function Mode_Guide()
this.mouse_move = function(position)
{
if(this.live_draw_from == null){ return; }
if(this.live_draw_from === null){ return; }
ronin.overlay.clear();