fix for UI scale != 1.0 breaking edit tools, web browser, world view rect, etc.
parent
81b64fd88b
commit
b38ca5ec32
|
|
@ -127,7 +127,7 @@ void LLChannelManager::onLoginCompleted()
|
|||
gViewerWindow->getRootView()->addChild(mStartUpChannel);
|
||||
|
||||
// init channel's position and size
|
||||
S32 channel_right_bound = gViewerWindow->getWorldViewRectRaw().mRight - gSavedSettings.getS32("NotificationChannelRightMargin");
|
||||
S32 channel_right_bound = gViewerWindow->getWorldViewRectScaled().mRight - gSavedSettings.getS32("NotificationChannelRightMargin");
|
||||
S32 channel_width = gSavedSettings.getS32("NotifyBoxWidth");
|
||||
mStartUpChannel->init(channel_right_bound - channel_width, channel_right_bound);
|
||||
mStartUpChannel->setMouseDownCallback(boost::bind(&LLSysWellWindow::onStartUpToastClick, LLFloaterReg::getTypedInstance<LLSysWellWindow>("syswell_window"), _2, _3, _4));
|
||||
|
|
|
|||
|
|
@ -358,7 +358,7 @@ LLIMFloater* LLIMFloater::show(const LLUUID& session_id)
|
|||
|
||||
void LLIMFloater::getAllowedRect(LLRect& rect)
|
||||
{
|
||||
rect = gViewerWindow->getWorldViewRectRaw();
|
||||
rect = gViewerWindow->getWorldViewRectScaled();
|
||||
}
|
||||
|
||||
void LLIMFloater::setDocked(bool docked, bool pop_on_undock)
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ LLIMHandler::~LLIMHandler()
|
|||
//--------------------------------------------------------------------------
|
||||
void LLIMHandler::initChannel()
|
||||
{
|
||||
S32 channel_right_bound = gViewerWindow->getWorldViewRectRaw().mRight - gSavedSettings.getS32("NotificationChannelRightMargin");
|
||||
S32 channel_right_bound = gViewerWindow->getWorldViewRectScaled().mRight - gSavedSettings.getS32("NotificationChannelRightMargin");
|
||||
S32 channel_width = gSavedSettings.getS32("NotifyBoxWidth");
|
||||
mChannel->init(channel_right_bound - channel_width, channel_right_bound);
|
||||
}
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
|
|
@ -265,8 +265,8 @@ BOOL LLManip::getMousePointOnPlaneGlobal(LLVector3d& point, S32 x, S32 y, LLVect
|
|||
if (mObjectSelection->getSelectType() == SELECT_TYPE_HUD)
|
||||
{
|
||||
BOOL result = FALSE;
|
||||
F32 mouse_x = ((F32)x / gViewerWindow->getWindowWidthScaled() - 0.5f) * LLViewerCamera::getInstance()->getAspect() / gAgent.mHUDCurZoom;
|
||||
F32 mouse_y = ((F32)y / gViewerWindow->getWindowHeightScaled() - 0.5f) / gAgent.mHUDCurZoom;
|
||||
F32 mouse_x = ((F32)x / gViewerWindow->getWorldViewWidthScaled() - 0.5f) * LLViewerCamera::getInstance()->getAspect() / gAgent.mHUDCurZoom;
|
||||
F32 mouse_y = ((F32)y / gViewerWindow->getWorldViewHeightScaled() - 0.5f) / gAgent.mHUDCurZoom;
|
||||
|
||||
LLVector3 origin_agent = gAgent.getPosAgentFromGlobal(origin);
|
||||
LLVector3 mouse_pos = LLVector3(0.f, -mouse_x, mouse_y);
|
||||
|
|
|
|||
|
|
@ -1107,8 +1107,11 @@ BOOL LLManipRotate::updateVisiblity()
|
|||
mCenterToProfilePlaneMag = mRadiusMeters * mRadiusMeters / mCenterToCamMag;
|
||||
mCenterToProfilePlane = -mCenterToProfilePlaneMag * mCenterToCamNorm;
|
||||
|
||||
mCenterScreen.set((S32)((0.5f - mRotationCenter.mdV[VY]) / gAgent.mHUDCurZoom * gViewerWindow->getWorldViewWidthRaw()),
|
||||
(S32)((mRotationCenter.mdV[VZ] + 0.5f) / gAgent.mHUDCurZoom * gViewerWindow->getWorldViewHeightRaw()));
|
||||
// x axis range is (-aspect * 0.5f, +aspect * 0.5)
|
||||
// y axis range is (-0.5, 0.5)
|
||||
// so use getWorldViewHeightRaw as scale factor when converting to pixel coordinates
|
||||
mCenterScreen.set((S32)((0.5f - center.mV[VY]) / gAgent.mHUDCurZoom * gViewerWindow->getWorldViewHeightScaled()),
|
||||
(S32)((center.mV[VZ] + 0.5f) / gAgent.mHUDCurZoom * gViewerWindow->getWorldViewHeightScaled()));
|
||||
visible = TRUE;
|
||||
}
|
||||
else
|
||||
|
|
@ -1624,8 +1627,8 @@ void LLManipRotate::mouseToRay( S32 x, S32 y, LLVector3* ray_pt, LLVector3* ray_
|
|||
{
|
||||
if (LLSelectMgr::getInstance()->getSelection()->getSelectType() == SELECT_TYPE_HUD)
|
||||
{
|
||||
F32 mouse_x = (((F32)x / gViewerWindow->getWorldViewWidthRaw()) - 0.5f) / gAgent.mHUDCurZoom;
|
||||
F32 mouse_y = ((((F32)y) / gViewerWindow->getWorldViewHeightRaw()) - 0.5f) / gAgent.mHUDCurZoom;
|
||||
F32 mouse_x = (((F32)x / gViewerWindow->getWorldViewRectScaled().getWidth()) - 0.5f) / gAgent.mHUDCurZoom;
|
||||
F32 mouse_y = ((((F32)y) / gViewerWindow->getWorldViewRectScaled().getHeight()) - 0.5f) / gAgent.mHUDCurZoom;
|
||||
|
||||
*ray_pt = LLVector3(-1.f, -mouse_x, mouse_y);
|
||||
*ray_dir = LLVector3(1.f, 0.f, 0.f);
|
||||
|
|
@ -1699,7 +1702,7 @@ void LLManipRotate::highlightManipulators( S32 x, S32 y )
|
|||
F32 dist_y = mouse_dir_y.normVec();
|
||||
F32 dist_z = mouse_dir_z.normVec();
|
||||
|
||||
F32 distance_threshold = (MAX_MANIP_SELECT_DISTANCE * mRadiusMeters) / gViewerWindow->getWorldViewHeightRaw();
|
||||
F32 distance_threshold = (MAX_MANIP_SELECT_DISTANCE * mRadiusMeters) / gViewerWindow->getWorldViewHeightScaled();
|
||||
|
||||
if (llabs(dist_x - mRadiusMeters) * llmax(0.05f, proj_rot_x_axis) < distance_threshold)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -101,17 +101,17 @@ LLMediaCtrl::LLMediaCtrl( const Params& p) :
|
|||
setCaretColor( (unsigned int)color.mV[0], (unsigned int)color.mV[1], (unsigned int)color.mV[2] );
|
||||
}
|
||||
|
||||
setIgnoreUIScale(p.ignore_ui_scale());
|
||||
setIgnoreUIScale(p.ignore_ui_scale);
|
||||
|
||||
setHomePageUrl(p.start_url());
|
||||
setHomePageUrl(p.start_url);
|
||||
|
||||
setBorderVisible(p.border_visible());
|
||||
setBorderVisible(p.border_visible);
|
||||
|
||||
mHideLoading = p.hide_loading();
|
||||
mHideLoading = p.hide_loading;
|
||||
|
||||
setDecoupleTextureSize(p.decouple_texture_size());
|
||||
setDecoupleTextureSize(p.decouple_texture_size);
|
||||
|
||||
setTextureSize(p.texture_width(), p.texture_height());
|
||||
setTextureSize(p.texture_width, p.texture_height);
|
||||
|
||||
if(!getDecoupleTextureSize())
|
||||
{
|
||||
|
|
@ -723,13 +723,13 @@ void LLMediaCtrl::draw()
|
|||
{
|
||||
// max width, adjusted height
|
||||
width = r.getWidth();
|
||||
height = llmin(llmax(S32(width / media_aspect), 0), r.getHeight());
|
||||
height = llmin(llmax(llround(width / media_aspect), 0), r.getHeight());
|
||||
}
|
||||
else
|
||||
{
|
||||
// max height, adjusted width
|
||||
height = r.getHeight();
|
||||
width = llmin(llmax(S32(height * media_aspect), 0), r.getWidth());
|
||||
width = llmin(llmax(llround(height * media_aspect), 0), r.getWidth());
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
@ -747,6 +747,14 @@ void LLMediaCtrl::draw()
|
|||
x_offset = (r.getWidth() - width) / 2;
|
||||
y_offset = (r.getHeight() - height) / 2;
|
||||
|
||||
if(mIgnoreUIScale)
|
||||
{
|
||||
x_offset = llround((F32)x_offset * LLUI::sGLScaleFactor.mV[VX]);
|
||||
y_offset = llround((F32)y_offset * LLUI::sGLScaleFactor.mV[VY]);
|
||||
width = llround((F32)width * LLUI::sGLScaleFactor.mV[VX]);
|
||||
height = llround((F32)height * LLUI::sGLScaleFactor.mV[VY]);
|
||||
}
|
||||
|
||||
// draw the browser
|
||||
gGL.setSceneBlendType(LLRender::BT_REPLACE);
|
||||
gGL.begin( LLRender::QUADS );
|
||||
|
|
|
|||
|
|
@ -201,7 +201,7 @@ void LLNearbyChat::setRect (const LLRect &rect)
|
|||
|
||||
void LLNearbyChat::getAllowedRect(LLRect& rect)
|
||||
{
|
||||
rect = gViewerWindow->getWorldViewRectRaw();
|
||||
rect = gViewerWindow->getWorldViewRectScaled();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -66,7 +66,7 @@ LLAlertHandler::~LLAlertHandler()
|
|||
//--------------------------------------------------------------------------
|
||||
void LLAlertHandler::initChannel()
|
||||
{
|
||||
S32 channel_right_bound = gViewerWindow->getWorldViewRectRaw().getWidth() / 2;
|
||||
S32 channel_right_bound = gViewerWindow->getWorldViewRectScaled().getWidth() / 2;
|
||||
mChannel->init(channel_right_bound, channel_right_bound);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@ LLGroupHandler::~LLGroupHandler()
|
|||
//--------------------------------------------------------------------------
|
||||
void LLGroupHandler::initChannel()
|
||||
{
|
||||
S32 channel_right_bound = gViewerWindow->getWorldViewRectRaw().mRight - gSavedSettings.getS32("NotificationChannelRightMargin");
|
||||
S32 channel_right_bound = gViewerWindow->getWorldViewRectScaled().mRight - gSavedSettings.getS32("NotificationChannelRightMargin");
|
||||
S32 channel_width = gSavedSettings.getS32("NotifyBoxWidth");
|
||||
mChannel->init(channel_right_bound - channel_width, channel_right_bound);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -65,7 +65,7 @@ LLOfferHandler::~LLOfferHandler()
|
|||
//--------------------------------------------------------------------------
|
||||
void LLOfferHandler::initChannel()
|
||||
{
|
||||
S32 channel_right_bound = gViewerWindow->getWorldViewRectRaw().mRight - gSavedSettings.getS32("NotificationChannelRightMargin");
|
||||
S32 channel_right_bound = gViewerWindow->getWorldViewRectScaled().mRight - gSavedSettings.getS32("NotificationChannelRightMargin");
|
||||
S32 channel_width = gSavedSettings.getS32("NotifyBoxWidth");
|
||||
mChannel->init(channel_right_bound - channel_width, channel_right_bound);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -64,7 +64,7 @@ LLScriptHandler::~LLScriptHandler()
|
|||
//--------------------------------------------------------------------------
|
||||
void LLScriptHandler::initChannel()
|
||||
{
|
||||
S32 channel_right_bound = gViewerWindow->getWorldViewRectRaw().mRight - gSavedSettings.getS32("NotificationChannelRightMargin");
|
||||
S32 channel_right_bound = gViewerWindow->getWorldViewRectScaled().mRight - gSavedSettings.getS32("NotificationChannelRightMargin");
|
||||
S32 channel_width = gSavedSettings.getS32("NotifyBoxWidth");
|
||||
mChannel->init(channel_right_bound - channel_width, channel_right_bound);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -60,7 +60,7 @@ LLTipHandler::~LLTipHandler()
|
|||
//--------------------------------------------------------------------------
|
||||
void LLTipHandler::initChannel()
|
||||
{
|
||||
S32 channel_right_bound = gViewerWindow->getWorldViewRectRaw().mRight - gSavedSettings.getS32("NotificationChannelRightMargin");
|
||||
S32 channel_right_bound = gViewerWindow->getWorldViewRectScaled().mRight - gSavedSettings.getS32("NotificationChannelRightMargin");
|
||||
S32 channel_width = gSavedSettings.getS32("NotifyBoxWidth");
|
||||
mChannel->init(channel_right_bound - channel_width, channel_right_bound);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -103,8 +103,8 @@ void LLScreenChannelBase::updatePositionAndSize(LLRect old_world_rect, LLRect ne
|
|||
|
||||
void LLScreenChannelBase::init(S32 channel_left, S32 channel_right)
|
||||
{
|
||||
S32 channel_top = gViewerWindow->getWorldViewRectRaw().getHeight();
|
||||
S32 channel_bottom = gViewerWindow->getWorldViewRectRaw().mBottom + gSavedSettings.getS32("ChannelBottomPanelMargin");
|
||||
S32 channel_top = gViewerWindow->getWorldViewRectScaled().getHeight();
|
||||
S32 channel_bottom = gViewerWindow->getWorldViewRectScaled().mBottom + gSavedSettings.getS32("ChannelBottomPanelMargin");
|
||||
setRect(LLRect(channel_left, channel_top, channel_right, channel_bottom));
|
||||
setVisible(TRUE);
|
||||
}
|
||||
|
|
@ -710,7 +710,7 @@ void LLScreenChannel::updateShowToastsState()
|
|||
// for Message Well floater showed in a docked state - adjust channel's height
|
||||
if(dynamic_cast<LLSysWellWindow*>(floater))
|
||||
{
|
||||
S32 channel_bottom = gViewerWindow->getWorldViewRectRaw().mBottom + gSavedSettings.getS32("ChannelBottomPanelMargin");;
|
||||
S32 channel_bottom = gViewerWindow->getWorldViewRectScaled().mBottom + gSavedSettings.getS32("ChannelBottomPanelMargin");;
|
||||
LLRect this_rect = getRect();
|
||||
if(floater->getVisible() && floater->isDocked())
|
||||
{
|
||||
|
|
|
|||
|
|
@ -238,7 +238,7 @@ void LLSysWellWindow::initChannel()
|
|||
//---------------------------------------------------------------------------------
|
||||
void LLSysWellWindow::getAllowedRect(LLRect& rect)
|
||||
{
|
||||
rect = gViewerWindow->getWorldViewRectRaw();
|
||||
rect = gViewerWindow->getWorldViewRectScaled();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -365,7 +365,7 @@ BOOL LLToolCamera::handleHover(S32 x, S32 y, MASK mask)
|
|||
// Orbit tool
|
||||
if (hasMouseCapture())
|
||||
{
|
||||
const F32 RADIANS_PER_PIXEL = 360.f * DEG_TO_RAD / gViewerWindow->getWorldViewWidthRaw();
|
||||
const F32 RADIANS_PER_PIXEL = 360.f * DEG_TO_RAD / gViewerWindow->getWorldViewWidthScaled();
|
||||
|
||||
if (dx != 0)
|
||||
{
|
||||
|
|
@ -393,7 +393,7 @@ BOOL LLToolCamera::handleHover(S32 x, S32 y, MASK mask)
|
|||
F32 dist = (F32) camera_to_focus.normVec();
|
||||
|
||||
// Fudge factor for pan
|
||||
F32 meters_per_pixel = 3.f * dist / gViewerWindow->getWorldViewWidthRaw();
|
||||
F32 meters_per_pixel = 3.f * dist / gViewerWindow->getWorldViewWidthScaled();
|
||||
|
||||
if (dx != 0)
|
||||
{
|
||||
|
|
@ -415,7 +415,7 @@ BOOL LLToolCamera::handleHover(S32 x, S32 y, MASK mask)
|
|||
if (hasMouseCapture())
|
||||
{
|
||||
|
||||
const F32 RADIANS_PER_PIXEL = 360.f * DEG_TO_RAD / gViewerWindow->getWorldViewWidthRaw();
|
||||
const F32 RADIANS_PER_PIXEL = 360.f * DEG_TO_RAD / gViewerWindow->getWorldViewWidthScaled();
|
||||
|
||||
if (dx != 0)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -510,8 +510,8 @@ void LLToolGrab::handleHoverActive(S32 x, S32 y, MASK mask)
|
|||
const F32 RADIANS_PER_PIXEL_X = 0.01f;
|
||||
const F32 RADIANS_PER_PIXEL_Y = 0.01f;
|
||||
|
||||
S32 dx = x - (gViewerWindow->getWorldViewWidthRaw() / 2);
|
||||
S32 dy = y - (gViewerWindow->getWorldViewHeightRaw() / 2);
|
||||
S32 dx = x - (gViewerWindow->getWorldViewWidthScaled() / 2);
|
||||
S32 dy = y - (gViewerWindow->getWorldViewHeightScaled() / 2);
|
||||
|
||||
if (dx != 0 || dy != 0)
|
||||
{
|
||||
|
|
@ -631,10 +631,10 @@ void LLToolGrab::handleHoverActive(S32 x, S32 y, MASK mask)
|
|||
// Handle auto-rotation at screen edge.
|
||||
LLVector3 grab_pos_agent = gAgent.getPosAgentFromGlobal( grab_point_global );
|
||||
|
||||
LLCoordGL grab_center_gl( gViewerWindow->getWorldViewWidthRaw() / 2, gViewerWindow->getWorldViewHeightRaw() / 2);
|
||||
LLCoordGL grab_center_gl( gViewerWindow->getWorldViewWidthScaled() / 2, gViewerWindow->getWorldViewHeightScaled() / 2);
|
||||
LLViewerCamera::getInstance()->projectPosAgentToScreen(grab_pos_agent, grab_center_gl);
|
||||
|
||||
const S32 ROTATE_H_MARGIN = gViewerWindow->getWorldViewWidthRaw() / 20;
|
||||
const S32 ROTATE_H_MARGIN = gViewerWindow->getWorldViewWidthScaled() / 20;
|
||||
const F32 ROTATE_ANGLE_PER_SECOND = 30.f * DEG_TO_RAD;
|
||||
const F32 rotate_angle = ROTATE_ANGLE_PER_SECOND / gFPSClamped;
|
||||
// ...build mode moves camera about focus point
|
||||
|
|
@ -649,7 +649,7 @@ void LLToolGrab::handleHoverActive(S32 x, S32 y, MASK mask)
|
|||
gAgent.cameraOrbitAround(rotate_angle);
|
||||
}
|
||||
}
|
||||
else if (grab_center_gl.mX > gViewerWindow->getWorldViewWidthRaw() - ROTATE_H_MARGIN)
|
||||
else if (grab_center_gl.mX > gViewerWindow->getWorldViewWidthScaled() - ROTATE_H_MARGIN)
|
||||
{
|
||||
if (gAgent.getFocusOnAvatar())
|
||||
{
|
||||
|
|
@ -662,7 +662,7 @@ void LLToolGrab::handleHoverActive(S32 x, S32 y, MASK mask)
|
|||
}
|
||||
|
||||
// Don't move above top of screen or below bottom
|
||||
if ((grab_center_gl.mY < gViewerWindow->getWorldViewHeightRaw() - 6)
|
||||
if ((grab_center_gl.mY < gViewerWindow->getWorldViewHeightScaled() - 6)
|
||||
&& (grab_center_gl.mY > 24))
|
||||
{
|
||||
// Transmit update to simulator
|
||||
|
|
@ -893,7 +893,7 @@ void LLToolGrab::handleHoverInactive(S32 x, S32 y, MASK mask)
|
|||
gAgent.yaw(rotate_angle);
|
||||
//gAgent.setControlFlags(AGENT_CONTROL_YAW_POS);
|
||||
}
|
||||
else if (x == (gViewerWindow->getWorldViewWidthRaw() - 1) )
|
||||
else if (x == (gViewerWindow->getWorldViewWidthScaled() - 1) )
|
||||
{
|
||||
gAgent.yaw(-rotate_angle);
|
||||
//gAgent.setControlFlags(AGENT_CONTROL_YAW_NEG);
|
||||
|
|
|
|||
|
|
@ -485,7 +485,7 @@ BOOL LLViewerCamera::projectPosAgentToScreen(const LLVector3 &pos_agent, LLCoord
|
|||
y /= gViewerWindow->getDisplayScale().mV[VY];
|
||||
|
||||
// should now have the x,y coords of grab_point in screen space
|
||||
LLRect world_view_rect = gViewerWindow->getWorldViewRectScaled();
|
||||
LLRect world_rect = gViewerWindow->getWorldViewRectScaled();
|
||||
|
||||
// convert to pixel coordinates
|
||||
S32 int_x = lltrunc(x);
|
||||
|
|
@ -495,14 +495,14 @@ BOOL LLViewerCamera::projectPosAgentToScreen(const LLVector3 &pos_agent, LLCoord
|
|||
|
||||
if (clamp)
|
||||
{
|
||||
if (int_x < world_view_rect.mLeft)
|
||||
if (int_x < world_rect.mLeft)
|
||||
{
|
||||
out_point.mX = world_view_rect.mLeft;
|
||||
out_point.mX = world_rect.mLeft;
|
||||
valid = FALSE;
|
||||
}
|
||||
else if (int_x > world_view_rect.mRight)
|
||||
else if (int_x > world_rect.mRight)
|
||||
{
|
||||
out_point.mX = world_view_rect.mRight;
|
||||
out_point.mX = world_rect.mRight;
|
||||
valid = FALSE;
|
||||
}
|
||||
else
|
||||
|
|
@ -510,14 +510,14 @@ BOOL LLViewerCamera::projectPosAgentToScreen(const LLVector3 &pos_agent, LLCoord
|
|||
out_point.mX = int_x;
|
||||
}
|
||||
|
||||
if (int_y < world_view_rect.mBottom)
|
||||
if (int_y < world_rect.mBottom)
|
||||
{
|
||||
out_point.mY = world_view_rect.mBottom;
|
||||
out_point.mY = world_rect.mBottom;
|
||||
valid = FALSE;
|
||||
}
|
||||
else if (int_y > world_view_rect.mTop)
|
||||
else if (int_y > world_rect.mTop)
|
||||
{
|
||||
out_point.mY = world_view_rect.mTop;
|
||||
out_point.mY = world_rect.mTop;
|
||||
valid = FALSE;
|
||||
}
|
||||
else
|
||||
|
|
@ -531,19 +531,19 @@ BOOL LLViewerCamera::projectPosAgentToScreen(const LLVector3 &pos_agent, LLCoord
|
|||
out_point.mX = int_x;
|
||||
out_point.mY = int_y;
|
||||
|
||||
if (int_x < world_view_rect.mLeft)
|
||||
if (int_x < world_rect.mLeft)
|
||||
{
|
||||
valid = FALSE;
|
||||
}
|
||||
else if (int_x > world_view_rect.mRight)
|
||||
else if (int_x > world_rect.mRight)
|
||||
{
|
||||
valid = FALSE;
|
||||
}
|
||||
if (int_y < world_view_rect.mBottom)
|
||||
if (int_y < world_rect.mBottom)
|
||||
{
|
||||
valid = FALSE;
|
||||
}
|
||||
else if (int_y > world_view_rect.mTop)
|
||||
else if (int_y > world_rect.mTop)
|
||||
{
|
||||
valid = FALSE;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2277,7 +2277,7 @@ void LLViewerWindow::handleScrollWheel(S32 clicks)
|
|||
|
||||
// Zoom the camera in and out behavior
|
||||
|
||||
if(top_ctrl == 0 && mWorldViewRectRaw.pointInRect(mCurrentMousePoint.mX, mCurrentMousePoint.mY) )
|
||||
if(top_ctrl == 0 && getWorldViewRectScaled().pointInRect(mCurrentMousePoint.mX, mCurrentMousePoint.mY) )
|
||||
gAgent.handleScrollWheel(clicks);
|
||||
|
||||
return;
|
||||
|
|
@ -2285,8 +2285,8 @@ void LLViewerWindow::handleScrollWheel(S32 clicks)
|
|||
|
||||
void LLViewerWindow::moveCursorToCenter()
|
||||
{
|
||||
S32 x = mWorldViewRectRaw.getWidth() / 2;
|
||||
S32 y = mWorldViewRectRaw.getHeight() / 2;
|
||||
S32 x = getWorldViewWidthScaled() / 2;
|
||||
S32 y = getWorldViewHeightScaled() / 2;
|
||||
|
||||
//on a forced move, all deltas get zeroed out to prevent jumping
|
||||
mCurrentMousePoint.set(x,y);
|
||||
|
|
@ -2857,6 +2857,11 @@ void LLViewerWindow::updateWorldViewRect(bool use_full_window)
|
|||
// clamp to at least a 1x1 rect so we don't try to allocate zero width gl buffers
|
||||
new_world_rect.mTop = llmax(new_world_rect.mTop, new_world_rect.mBottom + 1);
|
||||
new_world_rect.mRight = llmax(new_world_rect.mRight, new_world_rect.mLeft + 1);
|
||||
|
||||
new_world_rect.mLeft = llround((F32)new_world_rect.mLeft * mDisplayScale.mV[VX]);
|
||||
new_world_rect.mRight = llround((F32)new_world_rect.mRight * mDisplayScale.mV[VX]);
|
||||
new_world_rect.mBottom = llround((F32)new_world_rect.mBottom * mDisplayScale.mV[VY]);
|
||||
new_world_rect.mTop = llround((F32)new_world_rect.mTop * mDisplayScale.mV[VY]);
|
||||
}
|
||||
|
||||
if (mWorldViewRectRaw != new_world_rect)
|
||||
|
|
@ -2868,6 +2873,12 @@ void LLViewerWindow::updateWorldViewRect(bool use_full_window)
|
|||
gResizeScreenTexture = TRUE;
|
||||
LLViewerCamera::getInstance()->setViewHeightInPixels( mWorldViewRectRaw.getHeight() );
|
||||
LLViewerCamera::getInstance()->setAspect( getWorldViewAspectRatio() );
|
||||
|
||||
mWorldViewRectScaled = mWorldViewRectRaw;
|
||||
mWorldViewRectScaled.mLeft = llround((F32)mWorldViewRectScaled.mLeft / mDisplayScale.mV[VX]);
|
||||
mWorldViewRectScaled.mRight = llround((F32)mWorldViewRectScaled.mRight / mDisplayScale.mV[VX]);
|
||||
mWorldViewRectScaled.mBottom = llround((F32)mWorldViewRectScaled.mBottom / mDisplayScale.mV[VY]);
|
||||
mWorldViewRectScaled.mTop = llround((F32)mWorldViewRectScaled.mTop / mDisplayScale.mV[VY]);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -3139,10 +3150,10 @@ void LLViewerWindow::pickAsync(S32 x, S32 y_from_bot, MASK mask, void (*callback
|
|||
{
|
||||
mPickScreenRegion.setCenterAndSize(x, y_from_bot, PICK_DIAMETER, PICK_DIAMETER);
|
||||
|
||||
if (mPickScreenRegion.mLeft < mWorldViewRectRaw.mLeft) mPickScreenRegion.translate(mWorldViewRectRaw.mLeft - mPickScreenRegion.mLeft, 0);
|
||||
if (mPickScreenRegion.mBottom < mWorldViewRectRaw.mBottom) mPickScreenRegion.translate(0, mWorldViewRectRaw.mBottom - mPickScreenRegion.mBottom);
|
||||
if (mPickScreenRegion.mRight > mWorldViewRectRaw.mRight ) mPickScreenRegion.translate(mWorldViewRectRaw.mRight - mPickScreenRegion.mRight, 0);
|
||||
if (mPickScreenRegion.mTop > mWorldViewRectRaw.mTop ) mPickScreenRegion.translate(0, mWorldViewRectRaw.mTop - mPickScreenRegion.mTop);
|
||||
if (mPickScreenRegion.mLeft < mWorldViewRectScaled.mLeft) mPickScreenRegion.translate(mWorldViewRectScaled.mLeft - mPickScreenRegion.mLeft, 0);
|
||||
if (mPickScreenRegion.mBottom < mWorldViewRectScaled.mBottom) mPickScreenRegion.translate(0, mWorldViewRectScaled.mBottom - mPickScreenRegion.mBottom);
|
||||
if (mPickScreenRegion.mRight > mWorldViewRectScaled.mRight ) mPickScreenRegion.translate(mWorldViewRectScaled.mRight - mPickScreenRegion.mRight, 0);
|
||||
if (mPickScreenRegion.mTop > mWorldViewRectScaled.mTop ) mPickScreenRegion.translate(0, mWorldViewRectScaled.mTop - mPickScreenRegion.mTop);
|
||||
}
|
||||
|
||||
// set frame buffer region for picking results
|
||||
|
|
@ -3348,11 +3359,11 @@ LLVector3 LLViewerWindow::mouseDirectionGlobal(const S32 x, const S32 y) const
|
|||
F32 fov = LLViewerCamera::getInstance()->getView();
|
||||
|
||||
// find world view center in scaled ui coordinates
|
||||
F32 center_x = (F32)getWorldViewRectRaw().getCenterX() / mDisplayScale.mV[VX];
|
||||
F32 center_y = (F32)getWorldViewRectRaw().getCenterY() / mDisplayScale.mV[VY];
|
||||
F32 center_x = getWorldViewRectScaled().getCenterX();
|
||||
F32 center_y = getWorldViewRectScaled().getCenterY();
|
||||
|
||||
// calculate pixel distance to screen
|
||||
F32 distance = ((F32)getWorldViewHeightRaw() / (mDisplayScale.mV[VY] * 2.f)) / (tan(fov / 2.f));
|
||||
F32 distance = ((F32)getWorldViewHeightScaled() * 0.5f) / (tan(fov / 2.f));
|
||||
|
||||
// calculate click point relative to middle of screen
|
||||
F32 click_x = x - center_x;
|
||||
|
|
@ -3371,11 +3382,11 @@ LLVector3 LLViewerWindow::mouseDirectionGlobal(const S32 x, const S32 y) const
|
|||
LLVector3 LLViewerWindow::mousePointHUD(const S32 x, const S32 y) const
|
||||
{
|
||||
// find screen resolution
|
||||
S32 height = llround((F32)getWorldViewHeightRaw() / mDisplayScale.mV[VY]);
|
||||
S32 height = getWorldViewHeightScaled();
|
||||
|
||||
// find world view center
|
||||
F32 center_x = (F32)getWorldViewRectRaw().getCenterX() / mDisplayScale.mV[VX];
|
||||
F32 center_y = (F32)getWorldViewRectRaw().getCenterY() / mDisplayScale.mV[VY];
|
||||
F32 center_x = getWorldViewRectScaled().getCenterX();
|
||||
F32 center_y = getWorldViewRectScaled().getCenterY();
|
||||
|
||||
// remap with uniform scale (1/height) so that top is -0.5, bottom is +0.5
|
||||
F32 hud_x = -((F32)x - center_x) / height;
|
||||
|
|
@ -3393,12 +3404,12 @@ LLVector3 LLViewerWindow::mouseDirectionCamera(const S32 x, const S32 y) const
|
|||
F32 fov_width = fov_height * LLViewerCamera::getInstance()->getAspect();
|
||||
|
||||
// find screen resolution
|
||||
S32 height = llround((F32)getWorldViewHeightRaw() / mDisplayScale.mV[VY]);
|
||||
S32 width = llround((F32)getWorldViewWidthRaw() / mDisplayScale.mV[VX]);
|
||||
S32 height = getWorldViewHeightScaled();
|
||||
S32 width = getWorldViewWidthScaled();
|
||||
|
||||
// find world view center
|
||||
F32 center_x = (F32)getWorldViewRectRaw().getCenterX() / mDisplayScale.mV[VX];
|
||||
F32 center_y = (F32)getWorldViewRectRaw().getCenterY() / mDisplayScale.mV[VY];
|
||||
F32 center_x = getWorldViewRectScaled().getCenterX();
|
||||
F32 center_y = getWorldViewRectScaled().getCenterY();
|
||||
|
||||
// calculate click point relative to middle of screen
|
||||
F32 click_x = (((F32)x - center_x) / (F32)width) * fov_width * -1.f;
|
||||
|
|
@ -4165,14 +4176,20 @@ LLRootView* LLViewerWindow::getRootView() const
|
|||
|
||||
LLRect LLViewerWindow::getWorldViewRectScaled() const
|
||||
{
|
||||
LLRect world_view_rect = mWorldViewRectRaw;
|
||||
world_view_rect.mLeft = llround((F32)world_view_rect.mLeft / mDisplayScale.mV[VX]);
|
||||
world_view_rect.mRight = llround((F32)world_view_rect.mRight / mDisplayScale.mV[VX]);
|
||||
world_view_rect.mBottom = llround((F32)world_view_rect.mBottom / mDisplayScale.mV[VY]);
|
||||
world_view_rect.mTop = llround((F32)world_view_rect.mTop / mDisplayScale.mV[VY]);
|
||||
return world_view_rect;
|
||||
return mWorldViewRectScaled;
|
||||
}
|
||||
|
||||
S32 LLViewerWindow::getWorldViewHeightScaled() const
|
||||
{
|
||||
return mWorldViewRectScaled.getHeight();
|
||||
}
|
||||
|
||||
S32 LLViewerWindow::getWorldViewWidthScaled() const
|
||||
{
|
||||
return mWorldViewRectScaled.getWidth();
|
||||
}
|
||||
|
||||
|
||||
S32 LLViewerWindow::getWorldViewHeightRaw() const
|
||||
{
|
||||
return mWorldViewRectRaw.getHeight();
|
||||
|
|
|
|||
|
|
@ -212,6 +212,8 @@ public:
|
|||
|
||||
// 3D world area in scaled pixels (via UI scale), use for most UI computations
|
||||
LLRect getWorldViewRectScaled() const;
|
||||
S32 getWorldViewHeightScaled() const;
|
||||
S32 getWorldViewWidthScaled() const;
|
||||
|
||||
// 3D world area, in raw unscaled pixels
|
||||
LLRect getWorldViewRectRaw() const { return mWorldViewRectRaw; }
|
||||
|
|
@ -415,6 +417,7 @@ protected:
|
|||
LLRect mWindowRectRaw; // whole window, including UI
|
||||
LLRect mWindowRectScaled; // whole window, scaled by UI size
|
||||
LLRect mWorldViewRectRaw; // area of screen for 3D world
|
||||
LLRect mWorldViewRectScaled; // area of screen for 3D world scaled by UI size
|
||||
LLRootView* mRootView; // a view of size mWindowRectRaw, containing all child views
|
||||
LLVector2 mDisplayScale;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue