Fix calculation of marks for library grid scale (close #55)
This commit is contained in:
parent
647ae01340
commit
59e276a830
1 changed files with 4 additions and 4 deletions
|
@ -1514,7 +1514,7 @@ class LibraryPanel(GObject.GObject):
|
|||
return
|
||||
self._allocation = new_allocation
|
||||
self._grid_scale.clear_marks()
|
||||
width = widget.get_allocation().width - 12
|
||||
width = widget.get_allocation().width
|
||||
|
||||
lower = int(self._grid_adjustment.get_lower())
|
||||
upper = int(self._grid_adjustment.get_upper())
|
||||
|
@ -1522,7 +1522,7 @@ class LibraryPanel(GObject.GObject):
|
|||
countMax = max(int(width / lower), 1)
|
||||
for index in range(countMin, countMax):
|
||||
pixel = int(width / index)
|
||||
pixel = pixel - int(pixel / 100)
|
||||
pixel = pixel - (2 * int(pixel / 100))
|
||||
self._grid_scale.add_mark(
|
||||
pixel,
|
||||
Gtk.PositionType.BOTTOM,
|
||||
|
@ -1546,13 +1546,13 @@ class LibraryPanel(GObject.GObject):
|
|||
|
||||
|
||||
def on_grid_scale_change(self, widget, scroll, value):
|
||||
size = round(value)
|
||||
size = math.floor(value)
|
||||
range = self._grid_scale.get_adjustment()
|
||||
if size < range.get_lower() or size > range.get_upper():
|
||||
return
|
||||
self._item_size = size
|
||||
GObject.idle_add(self._set_widget_grid_size, self._library_grid, size, True)
|
||||
GObject.idle_add(self._library_grid.set_item_padding, size / 100)
|
||||
GObject.idle_add(self._set_widget_grid_size, self._library_grid, size, True)
|
||||
|
||||
|
||||
def on_grid_scale_changed(self, widget, event):
|
||||
|
|
Loading…
Reference in a new issue