diff options
| author | Alon Levy <alon@pobox.com> | 2015-02-17 11:01:04 +0200 |
|---|---|---|
| committer | Alon Levy <alon@pobox.com> | 2015-02-17 11:27:11 +0200 |
| commit | 02b309eff434206d5b643999428273bcc8576bc5 (patch) | |
| tree | fc2836bae17f38245fc4f478b34360dccd1596ab | |
| parent | c0eacb5b0ab71a3c9f86c4592918f9a25d8382c5 (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.
| -rw-r--r-- | res/client/css/partials/input-bar.scss | 3 | ||||
| -rw-r--r-- | res/client/css/style.css | 3 | ||||
| -rw-r--r-- | src/client/textanalysis.ui.js | 14 |
3 files changed, 8 insertions, 12 deletions
diff --git a/res/client/css/partials/input-bar.scss b/res/client/css/partials/input-bar.scss index 568c703b..3d6de74b 100644 --- a/res/client/css/partials/input-bar.scss +++ b/res/client/css/partials/input-bar.scss @@ -17,9 +17,6 @@ border: 1px solid $mid-grey; @include rz-box-sizing-border; background: white; - transition-property: width; - transition-duration: 200ms; - transition-timing-function: ease-in; width: 100%; &:focus { border: 1px solid $mid-grey; diff --git a/res/client/css/style.css b/res/client/css/style.css index 12466a9b..539f0e43 100644 --- a/res/client/css/style.css +++ b/res/client/css/style.css @@ -516,9 +516,6 @@ body.debug .debug-ui-right { -moz-box-sizing: border-box; box-sizing: border-box; background: white; - transition-property: width; - transition-duration: 200ms; - transition-timing-function: ease-in; width: 100%; } .input-bar:focus { border: 1px solid #919095; 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 { |
