(cm, lineObj, rect, context)
| 1175 | |
| 1176 | // Context is one of "line", "div" (display.lineDiv), "local"/null (editor), or "page" |
| 1177 | function intoCoordSystem(cm, lineObj, rect, context) { |
| 1178 | if (lineObj.widgets) for (var i = 0; i < lineObj.widgets.length; ++i) if (lineObj.widgets[i].above) { |
| 1179 | var size = widgetHeight(lineObj.widgets[i]); |
| 1180 | rect.top += size; rect.bottom += size; |
| 1181 | } |
| 1182 | if (context == "line") return rect; |
| 1183 | if (!context) context = "local"; |
| 1184 | var yOff = heightAtLine(cm, lineObj); |
| 1185 | if (context == "local") yOff += paddingTop(cm.display); |
| 1186 | else yOff -= cm.display.viewOffset; |
| 1187 | if (context == "page" || context == "window") { |
| 1188 | var lOff = getRect(cm.display.lineSpace); |
| 1189 | yOff += lOff.top + (context == "window" ? 0 : pageScrollY()); |
| 1190 | var xOff = lOff.left + (context == "window" ? 0 : pageScrollX()); |
| 1191 | rect.left += xOff; rect.right += xOff; |
| 1192 | } |
| 1193 | rect.top += yOff; rect.bottom += yOff; |
| 1194 | return rect; |
| 1195 | } |
| 1196 | |
| 1197 | // Context may be "window", "page", "div", or "local"/null |
| 1198 | // Result is in "div" coords |
no test coverage detected