]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Small cleanup + comment
authorterencehill <piuntn@gmail.com>
Sun, 14 Aug 2011 17:43:00 +0000 (19:43 +0200)
committerterencehill <piuntn@gmail.com>
Sun, 14 Aug 2011 17:43:00 +0000 (19:43 +0200)
qcsrc/menu/item/image.c

index 1d94381a54dc25697aaa0d1459ad392e499bf060..c2a5e70b6f7e0153a7dff625eb7f549af986f0fd 100644 (file)
@@ -159,13 +159,18 @@ void Image_setZoom(entity me, float z, float atMousePosition)
        else // directly set
                me.zoomFactor = z;
        me.zoomFactor = bound(1/16, me.zoomFactor, 16);
-       if (atMousePosition && prev_zoomFactor != me.zoomFactor)
-       {
-               me.zoomOffset_x = me.start_zoomOffset_x + (me.start_coords_x - 0.5) / me.imgSize_x;
-               me.zoomOffset_y = me.start_zoomOffset_y + (me.start_coords_y - 0.5) / me.imgSize_y;
-       }
        if (prev_zoomFactor != me.zoomFactor)
+       {
                me.zoomTime = time;
+               if (atMousePosition)
+               {
+                       me.zoomOffset_x = me.start_zoomOffset_x + (me.start_coords_x - 0.5) / me.imgSize_x;
+                       me.zoomOffset_y = me.start_zoomOffset_y + (me.start_coords_y - 0.5) / me.imgSize_y;
+                       // updateAspect will reset however zoomOffset to '0.5 0.5 0' if with
+                       // this zoomFactor the image will not be zoomed (updateAspect will check
+                       // the new values of imgSize).
+               }
+       }
        me.updateAspect(me);
 }
 void Image_resizeNotify(entity me, vector relOrigin, vector relSize, vector absOrigin, vector absSize)