(cm, coords, context)
| 2810 | // Coverts a box from "div" coords to another coordinate system. |
| 2811 | // Context may be "window", "page", "div", or "local"/null. |
| 2812 | function fromCoordSystem(cm, coords, context) { |
| 2813 | if (context == "div") return coords; |
| 2814 | var left = coords.left, top = coords.top; |
| 2815 | // First move into "page" coordinate system |
| 2816 | if (context == "page") { |
| 2817 | left -= pageScrollX(); |
| 2818 | top -= pageScrollY(); |
| 2819 | } else if (context == "local" || !context) { |
| 2820 | var localBox = cm.display.sizer.getBoundingClientRect(); |
| 2821 | left += localBox.left; |
| 2822 | top += localBox.top; |
| 2823 | } |
| 2824 | |
| 2825 | var lineSpaceBox = cm.display.lineSpace.getBoundingClientRect(); |
| 2826 | return {left: left - lineSpaceBox.left, top: top - lineSpaceBox.top}; |
| 2827 | } |
| 2828 | |
| 2829 | function charCoords(cm, pos, context, lineObj, bias) { |
| 2830 | if (!lineObj) lineObj = getLine(cm.doc, pos.line); |
no test coverage detected