mirror of
https://github.com/futurepress/epub.js.git
synced 2025-10-04 15:09:16 +02:00
Update display to accept percentages, handle getting location of collapsed ranges
This commit is contained in:
parent
db798e7934
commit
fb04ac2c25
10 changed files with 390 additions and 204 deletions
|
@ -388,7 +388,13 @@ Contents.prototype.locationOf = function(target, ignoreClass) {
|
|||
targetPos.left = position.left;
|
||||
targetPos.top = position.top;
|
||||
} else {
|
||||
position = range.getBoundingClientRect();
|
||||
// Webkit does not handle collapsed range bounds correctly
|
||||
// https://bugs.webkit.org/show_bug.cgi?id=138949
|
||||
if (range.collapsed) {
|
||||
position = range.getClientRects()[0];
|
||||
} else {
|
||||
position = range.getBoundingClientRect();
|
||||
}
|
||||
targetPos.left = position.left;
|
||||
targetPos.top = position.top;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue