diff --git a/_notes.txt b/_notes.txt new file mode 100644 index 0000000..ad9b41b --- /dev/null +++ b/_notes.txt @@ -0,0 +1,29 @@ + + Rhonin + + Graphics +% image.png 15 -15 100 100 + + Canvas +@ 100 100 + + Scale +~ 100 100 + + Layers +# 1 +> Next Layer +< Prev Laye + + Files +$ new_name.jpg +/ file_name.jpg + + Brushes ++ 10 0 +- 10 0 + + Cursors += 10 +] += 1 +[ -= 1 \ No newline at end of file diff --git a/links/main.css b/links/main.css index ce5c990..a8649e8 100644 --- a/links/main.css +++ b/links/main.css @@ -1,5 +1,7 @@ body { margin:0px; padding:0px; overflow:hidden;} + canvas:hover { cursor: crosshair;} + #commander { display:none; } #commander.visible { display:block; } #commander.hidden { display:none; } diff --git a/scripts/commander.js b/scripts/commander.js index 17cfee2..943588f 100644 --- a/scripts/commander.js +++ b/scripts/commander.js @@ -12,10 +12,22 @@ function Commander(element,element_input) this.hide = function() { this.element.setAttribute('class','hidden'); + this.element_input.value = ""; } this.validate = function() { - console.log(this.element_input.value); + var parts = this.element_input.value.split(" "); + + if(parts[0] == ":@"){ + canvas.style.width = parts[1]+"px"; + canvas.style.height = parts[2]+"px"; + } + + this.hide(); + } + + this.passive = function() + { } } \ No newline at end of file diff --git a/scripts/keyboard.js b/scripts/keyboard.js index 94ee546..d8a1674 100644 --- a/scripts/keyboard.js +++ b/scripts/keyboard.js @@ -18,7 +18,8 @@ function Keyboard() { if(this.is_locked === true){ return; } - console.log(event.keyCode); + commander.passive(); + switch (event.keyCode) { case 9: this.key_tab(); break; @@ -66,6 +67,7 @@ function Keyboard() this.key_colon = function() { commander.show(); + return false; } this.key_escape = function() diff --git a/scripts/main.js b/scripts/main.js index 6a5eae5..146f495 100644 --- a/scripts/main.js +++ b/scripts/main.js @@ -2,6 +2,7 @@ var canvas = document.getElementById('myCanvas'); var context = canvas.getContext('2d'); var brush = new Brush(); + var commander = new Commander(document.getElementById("commander"),document.getElementById("commander_input")); canvas.addEventListener('mousemove', function(e) { @@ -16,6 +17,10 @@ canvas.addEventListener('mouseup', function(e) { brush.draw_stop(e); }, false); +var keyboard = new Keyboard(); +document.onkeydown = function myFunction(){ keyboard.listen(event); }; + +/* brush experiments var mirror_test = new Pointer(); mirror_test.mirror = new Position(200,0); brush.add_pointer(mirror_test); @@ -26,5 +31,4 @@ brush.add_pointer(mirror_test2); brush.add_pointer(new Pointer(new Position(0,10))); -var keyboard = new Keyboard(); -document.onkeydown = function myFunction(){ keyboard.listen(event); }; +*/ \ No newline at end of file diff --git a/scripts/pointer.js b/scripts/pointer.js index 6a9d82a..4a0b05c 100644 --- a/scripts/pointer.js +++ b/scripts/pointer.js @@ -8,6 +8,7 @@ function Pointer(offset = new Position()) { if(!this.position_prev){this.position_prev = this.position(); } + /* Verteces var id = context.createImageData(1,1); var d = id.data; d[0] = 0; @@ -15,6 +16,7 @@ function Pointer(offset = new Position()) d[2] = 0; d[3] = 255; context.putImageData(id,this.position().x,this.position().y); + */ context.beginPath(); context.moveTo(this.position_prev.x,this.position_prev.y);