(cm, coords, context)
| 2696 | // Coverts a box from "div" coords to another coordinate system. |
| 2697 | // Context may be "window", "page", "div", or "local"/null. |
| 2698 | function fromCoordSystem(cm, coords, context) { |
| 2699 | if (context == "div") return coords; |
| 2700 | var left = coords.left, top = coords.top; |
| 2701 | // First move into "page" coordinate system |
| 2702 | if (context == "page") { |
| 2703 | left -= pageScrollX(); |
| 2704 | top -= pageScrollY(); |
| 2705 | } else if (context == "local" || !context) { |
| 2706 | var localBox = cm.display.sizer.getBoundingClientRect(); |
| 2707 | left += localBox.left; |
| 2708 | top += localBox.top; |
| 2709 | } |
| 2710 | |
| 2711 | var lineSpaceBox = cm.display.lineSpace.getBoundingClientRect(); |
| 2712 | return {left: left - lineSpaceBox.left, top: top - lineSpaceBox.top}; |
| 2713 | } |
| 2714 | |
| 2715 | function charCoords(cm, pos, context, lineObj, bias) { |
| 2716 | if (!lineObj) lineObj = getLine(cm.doc, pos.line); |
no test coverage detected