MCPcopy
hub / github.com/witheve/Eve / intoCoordSystem

Function intoCoordSystem

src/codemirror.js:2790–2808  ·  view source on GitHub ↗
(cm, lineObj, rect, context)

Source from the content-addressed store, hash-verified

2788 // "line", "div" (display.lineDiv), "local"/null (editor), "window",
2789 // or "page".
2790 function intoCoordSystem(cm, lineObj, rect, context) {
2791 if (lineObj.widgets) for (var i = 0; i < lineObj.widgets.length; ++i) if (lineObj.widgets[i].above) {
2792 var size = widgetHeight(lineObj.widgets[i]);
2793 rect.top += size; rect.bottom += size;
2794 }
2795 if (context == "line") return rect;
2796 if (!context) context = "local";
2797 var yOff = heightAtLine(lineObj);
2798 if (context == "local") yOff += paddingTop(cm.display);
2799 else yOff -= cm.display.viewOffset;
2800 if (context == "page" || context == "window") {
2801 var lOff = cm.display.lineSpace.getBoundingClientRect();
2802 yOff += lOff.top + (context == "window" ? 0 : pageScrollY());
2803 var xOff = lOff.left + (context == "window" ? 0 : pageScrollX());
2804 rect.left += xOff; rect.right += xOff;
2805 }
2806 rect.top += yOff; rect.bottom += yOff;
2807 return rect;
2808 }
2809
2810 // Coverts a box from "div" coords to another coordinate system.
2811 // Context may be "window", "page", "div", or "local"/null.

Callers 3

charCoordsFunction · 0.85
getFunction · 0.85
codemirror.jsFile · 0.85

Calls 5

widgetHeightFunction · 0.85
heightAtLineFunction · 0.85
paddingTopFunction · 0.85
pageScrollYFunction · 0.85
pageScrollXFunction · 0.85

Tested by

no test coverage detected