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

Function fromCoordSystem

external/.scrollLibs.js:3954–3972  ·  view source on GitHub ↗
(cm, coords, context)

Source from the content-addressed store, hash-verified

3952 // Coverts a box from "div" coords to another coordinate system.
3953 // Context may be "window", "page", "div", or "local"./null.
3954 function fromCoordSystem(cm, coords, context) {
3955 if (context == "div") {
3956 return coords
3957 }
3958 var left = coords.left,
3959 top = coords.top
3960 // First move into "page" coordinate system
3961 if (context == "page") {
3962 left -= pageScrollX()
3963 top -= pageScrollY()
3964 } else if (context == "local" || !context) {
3965 var localBox = cm.display.sizer.getBoundingClientRect()
3966 left += localBox.left
3967 top += localBox.top
3968 }
3969
3970 var lineSpaceBox = cm.display.lineSpace.getBoundingClientRect()
3971 return { left: left - lineSpaceBox.left, top: top - lineSpaceBox.top }
3972 }
3973
3974 function charCoords(cm, pos, context, lineObj, bias) {
3975 if (!lineObj) {

Callers 1

addEditorMethodsFunction · 0.85

Calls 2

pageScrollXFunction · 0.85
pageScrollYFunction · 0.85

Tested by

no test coverage detected