diff options
author | Paul Guslisty <pguslisty@productengine.com> | 2010-12-10 13:01:01 +0200 |
---|---|---|
committer | Paul Guslisty <pguslisty@productengine.com> | 2010-12-10 13:01:01 +0200 |
commit | ee538257d316696382d12ea222294a4b8786dc84 (patch) | |
tree | bf0d4b0aac48baed0b85ff12b7528a5379d3e6e0 /indra | |
parent | 7efc67a9e095a6f0d65dfc88da1ed84b81d37508 (diff) |
STORM-622 FIXED Texture picker screws up when multiple textures are opened.
Reason:
In viewer 2 ability was added to set aspect ratio while previewing textures. It was achieved by resizing the floater containing a texture, instead of proportionally resize the texture. The problem happened when multifloater was opened with texture preview floaters and for some floaters textures were not loaded yet. After texture was loaded, the floater (in multifloater) which contained just loaded texture resized to fit with the new texture's size and texture preview floaters screwed up from the multifloater.
Solution:
Proportionally resizing a texture inside the floater instead of the floater itself.
Also two issues was fixed: 1. when floater resized the texture streched in the floater and lost its proportions. 2. When docking texture floater to the multifloater, multifloater resized to fit with docked floater and other texture lost their proportions.
Diffstat (limited to 'indra')
-rw-r--r-- | indra/newview/llpreview.cpp | 3 | ||||
-rw-r--r-- | indra/newview/llpreviewtexture.cpp | 77 |
2 files changed, 6 insertions, 74 deletions
diff --git a/indra/newview/llpreview.cpp b/indra/newview/llpreview.cpp index 69542764d2..a90f23d637 100644 --- a/indra/newview/llpreview.cpp +++ b/indra/newview/llpreview.cpp @@ -454,12 +454,13 @@ LLMultiPreview::LLMultiPreview() { // start with a rect in the top-left corner ; will get resized LLRect rect; - rect.setLeftTopAndSize(0, gViewerWindow->getWindowHeightScaled(), 200, 200); + rect.setLeftTopAndSize(0, gViewerWindow->getWindowHeightScaled(), 200, 400); setRect(rect); } setTitle(LLTrans::getString("MultiPreviewTitle")); buildTabContainer(); setCanResize(TRUE); + mAutoResize = FALSE; } void LLMultiPreview::onOpen(const LLSD& key) diff --git a/indra/newview/llpreviewtexture.cpp b/indra/newview/llpreviewtexture.cpp index fd6b326ef1..7657cccd4e 100644 --- a/indra/newview/llpreviewtexture.cpp +++ b/indra/newview/llpreviewtexture.cpp @@ -318,7 +318,7 @@ void LLPreviewTexture::reshape(S32 width, S32 height, BOOL called_from_parent) } } - mClientRect.setLeftTopAndSize(client_rect.getCenterX() - (client_width / 2), client_rect.getCenterY() + (client_height / 2), client_width, client_height); + mClientRect.setLeftTopAndSize(client_rect.getCenterX() - (client_width / 2), client_rect.getCenterY() + (client_height / 2), client_width, client_height); } @@ -400,7 +400,6 @@ void LLPreviewTexture::updateDimensions() { return; } - mUpdateDimensions = FALSE; @@ -408,80 +407,12 @@ void LLPreviewTexture::updateDimensions() getChild<LLUICtrl>("dimensions")->setTextArg("[HEIGHT]", llformat("%d", mImage->getFullHeight())); - LLRect dim_rect(getChildView("dimensions")->getRect()); - - S32 horiz_pad = 2 * (LLPANEL_BORDER_WIDTH + PREVIEW_PAD) + PREVIEW_RESIZE_HANDLE_SIZE; - - // add space for dimensions and aspect ratio - S32 info_height = dim_rect.mTop + CLIENT_RECT_VPAD; - - S32 screen_width = gFloaterView->getSnapRect().getWidth(); - S32 screen_height = gFloaterView->getSnapRect().getHeight(); - - S32 max_image_width = screen_width - 2*horiz_pad; - S32 max_image_height = screen_height - (PREVIEW_HEADER_SIZE + CLIENT_RECT_VPAD) - - (PREVIEW_BORDER + CLIENT_RECT_VPAD + info_height); - - S32 client_width = llmin(max_image_width,mImage->getFullWidth()); - S32 client_height = llmin(max_image_height,mImage->getFullHeight()); - - if (mAspectRatio > 0.f) - { - if(mAspectRatio > 1.f) - { - client_height = llceil((F32)client_width / mAspectRatio); - if(client_height > max_image_height) - { - client_height = max_image_height; - client_width = llceil((F32)client_height * mAspectRatio); - } - } - else//mAspectRatio < 1.f - { - client_width = llceil((F32)client_height * mAspectRatio); - if(client_width > max_image_width) - { - client_width = max_image_width; - client_height = llceil((F32)client_width / mAspectRatio); - } - } - } - else - { - - if(client_height > max_image_height) - { - F32 ratio = (F32)max_image_height/client_height; - client_height = max_image_height; - client_width = llceil((F32)client_height * ratio); - } - - if(client_width > max_image_width) - { - F32 ratio = (F32)max_image_width/client_width; - client_width = max_image_width; - client_height = llceil((F32)client_width * ratio); - } - } - - //now back to whole floater - S32 floater_width = llmax(getMinWidth(),client_width + 2*horiz_pad); - S32 floater_height = llmax(getMinHeight(),client_height + (PREVIEW_HEADER_SIZE + CLIENT_RECT_VPAD) - + (PREVIEW_BORDER + CLIENT_RECT_VPAD + info_height)); - //reshape floater - reshape( floater_width, floater_height ); - gFloaterView->adjustToFitScreen(this, FALSE); + reshape(getRect().getWidth(), getRect().getHeight()); - //setup image rect... - LLRect client_rect(horiz_pad, getRect().getHeight(), getRect().getWidth() - horiz_pad, 0); - client_rect.mTop -= (PREVIEW_HEADER_SIZE + CLIENT_RECT_VPAD); - client_rect.mBottom += PREVIEW_BORDER + CLIENT_RECT_VPAD + info_height ; - - mClientRect.setLeftTopAndSize(client_rect.getCenterX() - (client_width / 2), client_rect.getCenterY() + (client_height / 2), client_width, client_height); + gFloaterView->adjustToFitScreen(this, FALSE); - // Hide the aspect ratio label if the window is too narrow - // Assumes the label should be to the right of the dimensions + LLRect dim_rect(getChildView("dimensions")->getRect()); LLRect aspect_label_rect(getChildView("aspect_ratio")->getRect()); getChildView("aspect_ratio")->setVisible( dim_rect.mRight < aspect_label_rect.mLeft); } |