(cm, coords, context)
| 2608 | // Coverts a box from "div" coords to another coordinate system. |
| 2609 | // Context may be "window", "page", "div", or "local"./null. |
| 2610 | function fromCoordSystem(cm, coords, context) { |
| 2611 | if (context == "div") { return coords } |
| 2612 | var left = coords.left, top = coords.top; |
| 2613 | // First move into "page" coordinate system |
| 2614 | if (context == "page") { |
| 2615 | left -= pageScrollX(); |
| 2616 | top -= pageScrollY(); |
| 2617 | } else if (context == "local" || !context) { |
| 2618 | var localBox = cm.display.sizer.getBoundingClientRect(); |
| 2619 | left += localBox.left; |
| 2620 | top += localBox.top; |
| 2621 | } |
| 2622 | |
| 2623 | var lineSpaceBox = cm.display.lineSpace.getBoundingClientRect(); |
| 2624 | return {left: left - lineSpaceBox.left, top: top - lineSpaceBox.top} |
| 2625 | } |
| 2626 | |
| 2627 | function charCoords(cm, pos, context, lineObj, bias) { |
| 2628 | if (!lineObj) { lineObj = getLine(cm.doc, pos.line); } |
no test coverage detected