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

Function clickInGutter

static/js/codemirror/codemirror.js:1706–1729  ·  view source on GitHub ↗
(cm, e)

Source from the content-addressed store, hash-verified

1704 }
1705
1706 function clickInGutter(cm, e) {
1707 var display = cm.display;
1708 try { var mX = e.clientX, mY = e.clientY; }
1709 catch(e) { return false; }
1710
1711 if (mX >= Math.floor(getRect(display.gutters).right)) return false;
1712 e_preventDefault(e);
1713 if (!hasHandler(cm, "gutterClick")) return true;
1714
1715 var lineBox = getRect(display.lineDiv);
1716 if (mY > lineBox.bottom) return true;
1717 mY -= lineBox.top - display.viewOffset;
1718
1719 for (var i = 0; i < cm.options.gutters.length; ++i) {
1720 var g = display.gutters.childNodes[i];
1721 if (g && getRect(g).right >= mX) {
1722 var line = lineAtHeight(cm.doc, mY);
1723 var gutter = cm.options.gutters[i];
1724 signalLater(cm, "gutterClick", cm, line, gutter, e);
1725 break;
1726 }
1727 }
1728 return true;
1729 }
1730
1731 function onDragStart(cm, e) {
1732 if (eventInWidget(cm.display, e)) return;

Callers 1

onMouseDownFunction · 0.85

Calls 5

getRectFunction · 0.85
e_preventDefaultFunction · 0.85
hasHandlerFunction · 0.85
lineAtHeightFunction · 0.85
signalLaterFunction · 0.85

Tested by

no test coverage detected