MCPcopy Create free account
hub / github.com/breck7/scroll / intoCoordSystem

Function intoCoordSystem

external/.scrollLibs.js:3922–3950  ·  view source on GitHub ↗
(cm, lineObj, rect, context, includeWidgets)

Source from the content-addressed store, hash-verified

3920 // "line", "div" (display.lineDiv), "local"./null (editor), "window",
3921 // or "page".
3922 function intoCoordSystem(cm, lineObj, rect, context, includeWidgets) {
3923 if (!includeWidgets) {
3924 var height = widgetTopHeight(lineObj)
3925 rect.top += height
3926 rect.bottom += height
3927 }
3928 if (context == "line") {
3929 return rect
3930 }
3931 if (!context) {
3932 context = "local"
3933 }
3934 var yOff = heightAtLine(lineObj)
3935 if (context == "local") {
3936 yOff += paddingTop(cm.display)
3937 } else {
3938 yOff -= cm.display.viewOffset
3939 }
3940 if (context == "page" || context == "window") {
3941 var lOff = cm.display.lineSpace.getBoundingClientRect()
3942 yOff += lOff.top + (context == "window" ? 0 : pageScrollY())
3943 var xOff = lOff.left + (context == "window" ? 0 : pageScrollX())
3944 rect.left += xOff
3945 rect.right += xOff
3946 }
3947 rect.top += yOff
3948 rect.bottom += yOff
3949 return rect
3950 }
3951
3952 // Coverts a box from "div" coords to another coordinate system.
3953 // 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