Implemented resize

This commit is contained in:
Devine Lu Linvega 2017-09-26 15:36:15 +13:00
parent 5ca4979c38
commit 34250c401c
10 changed files with 37 additions and 34 deletions

View File

@ -1,6 +0,0 @@
<svg width="40px" height="40px" xmlns="http://www.w3.org/2000/svg" baseProfile="full" version="1.1">
<!-- <line x1="15" y1="13" x2="15" y2="17" stroke="#ccc"></line> -->
<line x1="0" y1="20" x2="40" y2="20" stroke="#ccc" stroke-dasharray="1,3" stroke-width="1"></line>
<line x1="20" y1="0" x2="20" y2="40" stroke="#ccc" stroke-dasharray="1,3" stroke-width="1"></line>
<circle cx="20" cy="20" r="1.5" fill="#ccc"></circle>
</svg>

Before

Width:  |  Height:  |  Size: 436 B

View File

@ -1,3 +0,0 @@
<svg width="5" height="5" xmlns="http://www.w3.org/2000/svg" baseProfile="full" version="1.1">
<circle cx="2.5" cy="2.5" r="0.5" fill="#fff"></circle>
</svg>

Before

Width:  |  Height:  |  Size: 161 B

View File

@ -16,7 +16,7 @@ function Commander()
{
var q = new Query(query_str);
if(!ronin.modules[q.module]){ console.log("Unknown module",q); return; }
if(!ronin.modules[q.module]){ console.log("Unknown module",q.module); return; }
// Update settings
for(setting_id in q.settings){
@ -28,8 +28,8 @@ function Commander()
// Run methods
for(method_id in q.methods){
var method_param = q.methods[method_id];
if(!ronin.modules[q.module][method_id]){ console.log("Missing method",method_id); return; }
ronin.modules[q.module][method_id].run(method_param);
if(!ronin.modules[q.module].methods[method_id]){ console.log("Missing method",method_id); return; }
ronin.modules[q.module].methods[method_id](method_param);
}
ronin.modules[q.module].routes = q.routes;

View File

@ -52,6 +52,8 @@ function Grid()
this.el.height = size.height * 2;
this.el.style.width = size.width+"px";
this.el.style.height = size.height+"px";
this.draw();
}
this.clear = function()

View File

@ -26,7 +26,7 @@ function IO()
var width = base_image.naturalWidth;
var height = base_image.naturalHeight;
ronin.resize_to({width:width * 0.5,height:height * 0.5});
ronin.frame.resize_to({width:width * 0.5,height:height * 0.5});
ronin.render.context().drawImage(base_image, 0,0,width,height);
}
reader.readAsDataURL(file);

View File

@ -1,6 +1,7 @@
function Module(name)
{
this.name = name;
this.methods = {};
this.settings = {};
this.routes = {};
this.ports = {};
@ -19,8 +20,6 @@ function Module(name)
html += route_val+"->"+route_id+" ";
}
console.log(this.name,this.settings);
return html.trim() != "" ? "<b>"+this.name+"</b> "+html.trim() : "";
}
}

View File

@ -6,10 +6,10 @@ function Brush()
this.pointers = [
new Pointer({offset:{x:0,y:0}}),
new Pointer({offset:{x:1,y:0}}),
new Pointer({offset:{x:-1,y:0}}),
new Pointer({offset:{x:0,y:1}}),
new Pointer({offset:{x:0,y:-1}}),
// new Pointer({offset:{x:1,y:0}}),
// new Pointer({offset:{x:-1,y:0}}),
// new Pointer({offset:{x:0,y:1}}),
// new Pointer({offset:{x:0,y:-1}}),
];
this.ports.speed = 0;

View File

@ -3,4 +3,30 @@ function Frame()
Module.call(this,"frame");
this.settings = {width:200,height:200};
this.methods = {};
this.methods.resize = function(q)
{
if(q.indexOf("x") == -1){ return; }
var size = {width:parseInt(q.split("x")[0]),height:parseInt(q.split("x")[1])};
ronin.frame.resize(size);
}
this.methods.rescale = function(p)
{
}
this.resize_to = function(size)
{
ronin.frame.settings.width = size.width;
ronin.frame.settings.height = size.height;
const {dialog,app} = require('electron').remote;
var win = require('electron').remote.getCurrentWindow();
win.setSize(size.width,size.height);
ronin.render.resize_to(size);
ronin.grid.resize_to(size);
}
}

View File

@ -1,7 +0,0 @@
function Rescale()
{
this.run = function(q)
{
console.log(q);
}
}

View File

@ -47,12 +47,4 @@ function Ronin()
this.render.update();
this.grid.update();
}
this.resize_to = function(size)
{
const {dialog,app} = require('electron').remote;
var win = require('electron').remote.getCurrentWindow();
win.setSize(size.width,size.height);
this.render.resize_to(size);
}
}