MCPcopy Create free account
hub / github.com/ronreiter/interactive-tutorials / posFromMouse

Function posFromMouse

static/js/codemirror/codemirror.js:1509–1521  ·  view source on GitHub ↗
(cm, e, liberal)

Source from the content-addressed store, hash-verified

1507 }
1508
1509 function posFromMouse(cm, e, liberal) {
1510 var display = cm.display;
1511 if (!liberal) {
1512 var target = e_target(e);
1513 if (target == display.scrollbarH || target == display.scrollbarH.firstChild ||
1514 target == display.scrollbarV || target == display.scrollbarV.firstChild ||
1515 target == display.scrollbarFiller) return null;
1516 }
1517 var x, y, space = getRect(display.lineSpace);
1518 // Fails unpredictably on IE[67] when mouse is dragged around quickly.
1519 try { x = e.clientX; y = e.clientY; } catch (e) { return null; }
1520 return coordsChar(cm, x - space.left, y - space.top);
1521 }
1522
1523 var lastClick, lastDoubleClick;
1524 function onMouseDown(e) {

Callers 5

onMouseDownFunction · 0.85
extendFunction · 0.85
doneFunction · 0.85
onDropFunction · 0.85
onContextMenuFunction · 0.85

Calls 3

e_targetFunction · 0.85
getRectFunction · 0.85
coordsCharFunction · 0.85

Tested by

no test coverage detected