Improved typography tool
This commit is contained in:
parent
6266763f32
commit
ce9349c2fc
@ -26,7 +26,7 @@ ronin.install();
|
|||||||
// Canvas
|
// Canvas
|
||||||
var starting_canvas = new Rect();
|
var starting_canvas = new Rect();
|
||||||
starting_canvas.width = window.innerWidth - 200;
|
starting_canvas.width = window.innerWidth - 200;
|
||||||
starting_canvas.height = window.innerHeight - 200;
|
starting_canvas.height = window.innerHeight - 300;
|
||||||
|
|
||||||
// Clamp
|
// Clamp
|
||||||
|
|
||||||
|
@ -10,25 +10,23 @@ function Typographe(rune)
|
|||||||
this.install = function()
|
this.install = function()
|
||||||
{
|
{
|
||||||
this.layer = new Layer("Typographe.Preview",this);
|
this.layer = new Layer("Typographe.Preview",this);
|
||||||
this.layer.element.setAttribute("style","z-index:7000");
|
this.layer.element.setAttribute("style","z-index:7000;opacity:0.25");
|
||||||
ronin.surface.add_layer(this.layer);
|
ronin.surface.add_layer(this.layer);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.active = function(cmd)
|
this.active = function(cmd)
|
||||||
{
|
{
|
||||||
var target = ronin.surface.active_layer;
|
this.layer.clear();
|
||||||
target.clear();
|
ronin.overlay.clear();
|
||||||
if(cmd.variable("text")){
|
if(cmd.variable("text")){
|
||||||
this.add_text(target.context(),cmd);
|
this.add_text(ronin.surface.active_layer.context(),cmd);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
this.passive = function(cmd)
|
this.passive = function(cmd)
|
||||||
{
|
{
|
||||||
var target = this.layer;
|
|
||||||
target.clear();
|
|
||||||
if(cmd.variable("text")){
|
if(cmd.variable("text")){
|
||||||
this.add_text(target.context(),cmd);
|
this.add_text(this.layer.context(),cmd);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -39,7 +37,7 @@ function Typographe(rune)
|
|||||||
var text = cmd.variable("text").value;
|
var text = cmd.variable("text").value;
|
||||||
var position = cmd.position() ? cmd.position() : new Position(20,40);
|
var position = cmd.position() ? cmd.position() : new Position(20,40);
|
||||||
var color = cmd.color() ? cmd.color() : new Color("#000000");
|
var color = cmd.color() ? cmd.color() : new Color("#000000");
|
||||||
var size = cmd.value() ? cmd.value().int : 20;
|
var size = cmd.value() ? cmd.value().int : 40;
|
||||||
var font = cmd.variable("font") ? cmd.variable("font").value : "Georgia";
|
var font = cmd.variable("font") ? cmd.variable("font").value : "Georgia";
|
||||||
|
|
||||||
ctx.font = size+"px "+font;
|
ctx.font = size+"px "+font;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user