Fixed drag
This commit is contained in:
parent
4c104ab1fb
commit
9e2960df72
@ -7,7 +7,7 @@ function Cursor()
|
||||
{
|
||||
if(event.ctrltKey === true && event.altKey === true && event.shiftKey === true){ /* */ }
|
||||
else if(event.shiftKey === true && event.ctrlKey === true){ this.set_mode(ronin.eye); }
|
||||
else if(event.shiftKey === true && event.altKey === true){ this.set_mode(ronin.canvas); }
|
||||
else if(event.shiftKey === true && event.altKey === true){ this.set_mode(ronin.surface.active_layer); }
|
||||
else if(event.ctrltKey === true && event.altKey === true){ this.set_mode(ronin.eye); }
|
||||
else if(event.ctrlKey === true){ this.set_mode(ronin.overlay); }
|
||||
else if(event.altKey === true){ this.set_mode(ronin.surface); }
|
||||
|
@ -1,36 +0,0 @@
|
||||
function Canvas(rune)
|
||||
{
|
||||
Module.call(this,rune);
|
||||
|
||||
this.parameters = [Rect,Position,Color,Bang];
|
||||
|
||||
// Cursor
|
||||
|
||||
this.move_from = null;
|
||||
|
||||
this.mouse_down = function(position)
|
||||
{
|
||||
this.move_from = ronin.position_in_window(position);
|
||||
}
|
||||
|
||||
this.mouse_move = function(position)
|
||||
{
|
||||
if(this.move_from === null){ return; }
|
||||
|
||||
position = ronin.position_in_window(position);
|
||||
|
||||
var offset_x = this.move_from.x - position.x;
|
||||
var offset_y = this.move_from.y - position.y;
|
||||
|
||||
this.context().globalCompositeOperation = "copy";
|
||||
this.context().drawImage(this.context().canvas, -offset_x, -offset_y);
|
||||
this.context().globalCompositeOperation = "source-over"
|
||||
|
||||
this.move_from = new Position(position.x,position.y);
|
||||
}
|
||||
|
||||
this.mouse_up = function(event)
|
||||
{
|
||||
this.move_from = null;
|
||||
}
|
||||
}
|
@ -79,7 +79,7 @@ function Surface(rune)
|
||||
|
||||
this.widget_cursor = function()
|
||||
{
|
||||
return "Move";
|
||||
return "Drag";
|
||||
}
|
||||
|
||||
// Layers
|
||||
|
@ -35,4 +35,39 @@ function Layer(name)
|
||||
{
|
||||
return this.element.getContext('2d');
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
this.widget_cursor = function()
|
||||
{
|
||||
return "Move";
|
||||
}
|
||||
|
||||
this.move_from = null;
|
||||
|
||||
this.mouse_down = function(position)
|
||||
{
|
||||
this.move_from = ronin.position_in_window(position);
|
||||
}
|
||||
|
||||
this.mouse_move = function(position)
|
||||
{
|
||||
if(this.move_from === null){ return; }
|
||||
|
||||
position = ronin.position_in_window(position);
|
||||
|
||||
var offset_x = this.move_from.x - position.x;
|
||||
var offset_y = this.move_from.y - position.y;
|
||||
|
||||
this.context().globalCompositeOperation = "copy";
|
||||
this.context().drawImage(this.context().canvas, -offset_x, -offset_y);
|
||||
this.context().globalCompositeOperation = "source-over"
|
||||
|
||||
this.move_from = new Position(position.x,position.y);
|
||||
}
|
||||
|
||||
this.mouse_up = function(event)
|
||||
{
|
||||
this.move_from = null;
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user