Clear Image
parent
95e73cf77c
commit
ffc34e06a3
4
TODO.md
4
TODO.md
|
@ -19,7 +19,7 @@
|
||||||
* Pixel Perfection
|
* Pixel Perfection
|
||||||
* MAKE THINGS DO THINGS
|
* MAKE THINGS DO THINGS
|
||||||
* Image > Attributes
|
* Image > Attributes
|
||||||
* Image > Clear Image
|
* Image > Clear Image ✓
|
||||||
* View > Show/Hide stuff
|
* View > Show/Hide stuff
|
||||||
* Edit > Paste From
|
* Edit > Paste From
|
||||||
* Other stuff
|
* Other stuff
|
||||||
|
@ -89,7 +89,7 @@
|
||||||
* Flip
|
* Flip
|
||||||
* Skew
|
* Skew
|
||||||
* Invert ✓
|
* Invert ✓
|
||||||
* Clear
|
* Clear ✓
|
||||||
* Undo/Redo History to Frames
|
* Undo/Redo History to Frames
|
||||||
|
|
||||||
### Tools
|
### Tools
|
||||||
|
|
16
app.js
16
app.js
|
@ -258,7 +258,8 @@ $.each({
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
item: "&Clear Image",
|
item: "&Clear Image",
|
||||||
shortcut: "Ctrl+Shift+N"
|
shortcut: "Ctrl+Shift+N",
|
||||||
|
action: clear
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
item: "&Draw Opaque",
|
item: "&Draw Opaque",
|
||||||
|
@ -382,10 +383,10 @@ $canvas.on("user-resized", function(e, width, height){
|
||||||
canvas.width = Math.max(1, width);
|
canvas.width = Math.max(1, width);
|
||||||
canvas.height = Math.max(1, height);
|
canvas.height = Math.max(1, height);
|
||||||
if(transparency){
|
if(transparency){
|
||||||
ctx.clearRect(0, 0, width, height);
|
ctx.clearRect(0, 0, canvas.width, canvas.height);
|
||||||
}else{
|
}else{
|
||||||
ctx.fillStyle = colors[1];
|
ctx.fillStyle = colors[1];
|
||||||
ctx.fillRect(0, 0, width, height);
|
ctx.fillRect(0, 0, canvas.width, canvas.height);
|
||||||
}
|
}
|
||||||
|
|
||||||
var previous_canvas = undos[undos.length-1];
|
var previous_canvas = undos[undos.length-1];
|
||||||
|
@ -396,8 +397,8 @@ $canvas.on("user-resized", function(e, width, height){
|
||||||
$canvas.trigger("update"); //update handles
|
$canvas.trigger("update"); //update handles
|
||||||
|
|
||||||
try{
|
try{
|
||||||
localStorage.width = width;
|
localStorage.width = canvas.width;
|
||||||
localStorage.height = height;
|
localStorage.height = canvas.height;
|
||||||
}catch(e){}
|
}catch(e){}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -463,14 +464,17 @@ $G.on("keydown", function(e){
|
||||||
}
|
}
|
||||||
if(fits_shape){
|
if(fits_shape){
|
||||||
brush_shape = k;
|
brush_shape = k;
|
||||||
|
$G.trigger("option-changed");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(e.keyCode === 96){
|
if(e.keyCode === 96){
|
||||||
brush_shape = "circle";
|
brush_shape = "circle";
|
||||||
|
$G.trigger("option-changed");
|
||||||
}
|
}
|
||||||
if(e.keyCode === 111){
|
if(e.keyCode === 111){
|
||||||
brush_shape = "diagonal";
|
brush_shape = "diagonal";
|
||||||
|
$G.trigger("option-changed");
|
||||||
}
|
}
|
||||||
|
|
||||||
if(e.altKey){
|
if(e.altKey){
|
||||||
|
@ -542,7 +546,7 @@ $G.on("keydown", function(e){
|
||||||
file_open();
|
file_open();
|
||||||
break;
|
break;
|
||||||
case "N":
|
case "N":
|
||||||
file_new();
|
e.shiftKey ? clear() : file_new();
|
||||||
break;
|
break;
|
||||||
case "S":
|
case "S":
|
||||||
e.shiftKey ? file_save_as() : file_save();
|
e.shiftKey ? file_save_as() : file_save();
|
||||||
|
|
13
functions.js
13
functions.js
|
@ -363,6 +363,19 @@ function invert(){
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function clear(){
|
||||||
|
undoable(0, function(){
|
||||||
|
this_ones_a_frame_changer();
|
||||||
|
|
||||||
|
if(transparency){
|
||||||
|
ctx.clearRect(0, 0, canvas.width, canvas.height);
|
||||||
|
}else{
|
||||||
|
ctx.fillStyle = colors[1];
|
||||||
|
ctx.fillRect(0, 0, canvas.width, canvas.height);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
function view_bitmap(){
|
function view_bitmap(){
|
||||||
canvas.requestFullscreen && canvas.requestFullscreen();
|
canvas.requestFullscreen && canvas.requestFullscreen();
|
||||||
canvas.webkitRequestFullscreen && canvas.webkitRequestFullscreen();
|
canvas.webkitRequestFullscreen && canvas.webkitRequestFullscreen();
|
||||||
|
|
Loading…
Reference in New Issue