MCPcopy
hub / github.com/witheve/Eve / gutterEvent

Function gutterEvent

src/codemirror.js:3830–3851  ·  view source on GitHub ↗
(cm, e, type, prevent)

Source from the content-addressed store, hash-verified

3828 // Determines whether an event happened in the gutter, and fires the
3829 // handlers for the corresponding event.
3830 function gutterEvent(cm, e, type, prevent) {
3831 try { var mX = e.clientX, mY = e.clientY; }
3832 catch(e) { return false; }
3833 if (mX >= Math.floor(cm.display.gutters.getBoundingClientRect().right)) return false;
3834 if (prevent) e_preventDefault(e);
3835
3836 var display = cm.display;
3837 var lineBox = display.lineDiv.getBoundingClientRect();
3838
3839 if (mY > lineBox.bottom || !hasHandler(cm, type)) return e_defaultPrevented(e);
3840 mY -= lineBox.top - display.viewOffset;
3841
3842 for (var i = 0; i < cm.options.gutters.length; ++i) {
3843 var g = display.gutters.childNodes[i];
3844 if (g && g.getBoundingClientRect().right >= mX) {
3845 var line = lineAtHeight(cm.doc, mY);
3846 var gutter = cm.options.gutters[i];
3847 signal(cm, type, cm, line, gutter, e);
3848 return e_defaultPrevented(e);
3849 }
3850 }
3851 }
3852
3853 function clickInGutter(cm, e) {
3854 return gutterEvent(cm, e, "gutterClick", true);

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