From: terencehill Date: Sun, 20 Jun 2010 13:11:46 +0000 (+0200) Subject: Put back checks of ratio in CheckResize algorithm. X-Git-Tag: xonotic-v0.1.0preview~457^2~69 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=1a40611ba411119d4cc4cddcc96a860282accf49;p=xonotic%2Fxonotic-data.pk3dir.git Put back checks of ratio in CheckResize algorithm. They are used to decide which side limits the resizing, not to keep the aspect ratio. --- diff --git a/qcsrc/client/hud.qc b/qcsrc/client/hud.qc index 41440c6d1..19932a3ec 100644 --- a/qcsrc/client/hud.qc +++ b/qcsrc/client/hud.qc @@ -913,7 +913,10 @@ vector HUD_Panel_CheckResize(float id, vector mySize, vector resizeorigin) { vector targPos; vector targSize; vector targEndPos; + vector dist; + float ratio; + ratio = mySize_x/mySize_y; for (i = 0; i < HUD_PANEL_NUM; ++i) { if(i == id || !HUD_Panel_CheckActive(i)) @@ -925,7 +928,7 @@ vector HUD_Panel_CheckResize(float id, vector mySize, vector resizeorigin) { targEndPos = targPos + targSize; // resizeorigin is WITHIN target panel, just abort any collision testing against that particular panel to produce expected behaviour! - if(resizeorigin_x > targPos_x && resizeorigin_x < targPos_x + targSize_x && resizeorigin_y > targPos_y && resizeorigin_y < targPos_y + targSize_y) + if(resizeorigin_x > targPos_x && resizeorigin_x < targEndPos_x && resizeorigin_y > targPos_y && resizeorigin_y < targEndPos_y) continue; if (resizeCorner == 1) @@ -948,7 +951,7 @@ vector HUD_Panel_CheckResize(float id, vector mySize, vector resizeorigin) { // in this case resizeorigin (bottom-right point) and the bottom-right point of the panel dist_x = resizeorigin_x - targEndPos_x; dist_y = resizeorigin_y - targEndPos_y; - if (dist_y < 0) + if (dist_y < 0 || dist_x / dist_y > ratio) mySize_x = min(mySize_x, dist_x); else mySize_y = min(mySize_y, dist_y); @@ -966,7 +969,7 @@ vector HUD_Panel_CheckResize(float id, vector mySize, vector resizeorigin) { dist_x = targPos_x - resizeorigin_x; dist_y = resizeorigin_y - targEndPos_y; - if (dist_y < 0) + if (dist_y < 0 || dist_x / dist_y > ratio) mySize_x = min(mySize_x, dist_x); else mySize_y = min(mySize_y, dist_y); @@ -984,7 +987,7 @@ vector HUD_Panel_CheckResize(float id, vector mySize, vector resizeorigin) { dist_x = resizeorigin_x - targEndPos_x; dist_y = targPos_y - resizeorigin_y; - if (dist_y < 0) + if (dist_y < 0 || dist_x / dist_y > ratio) mySize_x = min(mySize_x, dist_x); else mySize_y = min(mySize_y, dist_y); @@ -1002,7 +1005,7 @@ vector HUD_Panel_CheckResize(float id, vector mySize, vector resizeorigin) { dist_x = targPos_x - resizeorigin_x; dist_y = targPos_y - resizeorigin_y; - if (dist_y < 0) + if (dist_y < 0 || dist_x / dist_y > ratio) mySize_x = min(mySize_x, dist_x); else mySize_y = min(mySize_y, dist_y);