corinthia-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pmke...@apache.org
Subject [2/4] incubator-corinthia git commit: Cursor hit testing after footnotes/endnotes
Date Wed, 18 Feb 2015 12:26:56 GMT
Cursor hit testing after footnotes/endnotes

Previously, Position_atPoint would return the position directly before
an empty footnote or endnote if called with a point that was inside the
first character following it. We now check to see if the x position is
to the right of the empty note, and if so, returns the position directly
before the first character after the note.


Project: http://git-wip-us.apache.org/repos/asf/incubator-corinthia/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-corinthia/commit/b88d11e9
Tree: http://git-wip-us.apache.org/repos/asf/incubator-corinthia/tree/b88d11e9
Diff: http://git-wip-us.apache.org/repos/asf/incubator-corinthia/diff/b88d11e9

Branch: refs/heads/master
Commit: b88d11e93d7ed9ad5fd63e2fbd6b0372ef19244d
Parents: f3b4302
Author: Peter Kelly <peter@uxproductivity.com>
Authored: Wed Feb 18 17:22:09 2015 +0700
Committer: Peter Kelly <peter@uxproductivity.com>
Committed: Wed Feb 18 16:46:14 2015 +0700

----------------------------------------------------------------------
 Editor/src/Position.js | 6 ++++++
 1 file changed, 6 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-corinthia/blob/b88d11e9/Editor/src/Position.js
----------------------------------------------------------------------
diff --git a/Editor/src/Position.js b/Editor/src/Position.js
index aaf5cb6..4098e49 100644
--- a/Editor/src/Position.js
+++ b/Editor/src/Position.js
@@ -979,6 +979,12 @@ var Position_atPoint;
 
             if ((next != null) && nodeMayContainPos(next) && elementContainsPoint(next,x,y))
                 return new Position(next,0);
+
+            if ((next != null) && isEmptyNoteNode(next)) {
+                var rect = next.getBoundingClientRect();
+                if (x > rect.right)
+                    return new Position(pos.node,pos.offset+1);
+            }
         }
 
         pos = adjustPositionForFigure(pos);


Mime
View raw message