(cm, coords, context)
| 1687 | // Coverts a box from "div" coords to another coordinate system. |
| 1688 | // Context may be "window", "page", "div", or "local"/null. |
| 1689 | function fromCoordSystem(cm, coords, context) { |
| 1690 | if (context == "div") return coords; |
| 1691 | var left = coords.left, top = coords.top; |
| 1692 | // First move into "page" coordinate system |
| 1693 | if (context == "page") { |
| 1694 | left -= pageScrollX(); |
| 1695 | top -= pageScrollY(); |
| 1696 | } else if (context == "local" || !context) { |
| 1697 | var localBox = cm.display.sizer.getBoundingClientRect(); |
| 1698 | left += localBox.left; |
| 1699 | top += localBox.top; |
| 1700 | } |
| 1701 | |
| 1702 | var lineSpaceBox = cm.display.lineSpace.getBoundingClientRect(); |
| 1703 | return {left: left - lineSpaceBox.left, top: top - lineSpaceBox.top}; |
| 1704 | } |
| 1705 | |
| 1706 | function charCoords(cm, pos, context, lineObj, bias) { |
| 1707 | if (!lineObj) lineObj = getLine(cm.doc, pos.line); |
no test coverage detected