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