MCPcopy Index your code
hub / github.com/DHTMLX/gantt / fromCoordSystem

Function fromCoordSystem

samples/common/codehighlight/codemirror.js:2610–2625  ·  view source on GitHub ↗
(cm, coords, context)

Source from the content-addressed store, hash-verified

2608 // Coverts a box from "div" coords to another coordinate system.
2609 // Context may be "window", "page", "div", or "local"./null.
2610 function fromCoordSystem(cm, coords, context) {
2611 if (context == "div") { return coords }
2612 var left = coords.left, top = coords.top;
2613 // First move into "page" coordinate system
2614 if (context == "page") {
2615 left -= pageScrollX();
2616 top -= pageScrollY();
2617 } else if (context == "local" || !context) {
2618 var localBox = cm.display.sizer.getBoundingClientRect();
2619 left += localBox.left;
2620 top += localBox.top;
2621 }
2622
2623 var lineSpaceBox = cm.display.lineSpace.getBoundingClientRect();
2624 return {left: left - lineSpaceBox.left, top: top - lineSpaceBox.top}
2625 }
2626
2627 function charCoords(cm, pos, context, lineObj, bias) {
2628 if (!lineObj) { lineObj = getLine(cm.doc, pos.line); }

Callers 1

addEditorMethodsFunction · 0.85

Calls 2

pageScrollXFunction · 0.85
pageScrollYFunction · 0.85

Tested by

no test coverage detected