Fix pie menu selection range for UI scaling != 1.0

Fri, 15 Apr 2016 19:23:32 +0200

author
Ansariel
date
Fri, 15 Apr 2016 19:23:32 +0200
changeset 48946
7b33ffa61648
parent 48945
8e3e37734f4b
child 48947
e05528d6c2a7

Fix pie menu selection range for UI scaling != 1.0

indra/newview/piemenu.cpp file | annotate | diff | revisions
     1.1 --- a/indra/newview/piemenu.cpp	Fri Apr 15 18:30:37 2016 +0200
     1.2 +++ b/indra/newview/piemenu.cpp	Fri Apr 15 19:23:32 2016 +0200
     1.3 @@ -117,10 +117,8 @@
     1.4  	// initially, the current segment is marked as invalid
     1.5  	mCurrentSegment = -1;
     1.6  
     1.7 -	// remember to take the UI scaling into account
     1.8 -	LLVector2 scale = gViewerWindow->getDisplayScale();
     1.9  	// move mouse coordinates to be relative to the pie center
    1.10 -	LLVector2 mouseVector(x - PIE_OUTER_SIZE / scale.mV[VX], y - PIE_OUTER_SIZE / scale.mV[VY]);
    1.11 +	LLVector2 mouseVector(x - PIE_OUTER_SIZE, y - PIE_OUTER_SIZE);
    1.12  
    1.13  	// get the distance from the center point
    1.14  	F32 distance = mouseVector.length();
    1.15 @@ -187,9 +185,9 @@
    1.16  
    1.17  	// move the mouse pointer into the center of the menu
    1.18  	LLUI::setMousePositionLocal(getParent(), x, y);
    1.19 -	// set our drawing origin to the center of the menu, taking UI scale into account
    1.20 -	LLVector2 scale = gViewerWindow->getDisplayScale();
    1.21 -	setOrigin(x - PIE_OUTER_SIZE / scale.mV[VX], y - PIE_OUTER_SIZE / scale.mV[VY]);
    1.22 +	// set our drawing origin to the center of the menu
    1.23 +	setOrigin(x - PIE_OUTER_SIZE, y - PIE_OUTER_SIZE);
    1.24 +
    1.25  	// grab mouse control
    1.26  	gFocusMgr.setMouseCapture(this);
    1.27  
    1.28 @@ -290,8 +288,11 @@
    1.29  		borderColor %= 0.f;
    1.30  	}
    1.31  
    1.32 +	// remember to take the UI scaling into account
    1.33 +	LLVector2 scale = gViewerWindow->getDisplayScale();
    1.34 +
    1.35  	// move origin point to the center of our rectangle
    1.36 -	gGL.translatef(r.getWidth() / 2, r.getHeight() / 2, 0);
    1.37 +	gGL.translatef(r.getWidth() / 2 * scale.mV[VX], r.getHeight() / 2 * scale.mV[VY], 0);
    1.38  
    1.39  	// draw the general pie background
    1.40  	gl_washer_2d(PIE_OUTER_SIZE * factor, PIE_INNER_SIZE, 32, bgColor, borderColor);

mercurial