MCPcopy Create free account
hub / github.com/sql-js/sql.js / gutterEvent

Function gutterEvent

GUI/codemirror/lib/codemirror.js:2748–2769  ·  view source on GitHub ↗
(cm, e, type, prevent, signalfn)

Source from the content-addressed store, hash-verified

2746 // Determines whether an event happened in the gutter, and fires the
2747 // handlers for the corresponding event.
2748 function gutterEvent(cm, e, type, prevent, signalfn) {
2749 try { var mX = e.clientX, mY = e.clientY; }
2750 catch(e) { return false; }
2751 if (mX >= Math.floor(cm.display.gutters.getBoundingClientRect().right)) return false;
2752 if (prevent) e_preventDefault(e);
2753
2754 var display = cm.display;
2755 var lineBox = display.lineDiv.getBoundingClientRect();
2756
2757 if (mY > lineBox.bottom || !hasHandler(cm, type)) return e_defaultPrevented(e);
2758 mY -= lineBox.top - display.viewOffset;
2759
2760 for (var i = 0; i < cm.options.gutters.length; ++i) {
2761 var g = display.gutters.childNodes[i];
2762 if (g && g.getBoundingClientRect().right >= mX) {
2763 var line = lineAtHeight(cm.doc, mY);
2764 var gutter = cm.options.gutters[i];
2765 signalfn(cm, type, cm, line, gutter, e);
2766 return e_defaultPrevented(e);
2767 }
2768 }
2769 }
2770
2771 function clickInGutter(cm, e) {
2772 return gutterEvent(cm, e, "gutterClick", true, signalLater);

Callers 2

clickInGutterFunction · 0.85
contextMenuInGutterFunction · 0.85

Calls 3

hasHandlerFunction · 0.85
e_defaultPreventedFunction · 0.85
lineAtHeightFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…