Fixed magnet

This commit is contained in:
Devine Lu Linvega 2017-03-30 12:20:51 -07:00
parent 0ac1986b42
commit 1f70431dcb
5 changed files with 13 additions and 25 deletions

View File

@ -10,8 +10,6 @@ Enjoy
Splash screen Splash screen
Hide widget on mouseover Hide widget on mouseover
Add locks Add locks
Store values in modules, experiment with vector
Give name to settings
Merge layers Merge layers
Export multiple layers file Export multiple layers file
% Render % Render
@ -37,8 +35,6 @@ Enjoy
Load default.rin on startup Load default.rin on startup
* Eye * Eye
Swatches, handle all colors Swatches, handle all colors
+ Path
Rename vector to Path
this.collection = {}; this.collection = {};

0
presets/default.rin Normal file
View File

View File

@ -3,6 +3,9 @@ function Layer(name,manager = null)
Module.call(this,"#"); Module.call(this,"#");
this.add_method(new Method("fill",["color","position","rect"],"Add position")); this.add_method(new Method("fill",["color","position","rect"],"Add position"));
this.add_method(new Method("rotate",["position","angle"]));
this.add_method(new Method("resize",["position","rect"]));
this.add_method(new Method("mirror",["position"]));
this.add_method(new Method("rename",["text"])); this.add_method(new Method("rename",["text"]));
this.name = name; this.name = name;

View File

@ -4,32 +4,21 @@ function Magnet(rune)
this.settings = {"grid" : new Rect("1x1"), "marker": new Position("4,4"), "reset" : new Bang()}; this.settings = {"grid" : new Rect("1x1"), "marker": new Position("4,4"), "reset" : new Bang()};
this.passive = function(cmd) this.add_method(new Method("grid",["rect","position"]));
{
if(!this.layer){ this.create_layer(); }
this.layer.clear(); this.grid = function(params,preview = false)
this.draw_grid(cmd.setting("grid"),cmd.setting("marker"));
}
this.active = function(cmd)
{ {
if(cmd.bang()){ if(!params.rect()){ return; }
if(this.layer){ this.layer.remove(this); }
return;
}
if(!this.layer){ this.create_layer(); } if(!this.layer){ this.create_layer(); }
this.layer.clear(); this.layer.clear();
this.draw_grid(this.settings["grid"],this.settings["marker"]); this.draw_grid(params.rect(),params.position());
if(preview == false){
this.settings["grid"] = params.rect();
this.settings["market"] = params.position();
} }
this.context = function()
{
if(!this.layer){ this.create_layer(); }
return this.layer.context();
} }
this.draw_grid = function(rect,grid) this.draw_grid = function(rect,grid)

View File

@ -4,7 +4,7 @@ function Source(rune)
this.parameters = [Filepath,Position,Rect]; this.parameters = [Filepath,Position,Rect];
this.add_method(new Method("save",["name"],"Add point")); this.add_method(new Method("save",["name","rect","format"]));
this.add_method(new Method("load",["path","position","rect"]),"Add point"); this.add_method(new Method("load",["path","position","rect"]),"Add point");
this.load = function(params,preview = false) // source.load ../assets/todo.jpg 200x200 40,40 this.load = function(params,preview = false) // source.load ../assets/todo.jpg 200x200 40,40