Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2014-01-15 03:03:56 +0400
committerCampbell Barton <ideasman42@gmail.com>2014-01-15 03:06:12 +0400
commitcc978dc0c128f455145daf6d693ef0e571d22988 (patch)
tree5011ead33ed82ac4b8d73cf2ac4a2be6bd559e79 /source/blender/editors/interface
parent9e3ddd70d492443e122bdf4460420fa2fa0e9dd8 (diff)
Fix for minor precision glitch while zooming on clamped view2d
Diffstat (limited to 'source/blender/editors/interface')
-rw-r--r--source/blender/editors/interface/view2d.c21
1 files changed, 12 insertions, 9 deletions
diff --git a/source/blender/editors/interface/view2d.c b/source/blender/editors/interface/view2d.c
index f74e7dc0a1d..e88e7e3e7af 100644
--- a/source/blender/editors/interface/view2d.c
+++ b/source/blender/editors/interface/view2d.c
@@ -404,23 +404,26 @@ static void ui_view2d_curRect_validate_resize(View2D *v2d, int resize, int mask_
* NOTE: in general, it is not expected that the lock-zoom will be used in conjunction with this
*/
else if (v2d->keepzoom & V2D_LIMITZOOM) {
- float zoom, fac;
/* check if excessive zoom on x-axis */
if ((v2d->keepzoom & V2D_LOCKZOOM_X) == 0) {
- zoom = winx / width;
- if ((zoom < v2d->minzoom) || (zoom > v2d->maxzoom)) {
- fac = (zoom < v2d->minzoom) ? (zoom / v2d->minzoom) : (zoom / v2d->maxzoom);
- width *= fac;
+ const float zoom = winx / width;
+ if (zoom < v2d->minzoom) {
+ width = winx / v2d->minzoom;
+ }
+ else if (zoom > v2d->maxzoom) {
+ width = winx / v2d->maxzoom;
}
}
/* check if excessive zoom on y-axis */
if ((v2d->keepzoom & V2D_LOCKZOOM_Y) == 0) {
- zoom = winy / height;
- if ((zoom < v2d->minzoom) || (zoom > v2d->maxzoom)) {
- fac = (zoom < v2d->minzoom) ? (zoom / v2d->minzoom) : (zoom / v2d->maxzoom);
- height *= fac;
+ const float zoom = winy / height;
+ if (zoom < v2d->minzoom) {
+ height = winy / v2d->minzoom;
+ }
+ else if (zoom > v2d->maxzoom) {
+ height = winy / v2d->maxzoom;
}
}
}