(cm, coords, context)
| 1197 | // Context may be "window", "page", "div", or "local"/null |
| 1198 | // Result is in "div" coords |
| 1199 | function fromCoordSystem(cm, coords, context) { |
| 1200 | if (context == "div") return coords; |
| 1201 | var left = coords.left, top = coords.top; |
| 1202 | // First move into "page" coordinate system |
| 1203 | if (context == "page") { |
| 1204 | left -= pageScrollX(); |
| 1205 | top -= pageScrollY(); |
| 1206 | } else if (context == "local" || !context) { |
| 1207 | var localBox = getRect(cm.display.sizer); |
| 1208 | left += localBox.left; |
| 1209 | top += localBox.top; |
| 1210 | } |
| 1211 | |
| 1212 | var lineSpaceBox = getRect(cm.display.lineSpace); |
| 1213 | return {left: left - lineSpaceBox.left, top: top - lineSpaceBox.top}; |
| 1214 | } |
| 1215 | |
| 1216 | function charCoords(cm, pos, context, lineObj, bias) { |
| 1217 | if (!lineObj) lineObj = getLine(cm.doc, pos.line); |
no test coverage detected