diff --git a/images/box-icon.png b/images/box-icon.png new file mode 100644 index 0000000..6d2a1b9 Binary files /dev/null and b/images/box-icon.png differ diff --git a/images/box-tool.png b/images/box-tool.png deleted file mode 100644 index 5c4f838..0000000 Binary files a/images/box-tool.png and /dev/null differ diff --git a/images/erase-icon.png b/images/erase-icon.png new file mode 100644 index 0000000..649f2f3 Binary files /dev/null and b/images/erase-icon.png differ diff --git a/images/erase-tool.png b/images/erase-tool.png deleted file mode 100644 index 1f86864..0000000 Binary files a/images/erase-tool.png and /dev/null differ diff --git a/images/freeform-icon.png b/images/freeform-icon.png new file mode 100644 index 0000000..e9265bc Binary files /dev/null and b/images/freeform-icon.png differ diff --git a/images/freeform-tool.png b/images/freeform-tool.png deleted file mode 100644 index 8b519b5..0000000 Binary files a/images/freeform-tool.png and /dev/null differ diff --git a/images/info-button.png b/images/info-button.png deleted file mode 100644 index b2f6d14..0000000 Binary files a/images/info-button.png and /dev/null differ diff --git a/images/info-icon.png b/images/info-icon.png new file mode 100644 index 0000000..8e80688 Binary files /dev/null and b/images/info-icon.png differ diff --git a/images/line-icon.png b/images/line-icon.png new file mode 100644 index 0000000..b7f1f33 Binary files /dev/null and b/images/line-icon.png differ diff --git a/images/line-tool.png b/images/line-tool.png deleted file mode 100644 index dab4b1b..0000000 Binary files a/images/line-tool.png and /dev/null differ diff --git a/images/move-icon.png b/images/move-icon.png new file mode 100644 index 0000000..1bb6401 Binary files /dev/null and b/images/move-icon.png differ diff --git a/images/move-tool.png b/images/move-tool.png deleted file mode 100644 index cb2b1bb..0000000 Binary files a/images/move-tool.png and /dev/null differ diff --git a/images/text-icon.png b/images/text-icon.png new file mode 100644 index 0000000..ce64044 Binary files /dev/null and b/images/text-icon.png differ diff --git a/images/text-tool.png b/images/text-tool.png deleted file mode 100644 index 5c30098..0000000 Binary files a/images/text-tool.png and /dev/null differ diff --git a/index.html b/index.html index 24677fc..cadd556 100644 --- a/index.html +++ b/index.html @@ -25,14 +25,14 @@ body { width: 100%; background-color: #FFF; z-index: 100; - box-shadow:0px 3px 3px #CCC; + box-shadow: 0px 3px 3px #CCC; } #file-tools { text-align: right; display: inline-block; position: fixed; - width: 100%; + right: 0px; z-index: 100; } @@ -45,13 +45,15 @@ button { text-align: center; cursor: pointer; outline: 0 !important; - background-size: 100% !important; + background-size: 200% 100% !important; + background-color: #FFF; } .info-icon { width: 30px; height: 30px; background-size: 100% !important; + background-size: 200% 100% !important; display: inline-block; } @@ -62,6 +64,11 @@ button { height: 30px; } + +#drive-filename { + display: inline-block; +} + /* Mobile overrides */ @media(max-width:600px) { /* Move file tools to the bottom. */ @@ -69,6 +76,10 @@ button { bottom: 0px; background-color: #FFF; box-shadow:0px -3px 3px #CCC; + width: 100%; + } + #drive-filename { + display: block; } } @@ -98,8 +109,8 @@ button { border-width: 0px; } -#draw-tools > button.active { - /* TODO: Offset background images. */ +button.active, .info-icon { + background-position: right; } .dialog > button { @@ -113,11 +124,6 @@ button { top: 0px; } - -#drive-filename { - display: inline-block; -} - textarea { width: 100%; height: 100%; @@ -130,31 +136,25 @@ textarea { white-space: pre; } -.box-image { background-image: url('images/box-tool.png'); } -.line-image { background-image: url('images/line-tool.png'); } -.freeform-image { background-image: url('images/freeform-tool.png'); } -.erase-image { background-image: url('images/erase-tool.png'); } -.move-image { background-image: url('images/move-tool.png'); } -.text-image { background-image: url('images/text-tool.png'); } -.info-image { background-image: url('images/info-button.png'); } +.box-image { background-image: url('images/box-icon.png'); } +.line-image { background-image: url('images/line-icon.png'); } +.freeform-image { background-image: url('images/freeform-icon.png'); } +.erase-image { background-image: url('images/erase-icon.png'); } +.move-image { background-image: url('images/move-icon.png'); } +.text-image { background-image: url('images/text-icon.png'); } +.info-image { background-image: url('images/info-icon.png'); }
- - - - - - + + + + + +
@@ -169,7 +169,7 @@ textarea {
- +
diff --git a/js-compiled.js b/js-compiled.js index b7e3b57..e94f20c 100644 --- a/js-compiled.js +++ b/js-compiled.js @@ -452,19 +452,23 @@ W.prototype.o = function() { $(window).resize(function() { A(a.view); }); - $("button.tool").click(function(a) { + $("#draw-tools > button.tool").click(function(a) { a = a.target.id; - $("button.tool").removeClass("active"); - $(".dialog").removeClass("visible"); + $("#draw-tools > button.tool").removeClass("active"); $("#" + a).toggleClass("active"); - $("#" + a + "-dialog").toggleClass("visible"); + $(".dialog").removeClass("visible"); "box-button" == a && (this.d = new I(this.state)); "line-button" == a && (this.d = new M(this.state)); "freeform-button" == a && (this.d = new N(this.state, "+")); "erase-button" == a && (this.d = new Q(this.state)); "move-button" == a && (this.d = new R(this.state)); "text-button" == a && (this.d = new P(this.state)); - "export-button" == a && $("#export-area").val(V(this.state)); + }.bind(this)); + $("#file-tools > button.tool").click(function(a) { + a = a.target.id; + $(".dialog").removeClass("visible"); + $("#" + a + "-dialog").toggleClass("visible"); + "export-button" == a && ($("#export-area").val(V(this.state)), $("#export-area").focus(), $("#export-area").select()); "clear-button" == a && this.state.clear(); "undo-button" == a && U(this.state); }.bind(this)); diff --git a/js-lib/controller.js b/js-lib/controller.js index efcaf7d..7cfa8d0 100644 --- a/js-lib/controller.js +++ b/js-lib/controller.js @@ -99,10 +99,12 @@ ascii.Controller.prototype.installBindings = function() { $(window).resize(function(e) { controller.view.resizeCanvas() }); - // TODO: Handle pinch to zoom. + $('#draw-tools > button.tool').click(function(e) { + this.handleDrawButton(e.target.id); + }.bind(this)); - $('button.tool').click(function(e) { - this.updateButtons(e.target.id); + $('#file-tools > button.tool').click(function(e) { + this.handleFileButton(e.target.id); }.bind(this)); $('button.close-dialog-button').click(function(e) { @@ -123,6 +125,7 @@ ascii.Controller.prototype.installBindings = function() { this.view.useLines = true; this.view.dirty = true; }.bind(this)); + $('#use-ascii-button').click(function(e) { $('.dialog').removeClass('visible'); this.view.useLines = false; @@ -142,12 +145,10 @@ ascii.Controller.prototype.installBindings = function() { * Handles the buttons in the UI. * @param {string} id The ID of the element clicked. */ -ascii.Controller.prototype.updateButtons = function(id) { - $('button.tool').removeClass('active'); - $('.dialog').removeClass('visible'); - +ascii.Controller.prototype.handleDrawButton = function(id) { + $('#draw-tools > button.tool').removeClass('active'); $('#' + id).toggleClass('active'); - $('#' + id + '-dialog').toggleClass('visible'); + $('.dialog').removeClass('visible'); // Install the right draw tool based on button pressed. if (id == 'box-button') { @@ -168,8 +169,20 @@ ascii.Controller.prototype.updateButtons = function(id) { if (id == 'text-button') { this.drawFunction = new ascii.DrawText(this.state); } +}; + +/** + * Handles the buttons in the UI. + * @param {string} id The ID of the element clicked. + */ +ascii.Controller.prototype.handleFileButton = function(id) { + $('.dialog').removeClass('visible'); + $('#' + id + '-dialog').toggleClass('visible'); + if (id == 'export-button') { $('#export-area').val(this.state.outputText()); + $('#export-area').focus(); + $('#export-area').select(); } if (id == 'clear-button') { this.state.clear();