MCPcopy Index your code
hub / github.com/csev/py4e / fromCoordSystem

Function fromCoordSystem

tools/pythonauto/static/codemirror/codemirror.js:1199–1214  ·  view source on GitHub ↗
(cm, coords, context)

Source from the content-addressed store, hash-verified

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);

Callers 1

codemirror.jsFile · 0.70

Calls 3

getRectFunction · 0.85
pageScrollXFunction · 0.70
pageScrollYFunction · 0.70

Tested by

no test coverage detected