Swap left and right handles

This commit is contained in:
Kovid Goyal 2020-03-20 20:01:33 +05:30
parent 4defd82bed
commit 5bab8e8292
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -46,10 +46,10 @@ class CreateAnnotation:
self.state = WAITING_FOR_CLICK self.state = WAITING_FOR_CLICK
container = self.container container = self.container
lh = selection_handle() lh = selection_handle(True)
self.left_handle_id = ensure_id(lh, 'handle') self.left_handle_id = ensure_id(lh, 'handle')
container.appendChild(lh) container.appendChild(lh)
rh = selection_handle(True) rh = selection_handle(False)
self.right_handle_id = ensure_id(rh, 'handle') self.right_handle_id = ensure_id(rh, 'handle')
container.appendChild(rh) container.appendChild(rh)
@ -122,7 +122,7 @@ class CreateAnnotation:
return s, width return s, width
style, width = do_it(lh, extents.start) style, width = do_it(lh, extents.start)
style.left = min(max(0, extents.start.x), window.innerWidth - width // 2) + 'px' style.left = (extents.start.x - width) + 'px'
style, width = do_it(rh, extents.end) style, width = do_it(rh, extents.end)
style.left = (min(max(width // 2, extents.end.x), window.innerWidth) - width) + 'px' style.left = extents.end.x + 'px'
self.state = WAITING_FOR_DRAG self.state = WAITING_FOR_DRAG