summaryrefslogtreecommitdiff
path: root/indra/llui/llresizehandle.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/llui/llresizehandle.cpp')
-rw-r--r--indra/llui/llresizehandle.cpp81
1 files changed, 39 insertions, 42 deletions
diff --git a/indra/llui/llresizehandle.cpp b/indra/llui/llresizehandle.cpp
index 6239a8f721..3df09d124a 100644
--- a/indra/llui/llresizehandle.cpp
+++ b/indra/llui/llresizehandle.cpp
@@ -124,7 +124,7 @@ BOOL LLResizeHandle::handleHover(S32 x, S32 y, MASK mask)
{
// Make sure the mouse in still over the application. We don't want to make the parent
// so big that we can't see the resize handle any more.
-
+
S32 screen_x;
S32 screen_y;
localPointToScreen(x, y, &screen_x, &screen_y);
@@ -146,68 +146,61 @@ BOOL LLResizeHandle::handleHover(S32 x, S32 y, MASK mask)
LLRect scaled_rect = orig_rect;
S32 delta_x = screen_x - mDragLastScreenX;
S32 delta_y = screen_y - mDragLastScreenY;
+
+ if(delta_x == 0 && delta_y == 0)
+ return FALSE;
+
LLCoordGL mouse_dir;
// use hysteresis on mouse motion to preserve user intent when mouse stops moving
mouse_dir.mX = (screen_x == mLastMouseScreenX) ? mLastMouseDir.mX : screen_x - mLastMouseScreenX;
mouse_dir.mY = (screen_y == mLastMouseScreenY) ? mLastMouseDir.mY : screen_y - mLastMouseScreenY;
+
mLastMouseScreenX = screen_x;
mLastMouseScreenY = screen_y;
mLastMouseDir = mouse_dir;
- S32 x_multiple = 1;
- S32 y_multiple = 1;
- switch( mCorner )
- {
- case LEFT_TOP:
- x_multiple = -1;
- y_multiple = 1;
- break;
- case LEFT_BOTTOM:
- x_multiple = -1;
- y_multiple = -1;
- break;
- case RIGHT_TOP:
- x_multiple = 1;
- y_multiple = 1;
- break;
- case RIGHT_BOTTOM:
- x_multiple = 1;
- y_multiple = -1;
- break;
- }
+ S32 new_width = orig_rect.getWidth();
+ S32 new_height = orig_rect.getHeight();
- S32 new_width = orig_rect.getWidth() + x_multiple * delta_x;
- if( new_width < mMinWidth )
- {
- new_width = mMinWidth;
- delta_x = x_multiple * (mMinWidth - orig_rect.getWidth());
- }
-
- S32 new_height = orig_rect.getHeight() + y_multiple * delta_y;
- if( new_height < mMinHeight )
- {
- new_height = mMinHeight;
- delta_y = y_multiple * (mMinHeight - orig_rect.getHeight());
- }
+ S32 new_pos_x = orig_rect.mLeft;
+ S32 new_pos_y = orig_rect.mTop;
switch( mCorner )
{
- case LEFT_TOP:
- scaled_rect.translate(delta_x, 0);
+ case LEFT_TOP:
+ new_width-=delta_x;
+ new_height+=delta_y;
+ new_pos_x+=delta_x;
+ new_pos_y+=delta_y;
break;
case LEFT_BOTTOM:
- scaled_rect.translate(delta_x, delta_y);
+ new_width-=delta_x;
+ new_height-=delta_y;
+ new_pos_x+=delta_x;
break;
case RIGHT_TOP:
+ new_width+=delta_x;
+ new_height+=delta_y;
+ new_pos_y+=delta_y;
break;
case RIGHT_BOTTOM:
- scaled_rect.translate(0, delta_y);
+ new_width+=delta_x;
+ new_height-=delta_y;
break;
}
+ new_width = llmax(new_width,mMinWidth);
+ new_height = llmax(new_height,mMinHeight);
+
+ LLRect::tCoordType screen_width = resizing_view->getParent()->getSnapRect().getWidth();
+ LLRect::tCoordType screen_height = resizing_view->getParent()->getSnapRect().getHeight();
+
+ new_width = llmin(new_width, screen_width);
+ new_height = llmin(new_height, screen_height);
+
// temporarily set new parent rect
- scaled_rect.mRight = scaled_rect.mLeft + new_width;
- scaled_rect.mTop = scaled_rect.mBottom + new_height;
+ scaled_rect.setLeftTopAndSize(new_pos_x,new_pos_y,new_width,new_height);
+
resizing_view->setRect(scaled_rect);
LLView* snap_view = NULL;
@@ -258,7 +251,11 @@ BOOL LLResizeHandle::handleHover(S32 x, S32 y, MASK mask)
resizing_view->setRect(orig_rect);
// translate and scale to new shape
- resizing_view->setShape(scaled_rect, true);
+ resizing_view->reshape(scaled_rect.getWidth(),scaled_rect.getHeight());
+ resizing_view->setRect(scaled_rect);
+ //set shape to handle dependent floaters...
+ resizing_view->handleReshape(scaled_rect, false);
+
// update last valid mouse cursor position based on resized view's actual size
LLRect new_rect = resizing_view->getRect();