From 1050efbe65871aadd69322fa27d3066809bec5dd Mon Sep 17 00:00:00 2001 From: Mani Wang Date: Sat, 28 Jun 2014 02:38:48 +0800 Subject: [PATCH] make expand postContainer more easier If user don't know drag to expand and move 0 after down, then think user clicked and toggle postContainer's height between max and default 400. --- public/src/modules/composer/resize.js | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/public/src/modules/composer/resize.js b/public/src/modules/composer/resize.js index 8b88482f28..606996774d 100644 --- a/public/src/modules/composer/resize.js +++ b/public/src/modules/composer/resize.js @@ -44,15 +44,31 @@ define('composer/resize', function() { var resizeCenterY = resizeRect.top + (resizeRect.height/2); resizeOffset = resizeCenterY - e.clientY; resizeActive = true; + resizeDown = e.clientY; $(window).on('mousemove', resizeAction); $(window).on('mouseup', resizeStop); $('body').on('touchmove', resizeTouchAction); } - function resizeStop() { + function resizeStop(e) { resizeActive = false; - postContainer.find('textarea').focus(); + if(e.clientY-resizeDown==0){ + var newHeight; + var max = $(window).height() - $('#header-menu').height() - 20; + if(max != postContainer.height()){ + newHeight = max; + $('.fa-chevron-up').addClass("fa-chevron-down").removeClass("fa-chevron-up"); + }else{ + newHeight = 400; + $('.fa-chevron-down').addClass("fa-chevron-up").removeClass("fa-chevron-down"); + } + postContainer.css('height', newHeight); + $('body').css({'margin-bottom': newHeight}); + resizeWritePreview(postContainer); + resizeSavePosition(newHeight); + } + postContainer.find('textarea').focus(); $(window).off('mousemove', resizeAction); $(window).off('mouseup', resizeStop); $('body').off('touchmove', resizeTouchAction); @@ -90,6 +106,7 @@ define('composer/resize', function() { var resizeActive = false, resizeOffset = 0, + resizeDown = 0, resizeEl = postContainer.find('.resizer'); resizeEl.on('mousedown', resizeStart); @@ -118,4 +135,4 @@ define('composer/resize', function() { return resize; -}); \ No newline at end of file +});