Got questions, comments, patches, etc.?
Contact Jason Woofenden
gitweb
/
peach-html5-editor.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
79ae503
)
fix new positioning code for scrolled editor
author
Jason Woofenden
<jason@jasonwoof.com>
Sat, 5 Mar 2016 05:09:49 +0000
(
00:09
-0500)
committer
Jason Woofenden
<jason@jasonwoof.com>
Sat, 5 Mar 2016 05:09:49 +0000
(
00:09
-0500)
editor.coffee
patch
|
blob
|
history
diff --git
a/editor.coffee
b/editor.coffee
index
956ade0
..
8014188
100644
(file)
--- a/
editor.coffee
+++ b/
editor.coffee
@@
-73,9
+73,13
@@
window.cursor_to_xyh = cursor_to_xyh = (n, i) ->
rect = rect[0]
else
return x: 0, y: 0, w: 0, h: 0 # TODO return null, fix callers
+ doc = n.el.ownerDocument.documentElement
+ win = n.el.ownerDocument.defaultView
+ y_fix = win.pageYOffset - doc.clientTop
+ x_fix = win.pageXOffset - doc.clientLeft
ret = {
- x: rect.left
- y: rect.top
+ x: rect.left + x_fix
+ y: rect.top + y_fix
w: rect.width ? (rect.right - rect.left)
h: rect.height ? (rect.top - rect.bottom)
}