(cm, lineObj, rect, context)
| 1665 | // coordinates into another coordinate system. Context may be one of |
| 1666 | // "line", "div" (display.lineDiv), "local"/null (editor), or "page". |
| 1667 | function intoCoordSystem(cm, lineObj, rect, context) { |
| 1668 | if (lineObj.widgets) for (var i = 0; i < lineObj.widgets.length; ++i) if (lineObj.widgets[i].above) { |
| 1669 | var size = widgetHeight(lineObj.widgets[i]); |
| 1670 | rect.top += size; rect.bottom += size; |
| 1671 | } |
| 1672 | if (context == "line") return rect; |
| 1673 | if (!context) context = "local"; |
| 1674 | var yOff = heightAtLine(lineObj); |
| 1675 | if (context == "local") yOff += paddingTop(cm.display); |
| 1676 | else yOff -= cm.display.viewOffset; |
| 1677 | if (context == "page" || context == "window") { |
| 1678 | var lOff = cm.display.lineSpace.getBoundingClientRect(); |
| 1679 | yOff += lOff.top + (context == "window" ? 0 : pageScrollY()); |
| 1680 | var xOff = lOff.left + (context == "window" ? 0 : pageScrollX()); |
| 1681 | rect.left += xOff; rect.right += xOff; |
| 1682 | } |
| 1683 | rect.top += yOff; rect.bottom += yOff; |
| 1684 | return rect; |
| 1685 | } |
| 1686 | |
| 1687 | // Coverts a box from "div" coords to another coordinate system. |
| 1688 | // Context may be "window", "page", "div", or "local"/null. |
no test coverage detected