summaryrefslogtreecommitdiff
path: root/src/client
diff options
context:
space:
mode:
authorAlon Levy <alon@pobox.com>2015-02-17 11:01:04 +0200
committerAlon Levy <alon@pobox.com>2015-02-17 11:27:11 +0200
commit02b309eff434206d5b643999428273bcc8576bc5 (patch)
treefc2836bae17f38245fc4f478b34360dccd1596ab /src/client
parentc0eacb5b0ab71a3c9f86c4592918f9a25d8382c5 (diff)
client: expand textanalyser input up to 80%. Fixes #239
drops animation of width because I couldn't get the plus button to animate the same.
Diffstat (limited to 'src/client')
-rw-r--r--src/client/textanalysis.ui.js14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/client/textanalysis.ui.js b/src/client/textanalysis.ui.js
index b6f950f8..aa16f135 100644
--- a/src/client/textanalysis.ui.js
+++ b/src/client/textanalysis.ui.js
@@ -9,7 +9,9 @@ var text = "", // Last text of sentence
element_raw = element[0],
plus_button = $('#btn_add'),
description = consts.description,
- input = new Bacon.Bus();
+ input = new Bacon.Bus(),
+ initial_width = element.width(),
+ plus_button_initial_offset = plus_button.offset();
function get_svg__body_position(node_id)
{
@@ -227,15 +229,15 @@ var analyze_element_text = function()
finalize: false,
});
input.push({where: consts.INPUT_WHERE_TEXTANALYSIS, input: text});
- //stretch_input_to_text_size();
+ stretch_input_to_text_size();
}
function stretch_input_to_text_size()
{
- console.log('text.length = ' + text.length);
- if (text.length * 8 > 500) {
- element.css('width', text.length * 8 + 20);
- }
+ var new_width = Math.min(Math.max(initial_width, text.length * 9 + 20), $(window).width() * 0.8);
+
+ element.width(new_width);
+ plus_button.offset({'left': element.offset().left + element.width() - 18});
}
return {