MCPcopy
hub / github.com/DHTMLX/gantt / intoCoordSystem

Function intoCoordSystem

samples/common/codehighlight/codemirror.js:2588–2606  ·  view source on GitHub ↗
(cm, lineObj, rect, context, includeWidgets)

Source from the content-addressed store, hash-verified

2586 // "line", "div" (display.lineDiv), "local"./null (editor), "window",
2587 // or "page".
2588 function intoCoordSystem(cm, lineObj, rect, context, includeWidgets) {
2589 if (!includeWidgets) {
2590 var height = widgetTopHeight(lineObj);
2591 rect.top += height; rect.bottom += height;
2592 }
2593 if (context == "line") { return rect }
2594 if (!context) { context = "local"; }
2595 var yOff = heightAtLine(lineObj);
2596 if (context == "local") { yOff += paddingTop(cm.display); }
2597 else { yOff -= cm.display.viewOffset; }
2598 if (context == "page" || context == "window") {
2599 var lOff = cm.display.lineSpace.getBoundingClientRect();
2600 yOff += lOff.top + (context == "window" ? 0 : pageScrollY());
2601 var xOff = lOff.left + (context == "window" ? 0 : pageScrollX());
2602 rect.left += xOff; rect.right += xOff;
2603 }
2604 rect.top += yOff; rect.bottom += yOff;
2605 return rect
2606 }
2607
2608 // Coverts a box from "div" coords to another coordinate system.
2609 // Context may be "window", "page", "div", or "local"./null.

Callers 4

charCoordsFunction · 0.85
getFunction · 0.85
wrappedLineExtentCharFunction · 0.85
addEditorMethodsFunction · 0.85

Calls 5

widgetTopHeightFunction · 0.85
heightAtLineFunction · 0.85
paddingTopFunction · 0.85
pageScrollYFunction · 0.85
pageScrollXFunction · 0.85

Tested by

no test coverage detected