From 1f70431dcbfe8a24f8db1420393d1caf73a19a3d Mon Sep 17 00:00:00 2001 From: Devine Lu Linvega Date: Thu, 30 Mar 2017 12:20:51 -0700 Subject: [PATCH] Fixed magnet --- README.md | 4 ---- presets/default.rin | 0 scripts/modules/layer.js | 3 +++ scripts/modules/magnet.js | 29 +++++++++-------------------- scripts/modules/source.js | 2 +- 5 files changed, 13 insertions(+), 25 deletions(-) create mode 100644 presets/default.rin diff --git a/README.md b/README.md index 1e4bc9b..349c7b5 100644 --- a/README.md +++ b/README.md @@ -10,8 +10,6 @@ Enjoy Splash screen Hide widget on mouseover Add locks - Store values in modules, experiment with vector - Give name to settings Merge layers Export multiple layers file % Render @@ -37,8 +35,6 @@ Enjoy Load default.rin on startup * Eye Swatches, handle all colors - + Path - Rename vector to Path this.collection = {}; diff --git a/presets/default.rin b/presets/default.rin new file mode 100644 index 0000000..e69de29 diff --git a/scripts/modules/layer.js b/scripts/modules/layer.js index 198e623..fae0550 100644 --- a/scripts/modules/layer.js +++ b/scripts/modules/layer.js @@ -3,6 +3,9 @@ function Layer(name,manager = null) Module.call(this,"#"); 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.name = name; diff --git a/scripts/modules/magnet.js b/scripts/modules/magnet.js index 50feb5c..f0dc7f1 100644 --- a/scripts/modules/magnet.js +++ b/scripts/modules/magnet.js @@ -4,32 +4,21 @@ function Magnet(rune) 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"])); + + this.grid = function(params,preview = false) { + if(!params.rect()){ return; } + if(!this.layer){ this.create_layer(); } this.layer.clear(); - this.draw_grid(cmd.setting("grid"),cmd.setting("marker")); - } + this.draw_grid(params.rect(),params.position()); - this.active = function(cmd) - { - if(cmd.bang()){ - if(this.layer){ this.layer.remove(this); } - return; + if(preview == false){ + this.settings["grid"] = params.rect(); + this.settings["market"] = params.position(); } - - if(!this.layer){ this.create_layer(); } - - this.layer.clear(); - this.draw_grid(this.settings["grid"],this.settings["marker"]); - } - - this.context = function() - { - if(!this.layer){ this.create_layer(); } - - return this.layer.context(); } this.draw_grid = function(rect,grid) diff --git a/scripts/modules/source.js b/scripts/modules/source.js index 0969d3b..31690fa 100644 --- a/scripts/modules/source.js +++ b/scripts/modules/source.js @@ -4,7 +4,7 @@ function Source(rune) 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.load = function(params,preview = false) // source.load ../assets/todo.jpg 200x200 40,40