mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
...
This commit is contained in:
parent
d64a760619
commit
4fd0616242
@ -397,6 +397,8 @@ class CanonicalFragmentIdentifier
|
||||
if not cd
|
||||
break
|
||||
|
||||
# We have an embedded document, transforms x, y into the co-prd
|
||||
# system of the embedded document's viewport
|
||||
rect = target.getBoundingClientRect()
|
||||
x -= rect.left
|
||||
y -= rect.top
|
||||
|
@ -59,26 +59,13 @@ mark_and_reload = (evt) ->
|
||||
setTimeout(fn, 1)
|
||||
null
|
||||
|
||||
window_scroll_pos = (win) ->
|
||||
if typeof(win.pageXOffset) == 'number'
|
||||
x = win.pageXOffset
|
||||
y = win.pageYOffset
|
||||
else # IE < 9
|
||||
if document.body and ( document.body.scrollLeft or document.body.scrollTop )
|
||||
x = document.body.scrollLeft
|
||||
y = document.body.scrollTop
|
||||
else if document.documentElement and ( document.documentElement.scrollLeft or document.documentElement.scrollTop)
|
||||
y = document.documentElement.scrollTop
|
||||
x = document.documentElement.scrollLeft
|
||||
return [x, y]
|
||||
|
||||
frame_clicked = (evt) ->
|
||||
iframe = evt.target.ownerDocument.defaultView.frameElement
|
||||
# We know that the offset parent of the iframe is body
|
||||
# So we can easily calculate the event co-ords w.r.t. the browser window
|
||||
[winx, winy] = window_scroll_pos(window)
|
||||
x = evt.clientX + iframe.offsetLeft - winx
|
||||
y = evt.clientY + iframe.offsetTop - winy
|
||||
rect = iframe.getBoundingClientRect()
|
||||
x = evt.clientX + rect.left
|
||||
y = evt.clientY + rect.top
|
||||
mark_and_reload({'clientX':x, 'clientY':y, 'button':evt.button})
|
||||
|
||||
window.onload = ->
|
||||
|
Loading…
x
Reference in New Issue
Block a user