Skip to content

Commit 6ca4f83

Browse files
committed
Zoom in after completely zooming out
1 parent 816038f commit 6ca4f83

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

labelme/app.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# -*- coding: utf-8 -*-
22

33
import functools
4+
import math
45
import os
56
import os.path as osp
67
import re
@@ -1331,7 +1332,12 @@ def setZoom(self, value):
13311332
self.zoom_values[self.filename] = (self.zoomMode, value)
13321333

13331334
def addZoom(self, increment=1.1):
1334-
self.setZoom(self.zoomWidget.value() * increment)
1335+
zoom_value = self.zoomWidget.value() * increment
1336+
if increment > 1:
1337+
zoom_value = math.ceil(zoom_value)
1338+
else:
1339+
zoom_value = math.floor(zoom_value)
1340+
self.setZoom(zoom_value)
13351341

13361342
def zoomRequest(self, delta, pos):
13371343
canvas_width_old = self.canvas.width()

0 commit comments

Comments
 (0)