Improved vector tools

This commit is contained in:
Devine Lu Linvega 2017-01-19 10:50:52 -07:00
parent 2c97b040ac
commit 9f8d932043
2 changed files with 36 additions and 2 deletions

View File

@ -52,7 +52,7 @@ function Typographe(rune)
this.widget_cursor = function() this.widget_cursor = function()
{ {
return "&"; return "Typographe";
} }
this.mouse_down = function(position) this.mouse_down = function(position)

View File

@ -10,7 +10,7 @@ function Vector(rune)
this.install = function() this.install = function()
{ {
this.layer = new Layer("Vector.Preview",this); this.layer = new Layer("Vector.Preview",this);
this.layer.element.setAttribute("style","z-index:8000"); this.layer.element.setAttribute("style","z-index:8000;opacity:0.75");
ronin.surface.add_layer(this.layer); ronin.surface.add_layer(this.layer);
} }
@ -33,4 +33,38 @@ function Vector(rune)
ronin.surface.active_layer.context().strokeStyle = cmd.variable("stroke_color") ? cmd.variable("stroke_color").value : "#ffffff"; ronin.surface.active_layer.context().strokeStyle = cmd.variable("stroke_color") ? cmd.variable("stroke_color").value : "#ffffff";
ronin.surface.active_layer.context().stroke(new Path2D(cmd.content.join(" "))); ronin.surface.active_layer.context().stroke(new Path2D(cmd.content.join(" ")));
} }
// Mouse
this.click = null;
this.widget_cursor = function()
{
return "Vector";
}
this.memory = null;
this.mouse_down = function(position)
{
this.click = true;
this.memory = commander.element_input.value;
commander.element_input.value += "L"+position.render()+" ";
commander.hint.update();
this.passive(commander.cmd());
}
this.mouse_move = function(position)
{
if(!this.click){ return; }
commander.element_input.value = this.memory+"L"+position.render()+" ";
commander.hint.update();
this.passive(commander.cmd());
}
this.mouse_up = function(position)
{
this.click = null;
}
} }