Skip to content

Commit

Permalink
Fix zoom
Browse files Browse the repository at this point in the history
  • Loading branch information
centaurialpha committed Jun 23, 2019
1 parent f7692eb commit e96a95e
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions ninja_ide/gui/editor/editor.py
Original file line number Diff line number Diff line change
Expand Up @@ -585,8 +585,16 @@ def go_to_line(self, lineno):
lineno).position())
self.setTextCursor(cursor)

def zoom(self, delta: int):
font = self.document().defaultFont()
previous_point_size = font.pointSize()
new_point_size = int(max(1, previous_point_size + delta))
if new_point_size != previous_point_size:
font.setPointSize(new_point_size)
self.set_font(font.family(), font.pointSize())

def zoom_in(self):
self.zoomIn(1)
self.zoom(1)
# font = self.document().defaultFont()
# size = font.pointSize()
# if size < settings.FONT_MAX_SIZE:
Expand All @@ -596,7 +604,7 @@ def zoom_in(self):
# self._update_margin_line(font)

def zoom_out(self):
self.zoomOut(1)
self.zoom(-1)
# font = self.document().defaultFont()
# size = font.pointSize()
# if size > settings.FONT_MIN_SIZE:
Expand Down

0 comments on commit e96a95e

Please sign in to comment.