summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorPrashant Pandey <prashant3.yishu@gmail.com>2013-09-07 23:53:02 +0530
committerJan Holesovsky <kendy@suse.cz>2013-09-13 00:44:04 +0200
commit16ea2dc1f572d698923c770a2a58f7ab402d1298 (patch)
treef7634409c0c699276446140ec4c40886ca842fa0 /vcl
parent14e7a290dab7fead66ef6ff7f94c6a425d80ceb6 (diff)
Sidebar: Correcting anomalous mouse behaviour while resizing
Currently, when the sidebar is showing, and we hold the handle to make it wider/narrower, if we move the mouse much to the left (so that it can't become any wider), and now move mouse pointer to the right (while still holding the handle), it immediately begins to shrink. Ideally how it should behave when we move the mouse much to the left is that- the sidebar should begin shrinking once we have the mouse pointer over the handle again and not immediately. Change-Id: Id17dc19e6e1ad02fb7879ace9a2e092ac0128693
Diffstat (limited to 'vcl')
-rw-r--r--vcl/source/window/splitwin.cxx17
1 files changed, 13 insertions, 4 deletions
diff --git a/vcl/source/window/splitwin.cxx b/vcl/source/window/splitwin.cxx
index 232218957c61..e9286bdf2b0f 100644
--- a/vcl/source/window/splitwin.cxx
+++ b/vcl/source/window/splitwin.cxx
@@ -2542,21 +2542,30 @@ void SplitWindow::Tracking( const TrackingEvent& rTEvt )
{
sal_Bool bPropSmaller = (mnMouseModifier & KEY_SHIFT) ? sal_True : sal_False;
sal_Bool bPropGreater = (mnMouseModifier & KEY_MOD1) ? sal_True : sal_False;
- long nDelta = mnMSplitPos-mnMStartPos;
if ( (mnSplitTest & SPLIT_WINDOW) && !mpMainSet->mpItems )
{
+ // nDelta corresponds to the direction to which user drags the mouse.
+ // If nDelta > 0, means user has dragged the handle towards the right and vice-versa
+ long nDelta = mnMSplitPos-mnMStartPos;
+
if ( (mpSplitSet == mpMainSet) && mbBottomRight )
nDelta *= -1;
ImplSetWindowSize( nDelta );
}
else
{
- long nNewSize = mpSplitSet->mpItems[mnSplitPos].mnPixSize;
+ long nNewSize( 0 );
+
+ // where is the sidebar is attached?
if ( (mpSplitSet == mpMainSet) && mbBottomRight )
- nNewSize -= nDelta;
+ nNewSize = mnMaxSize - mnMStartPos; // right hand side of the screen
else
- nNewSize += nDelta;
+ nNewSize = mnMStartPos; // left hand side of the screen
+
+ // do not make the sidebar wider than mnMaxSize
+ nNewSize = std::min(nNewSize, mpSplitSet->mpItems[mnSplitPos].mnMaxSize);
+
SplitItem( mpSplitSet->mpItems[mnSplitPos].mnId, nNewSize,
bPropSmaller, bPropGreater );
}