MCPcopy
hub / github.com/csev/py4e / intoCoordSystem

Function intoCoordSystem

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

Source from the content-addressed store, hash-verified

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.

Callers 3

charCoordsFunction · 0.70
getFunction · 0.70
codemirror.jsFile · 0.70

Calls 5

widgetHeightFunction · 0.70
heightAtLineFunction · 0.70
paddingTopFunction · 0.70
pageScrollYFunction · 0.70
pageScrollXFunction · 0.70

Tested by

no test coverage detected