Improved this and that

This commit is contained in:
Devine Lu Linvega
2018-01-03 15:24:26 +13:00
parent 4deed6fef6
commit 7cc9fde1b3
9 changed files with 97 additions and 107 deletions

View File

@@ -109,6 +109,7 @@ function Commander()
{
ronin.commander.input_el.value = str;
ronin.commander.update();
ronin.commander.show();
}
this.append = function(str)
@@ -119,12 +120,12 @@ function Commander()
this.show = function()
{
this.el.style.display = "block";
this.el.className = "visible";
}
this.hide = function()
{
this.el.style.display = "none";
this.el.className = "hidden";
}
this.query = function()

View File

@@ -8,9 +8,9 @@ function Cursor(rune)
this.query = null;
this.mode = "vertex";
this.color = "#000000"
this.color = "#ff0000"
this.color_alt = "#ffffff"
this.size = 4;
this.size = 2;
this.pos = {x:0,y:0};
this.target = null;
@@ -22,7 +22,7 @@ function Cursor(rune)
if(!pos){ return; }
var ctx = this.context();
var radius = ronin.cursor.size;
var radius = ronin.cursor.size * ronin.frame.zoom.scale;
ctx.beginPath();
ctx.arc(pos.x * 2, pos.y * 2, radius, 0, 2 * Math.PI, false);
@@ -220,25 +220,21 @@ function Cursor(rune)
{
var html = "";
var mode = "PAINT";
var mode = "paint";
if(ronin.commander.input_el.value.indexOf("$+") > -1){
mode = "[MULTI]POS/SHIFT-RECT"
}
else if(ronin.commander.input_el.value.indexOf("$") > -1){
mode = "POS/SHIFT-RECT"
}
else if(ronin.keyboard.is_down["Alt"] && ronin.keyboard.is_down["Shift"]){
mode = "PICK";
if(ronin.keyboard.is_down["Alt"] && ronin.keyboard.is_down["Shift"]){
mode = "pick";
}
else if(ronin.keyboard.is_down["Alt"]){
mode = "ERASE";
mode = "erase";
}
else if(ronin.keyboard.is_down["Shift"]){
mode = "DRAG";
mode = "drag";
}
return "<t class='zoom'>ZOOM"+ronin.frame.zoom.scale+"</t> <t class='mode'>"+mode+"</t><t class='size'>"+ronin.cursor.size+"</t> "+(ronin.cursor.target.name)+" <t class='color' style='color:"+ronin.cursor.color+"'>●</t><t class='color' style='color:"+ronin.cursor.color_alt+"'>●</t>";
return `
<t class='target_${ronin.cursor.target.name}'></t><t class='size ${mode}'>${ronin.cursor.size}</t><t class='zoom'>${ronin.frame.zoom.scale}</t>
<icon class='brush'><icon class='primary' style='background:${ronin.cursor.color}'></icon><icon class='secondary' style='background:${ronin.cursor.color_alt}'></icon></icon>`;
}
function distance_between(a,b)

View File

@@ -4,6 +4,15 @@ function Keyboard()
this.key_up = function(e)
{
if(e.key == "tab" || e.keyCode == 9){
e.preventDefault();
ronin.cursor.update();
ronin.commander.autocomplete();
ronin.commander.show();
setTimeout(()=>{ronin.commander.focus},100)
return;
}
ronin.keyboard.is_down[e.key] = false;
ronin.hint.update(e);
}
@@ -12,7 +21,7 @@ function Keyboard()
{
ronin.keyboard.is_down[e.key] = true;
if(e.key == "~"){
if(e.key == "/"){
e.preventDefault();
ronin.commander.inject("~")
return;
@@ -36,12 +45,10 @@ function Keyboard()
}
}
if(e.key == "tab" || e.keyCode == 9){
// Macros
if(e.key == "f" && (e.ctrlKey || e.metaKey)){
e.preventDefault();
ronin.cursor.update();
ronin.commander.autocomplete();
ronin.commander.show();
return;
ronin.commander.inject(`frame fill:${ronin.cursor.color}`)
}
if(ronin.commander.is_focused()){
@@ -65,6 +72,14 @@ function Keyboard()
ronin.cursor.target.clear();
}
if(e.key == "N" && (e.ctrlKey || e.metaKey) && e.shiftKey){
e.preventDefault();
ronin.guide.inspect = false;
ronin.guide.clear();
ronin.layers.above.clear()
ronin.layers.below.clear()
}
// Open
if(e.key == "o" && (e.ctrlKey || e.metaKey)){
e.preventDefault();
@@ -77,11 +92,6 @@ function Keyboard()
ronin.io.methods.save.run();
}
if(e.key == "H" && (e.ctrlKey || e.metaKey) && e.shiftKey){
e.preventDefault();
ronin.docs.export();
}
if(e.key == "x"){
e.preventDefault();
ronin.cursor.swap_colors();