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

Function fromCoordSystem

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

Source from the content-addressed store, hash-verified

1687 // Coverts a box from "div" coords to another coordinate system.
1688 // Context may be "window", "page", "div", or "local"/null.
1689 function fromCoordSystem(cm, coords, context) {
1690 if (context == "div") return coords;
1691 var left = coords.left, top = coords.top;
1692 // First move into "page" coordinate system
1693 if (context == "page") {
1694 left -= pageScrollX();
1695 top -= pageScrollY();
1696 } else if (context == "local" || !context) {
1697 var localBox = cm.display.sizer.getBoundingClientRect();
1698 left += localBox.left;
1699 top += localBox.top;
1700 }
1701
1702 var lineSpaceBox = cm.display.lineSpace.getBoundingClientRect();
1703 return {left: left - lineSpaceBox.left, top: top - lineSpaceBox.top};
1704 }
1705
1706 function charCoords(cm, pos, context, lineObj, bias) {
1707 if (!lineObj) lineObj = getLine(cm.doc, pos.line);

Callers 1

codemirror.jsFile · 0.70

Calls 2

pageScrollXFunction · 0.70
pageScrollYFunction · 0.70

Tested by

no test coverage detected