mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Cleanups
This commit is contained in:
parent
9b79b12239
commit
500ad8948e
@ -654,10 +654,7 @@ class SelectionBar:
|
|||||||
for h in (self.start_handle, self.end_handle):
|
for h in (self.start_handle, self.end_handle):
|
||||||
if h.vertical is not self.vertical:
|
if h.vertical is not self.vertical:
|
||||||
h.vertical = self.vertical
|
h.vertical = self.vertical
|
||||||
if self.vertical:
|
change_icon_image(h, 'selection-handle-vertical' if h.vertical else 'selection-handle')
|
||||||
change_icon_image(h, 'selection-handle-vertical')
|
|
||||||
else:
|
|
||||||
change_icon_image(h, 'selection-handle')
|
|
||||||
|
|
||||||
self.show()
|
self.show()
|
||||||
self.bar.style.display = self.start_handle.style.display = self.end_handle.style.display = 'block'
|
self.bar.style.display = self.start_handle.style.display = self.end_handle.style.display = 'block'
|
||||||
@ -720,12 +717,12 @@ class SelectionBar:
|
|||||||
# Cap this to prevent very large handles when selecting images.
|
# Cap this to prevent very large handles when selecting images.
|
||||||
selection_size = min(60, selection_size)
|
selection_size = min(60, selection_size)
|
||||||
|
|
||||||
if not self.vertical:
|
if self.vertical:
|
||||||
height = selection_size * 2
|
|
||||||
width = int(height * 2 / 3)
|
|
||||||
else:
|
|
||||||
width = selection_size * 2
|
width = selection_size * 2
|
||||||
height = int(width * 2 / 3)
|
height = int(width * 2 / 3)
|
||||||
|
else:
|
||||||
|
height = selection_size * 2
|
||||||
|
width = int(height * 2 / 3)
|
||||||
|
|
||||||
s.width = f'{width}px'
|
s.width = f'{width}px'
|
||||||
s.height = f'{height}px'
|
s.height = f'{height}px'
|
||||||
@ -778,10 +775,10 @@ class SelectionBar:
|
|||||||
s.transform = f'scaleX(-1)'
|
s.transform = f'scaleX(-1)'
|
||||||
|
|
||||||
def position_handles(self, start_handle, end_handle, start, end):
|
def position_handles(self, start_handle, end_handle, start, end):
|
||||||
if not self.vertical:
|
if self.vertical:
|
||||||
selection_size = max(start.height, end.height)
|
|
||||||
else:
|
|
||||||
selection_size = max(start.width, end.width)
|
selection_size = max(start.width, end.width)
|
||||||
|
else:
|
||||||
|
selection_size = max(start.height, end.height)
|
||||||
self.place_single_handle(selection_size, start_handle, start, True)
|
self.place_single_handle(selection_size, start_handle, start, True)
|
||||||
self.place_single_handle(selection_size, end_handle, end, False)
|
self.place_single_handle(selection_size, end_handle, end, False)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user