From d95dc01489ed4862cf1ac5841b27d3d990bb5a53 Mon Sep 17 00:00:00 2001 From: Robert Konigsberg Date: Sun, 8 Jan 2012 02:04:24 -0500 Subject: [PATCH] Text area is almost working. It's not modal, and it could use a little polish. --- experimental/palette/index.html | 1 + experimental/palette/palette.css | 22 +++++++++++++++++++++- experimental/palette/palette.js | 20 ++++++++++++-------- experimental/palette/samples.js | 4 +++- 4 files changed, 37 insertions(+), 10 deletions(-) diff --git a/experimental/palette/index.html b/experimental/palette/index.html index af490db..1be363b 100644 --- a/experimental/palette/index.html +++ b/experimental/palette/index.html @@ -8,6 +8,7 @@ + diff --git a/experimental/palette/palette.css b/experimental/palette/palette.css index 4cbcc54..7548778 100644 --- a/experimental/palette/palette.css +++ b/experimental/palette/palette.css @@ -34,7 +34,6 @@ .tooltip { position: absolute; border: 1px solid black; - layer-background-color: lightyellow; background-color: lightyellow; width: 280px; } @@ -52,3 +51,24 @@ .tooltip .body { font-size: smaller; } + +.textarea { + position: absolute; + border: 1px solid black; + background-color: #dddddd; + z-index: 12; +} + +.textarea .prompt { +} + +.textarea .buttons { + position: absolute; + bottom: 5px; + right: 5px; +} + +.textarea button { + color: #222222; +} + diff --git a/experimental/palette/palette.js b/experimental/palette/palette.js index a91c6ef..86db6da 100644 --- a/experimental/palette/palette.js +++ b/experimental/palette/palette.js @@ -57,13 +57,19 @@ Palette.prototype.create = function(document, parentElement) { palette.filter(palette.filterBar.value) }; this.filterBar.onclick = this.filterBar.onkeyup; - var go = document.createElement("button"); - Palette.createChild("span", row).appendChild(go); + var go = Palette.createChild("button", Palette.createChild("span", row)); go.innerText = "Redraw" go.onclick = function() { palette.onchange(); }; + var tmp = Palette.createChild("button", Palette.createChild("span", row)); + tmp.innerText = "Copy" + tmp.onclick = function() { + var textarea = new TextArea(); + textarea.show("Now is the time for all good men\nto come to the aid of their country"); + }; + for (var opt in opts) { try { if (opts.hasOwnProperty(opt)) { @@ -91,13 +97,11 @@ Palette.prototype.create = function(document, parentElement) { var entry = palette.model[opt]; var inputValue = entry.functionString; if (inputValue == null || inputValue.length == 0) { - inputValue = opts[opt].type + "{ }"; + inputValue = opts[opt].type + "{\n\n}"; } - var value = prompt("enter function", inputValue); - if (value != null) { - if (value.length == 0) { - value = null; - } + var textarea = new TextArea(); + textarea.show("enter function", inputValue); + textarea.okCallback = function(value) { if (value != inputValue) { entry.functionString = value; entry.input.innerText = value ? "defined" : "not defined"; diff --git a/experimental/palette/samples.js b/experimental/palette/samples.js index 55da365..ef4fbbf 100644 --- a/experimental/palette/samples.js +++ b/experimental/palette/samples.js @@ -61,7 +61,9 @@ Samples.data = [ ylabel: 'Count', axisLineColor: 'white', drawXGrid: false, - pointClickCallback: function() { alert("p-click!"); }, + pointClickCallback: function() { + alert("p-click!"); +}, } }, -- 2.7.4