MCPcopy Create free account
hub / github.com/TruthHun/BookStack / intoCoordSystem

Function intoCoordSystem

static/mergely/lib/codemirror.js:2782–2800  ·  view source on GitHub ↗
(cm, lineObj, rect, context)

Source from the content-addressed store, hash-verified

2780 // "line", "div" (display.lineDiv), "local"/null (editor), "window",
2781 // or "page".
2782 function intoCoordSystem(cm, lineObj, rect, context) {
2783 if (lineObj.widgets) for (var i = 0; i < lineObj.widgets.length; ++i) if (lineObj.widgets[i].above) {
2784 var size = widgetHeight(lineObj.widgets[i]);
2785 rect.top += size; rect.bottom += size;
2786 }
2787 if (context == "line") return rect;
2788 if (!context) context = "local";
2789 var yOff = heightAtLine(lineObj);
2790 if (context == "local") yOff += paddingTop(cm.display);
2791 else yOff -= cm.display.viewOffset;
2792 if (context == "page" || context == "window") {
2793 var lOff = cm.display.lineSpace.getBoundingClientRect();
2794 yOff += lOff.top + (context == "window" ? 0 : pageScrollY());
2795 var xOff = lOff.left + (context == "window" ? 0 : pageScrollX());
2796 rect.left += xOff; rect.right += xOff;
2797 }
2798 rect.top += yOff; rect.bottom += yOff;
2799 return rect;
2800 }
2801
2802 // Coverts a box from "div" coords to another coordinate system.
2803 // 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