Added cursor modes.
This commit is contained in:
@@ -4,18 +4,28 @@ function Mode_Drag()
|
||||
|
||||
this.name = "Drag";
|
||||
|
||||
this.drag_from = null;
|
||||
|
||||
this.mouse_down = function(event)
|
||||
{
|
||||
ronin.drag_start(event); ronin.drag(event);
|
||||
this.drag_from = new Position(event.clientX,event.clientY);
|
||||
}
|
||||
|
||||
this.mouse_move = function(event)
|
||||
{
|
||||
ronin.drag(event);
|
||||
if(this.drag_from == null){ return; }
|
||||
|
||||
var offset_x = this.drag_from.x - event.clientX;
|
||||
var offset_y = this.drag_from.y - event.clientY;
|
||||
|
||||
ronin.surface.style.left = ronin.surface.style.left ? parseInt(ronin.surface.style.left) - offset_x : offset_x;
|
||||
ronin.surface.style.top = ronin.surface.style.top ? parseInt(ronin.surface.style.top) - offset_y : offset_y;
|
||||
|
||||
this.drag_from = new Position(event.clientX,event.clientY);
|
||||
}
|
||||
|
||||
this.mouse_up = function(event)
|
||||
{
|
||||
ronin.drag_stop(event);
|
||||
this.drag_from = null;
|
||||
}
|
||||
}
|
||||
@@ -4,18 +4,34 @@ function Mode_Guide()
|
||||
|
||||
this.name = "Guide";
|
||||
|
||||
this.live_draw_from = null;
|
||||
|
||||
this.mouse_down = function(event)
|
||||
{
|
||||
ronin.overlay.live_draw_start(event);
|
||||
ronin.overlay.clear();
|
||||
ronin.overlay.draw_pointer(ronin.position_in_canvas(event));
|
||||
this.live_draw_from = ronin.position_in_canvas(event);
|
||||
commander.show();
|
||||
commander.element_input.focus();
|
||||
commander.element_input.value = "| "+this.live_draw_from.render();
|
||||
}
|
||||
|
||||
this.mouse_move = function(event)
|
||||
{
|
||||
ronin.overlay.live_draw(event);
|
||||
if(this.live_draw_from == null){ return; }
|
||||
|
||||
ronin.overlay.clear();
|
||||
|
||||
var rect = new Rect();
|
||||
rect.width = ronin.position_in_canvas(event).x - this.live_draw_from.x;
|
||||
rect.height = ronin.position_in_canvas(event).y - this.live_draw_from.y;
|
||||
|
||||
ronin.overlay.draw_rect(this.live_draw_from,rect);
|
||||
commander.element_input.value = "| "+this.live_draw_from.render()+" "+rect.render();
|
||||
}
|
||||
|
||||
this.mouse_up = function(event)
|
||||
{
|
||||
|
||||
commander.element_input.focus();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user