Improved Typographer
This commit is contained in:
parent
cd54661b3a
commit
74dcfd1487
sources
media/graphics
scripts
Binary file not shown.
Before ![]() (image error) Size: 105 B |
@ -23,7 +23,8 @@ function Commander(element,element_input)
|
||||
|
||||
function run()
|
||||
{
|
||||
console.log("~ "+queue[0].trim());
|
||||
if(!queue[0]){ return; }
|
||||
|
||||
active(queue[0].trim());
|
||||
|
||||
queue.shift();
|
||||
|
@ -9,7 +9,7 @@ function Module(rune)
|
||||
|
||||
this.install = function()
|
||||
{
|
||||
console.log(this.rune);
|
||||
console.log("Installing "+ronin.modules[this.rune].constructor.name);
|
||||
}
|
||||
|
||||
this.active = function(cmd)
|
||||
|
@ -55,7 +55,7 @@ function Surface(rune)
|
||||
|
||||
this.add_layer = function(layer)
|
||||
{
|
||||
console.log("Creating layer:"+layer.name);
|
||||
console.log("Creating layer:"+layer.name+"("+(layer.manager ? layer.manager.constructor.name : "")+")");
|
||||
|
||||
this.layers[layer.name] = layer;
|
||||
this.active_layer = layer;
|
||||
|
@ -53,7 +53,10 @@ function Layer(name,manager = null)
|
||||
if(ronin.surface.active_layer.name == this.name){ e_class += "highlight "; }
|
||||
if(this.manager != null){ e_class += "managed "; }
|
||||
|
||||
return "<span class='"+e_class+"'>- "+e_name+"</span><br />";
|
||||
var e_icon = this.manager ? "~" : "-";
|
||||
|
||||
|
||||
return "<span class='"+e_class+"'>"+e_icon+" "+e_name+"</span><br />";
|
||||
}
|
||||
|
||||
this.move_from = null;
|
||||
|
@ -3,7 +3,16 @@ function Typographe(rune)
|
||||
Module.call(this,rune);
|
||||
|
||||
this.parameters = [Position,Color,Value];
|
||||
this.variables = {"text" : null};
|
||||
this.variables = {"text" : null, "font" : "Georgia"};
|
||||
|
||||
this.layer = null;
|
||||
|
||||
this.install = function()
|
||||
{
|
||||
this.layer = new Layer("TextPreview",this);
|
||||
this.layer.element.setAttribute("style","z-index:7000");
|
||||
ronin.surface.add_layer(this.layer);
|
||||
}
|
||||
|
||||
this.active = function(cmd)
|
||||
{
|
||||
@ -16,7 +25,7 @@ function Typographe(rune)
|
||||
|
||||
this.passive = function(cmd)
|
||||
{
|
||||
var target = ronin.overlay;
|
||||
var target = this.layer;
|
||||
target.clear();
|
||||
if(cmd.variable("text")){
|
||||
this.add_text(target.context(),cmd);
|
||||
@ -31,8 +40,9 @@ function Typographe(rune)
|
||||
var position = cmd.position() ? cmd.position() : new Position(20,40);
|
||||
var color = cmd.color() ? cmd.color() : new Color("#000000");
|
||||
var size = cmd.value() ? cmd.value().int : 20;
|
||||
var font = cmd.variable("font") ? cmd.variable("font").value : "Georgia";
|
||||
|
||||
ctx.font = size+"px Georgia";
|
||||
ctx.font = size+"px "+font;
|
||||
ctx.fillStyle = color.hex;
|
||||
ctx.fillText(text,position.x,position.y);
|
||||
}
|
||||
|
@ -9,7 +9,7 @@ function Vector(rune)
|
||||
|
||||
this.install = function()
|
||||
{
|
||||
this.layer = new Layer("Preview",this);
|
||||
this.layer = new Layer("PathPreview",this);
|
||||
this.layer.element.setAttribute("style","z-index:8000");
|
||||
ronin.surface.add_layer(this.layer);
|
||||
}
|
||||
@ -18,7 +18,6 @@ function Vector(rune)
|
||||
|
||||
this.passive = function(cmd)
|
||||
{
|
||||
console.log(cmd.variable("stroke_width"));
|
||||
this.layer.clear();
|
||||
this.layer.context().lineCap = cmd.variable("line_cap") ? cmd.variable("line_cap").value : "round";
|
||||
this.layer.context().lineWidth = cmd.variable("stroke_width") ? cmd.variable("stroke_width").value : ronin.brush.size;
|
||||
|
Loading…
x
Reference in New Issue
Block a user