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

Function intoCoordSystem

tools/pythonauto/static/codemirror/codemirror.js:1177–1195  ·  view source on GitHub ↗
(cm, lineObj, rect, context)

Source from the content-addressed store, hash-verified

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

Callers 3

charCoordsFunction · 0.70
getFunction · 0.70
codemirror.jsFile · 0.70

Calls 6

getRectFunction · 0.85
widgetHeightFunction · 0.70
heightAtLineFunction · 0.70
paddingTopFunction · 0.70
pageScrollYFunction · 0.70
pageScrollXFunction · 0.70

Tested by

no test coverage detected