MCPcopy Index your code
hub / github.com/witheve/Eve / fromCoordSystem

Function fromCoordSystem

src/codemirror.js:2812–2827  ·  view source on GitHub ↗
(cm, coords, context)

Source from the content-addressed store, hash-verified

2810 // Coverts a box from "div" coords to another coordinate system.
2811 // Context may be "window", "page", "div", or "local"/null.
2812 function fromCoordSystem(cm, coords, context) {
2813 if (context == "div") return coords;
2814 var left = coords.left, top = coords.top;
2815 // First move into "page" coordinate system
2816 if (context == "page") {
2817 left -= pageScrollX();
2818 top -= pageScrollY();
2819 } else if (context == "local" || !context) {
2820 var localBox = cm.display.sizer.getBoundingClientRect();
2821 left += localBox.left;
2822 top += localBox.top;
2823 }
2824
2825 var lineSpaceBox = cm.display.lineSpace.getBoundingClientRect();
2826 return {left: left - lineSpaceBox.left, top: top - lineSpaceBox.top};
2827 }
2828
2829 function charCoords(cm, pos, context, lineObj, bias) {
2830 if (!lineObj) lineObj = getLine(cm.doc, pos.line);

Callers 1

codemirror.jsFile · 0.85

Calls 2

pageScrollXFunction · 0.85
pageScrollYFunction · 0.85

Tested by

no test coverage detected