diff --git a/am.js b/am.js index 630753c..707c762 100644 --- a/am.js +++ b/am.js @@ -38,6 +38,8 @@ ArtManager = function(aa, gui){ new PixelEditor(gui, aa.images[iname], function(img){ aa.images[iname]=img; am.update(); + }, function(img, shiftKey){ + window.open(img.src); }); }; })(i); diff --git a/gui.css b/gui.css index d2c21d2..7af2f80 100644 --- a/gui.css +++ b/gui.css @@ -57,9 +57,14 @@ color: white; opacity: 0.8; outline: 1px solid rgba(255,255,255,0.4); - no-outline-offset: 4px; - no-box-shadow: 0 0 1px 4px rgba(0,0,0,0.5); + -no-outline-offset: 4px; + -no-box-shadow: 0 0 1px 4px rgba(0,0,0,0.5); padding: 4px; + border-radius: 4px; + box-shadow: 0 0 3pt 2pt rgba(255,0,0,0.4); +} +.modal.active { + box-shadow: 0 0 3pt 2pt red; } .modal:hover, .modal.dragging { opacity: 1; diff --git a/gui.js b/gui.js index 7cdb416..d87bfc6 100644 --- a/gui.js +++ b/gui.js @@ -40,10 +40,17 @@ function Modal(_gui){ var windowMouseMove=function(e){m.position(e.clientX-m.ox,e.clientY-m.oy);}; var bringToFront=function(e){ m.$m.style.zIndex=++gui.z; - if(gui.active)gui.active.isActive=false; + if(gui.active){ + gui.active.isActive=false + gui.active.$m.classList.remove("active"); + } gui.active=m.onactivate?m.onactivate():m; + gui.active.$m.classList.add("active"); gui.active.isActive=true; - }; bringToFront(); + }; + bringToFront(); + m.focus = bringToFront; + var prevent=function(e){ e.preventDefault(); }; @@ -60,13 +67,13 @@ function Modal(_gui){ var tbMouseDown=function(e){ if(e.button!==0)return; e.preventDefault(); - m.$m.className=(m.className+" modal dragging").trim(); + m.$m.className=(m.className+" modal dragging"+(m.isActive?" active":"")).trim(); m.ox=e.clientX-m.$m.offsetLeft; m.oy=e.clientY-m.$m.offsetTop; addEventListener('mousemove', windowMouseMove, true); }; var mouseUp=function(e){ - m.$m.className=(m.className+" modal").trim(); + m.$m.className=(m.className+" modal"+(m.isActive?" active":"")).trim(); m.ox=0; m.oy=0; removeEventListener('mousemove', windowMouseMove, true); diff --git a/pe.js b/pe.js index ef89e1c..c32cef4 100644 --- a/pe.js +++ b/pe.js @@ -1,7 +1,7 @@ /// It's a pixel editor. // #disposable -PixelEditor = function(gui, img, update){ +PixelEditor = function(gui, img, update, save){ var pe = this; somePixelEditor = pe; @@ -373,6 +373,9 @@ PixelEditor = function(gui, img, update){ pe.undoable(); console.log(e.clipboard,e); break; + case "S"://save (+shift=save as) + e.ctrlKey && save(pe.img, e.shiftKey); + break; } //if(String.fromCharCode(e.keyCode).toUpperCase()==="A"){ // return false; @@ -551,6 +554,7 @@ PixelEditor = function(gui, img, update){ } return true; }; + pe.m.focus(); }; /*