MCPcopy Create free account
hub / github.com/feiyu563/PrometheusAlert / gutterEvent

Function gutterEvent

static/plugins/codemirror/codemirror.js:7650–7677  ·  view source on GitHub ↗
(cm, e, type, prevent)

Source from the content-addressed store, hash-verified

7648 // Determines whether an event happened in the gutter, and fires the
7649 // handlers for the corresponding event.
7650 function gutterEvent(cm, e, type, prevent) {
7651 var mX, mY;
7652 if (e.touches) {
7653 mX = e.touches[0].clientX;
7654 mY = e.touches[0].clientY;
7655 } else {
7656 try { mX = e.clientX; mY = e.clientY; }
7657 catch(e$1) { return false }
7658 }
7659 if (mX >= Math.floor(cm.display.gutters.getBoundingClientRect().right)) { return false }
7660 if (prevent) { e_preventDefault(e); }
7661
7662 var display = cm.display;
7663 var lineBox = display.lineDiv.getBoundingClientRect();
7664
7665 if (mY > lineBox.bottom || !hasHandler(cm, type)) { return e_defaultPrevented(e) }
7666 mY -= lineBox.top - display.viewOffset;
7667
7668 for (var i = 0; i < cm.display.gutterSpecs.length; ++i) {
7669 var g = display.gutters.childNodes[i];
7670 if (g && g.getBoundingClientRect().right >= mX) {
7671 var line = lineAtHeight(cm.doc, mY);
7672 var gutter = cm.display.gutterSpecs[i];
7673 signal(cm, type, cm, line, gutter.className, e);
7674 return e_defaultPrevented(e)
7675 }
7676 }
7677 }
7678
7679 function clickInGutter(cm, e) {
7680 return gutterEvent(cm, e, "gutterClick", true)

Callers 2

clickInGutterFunction · 0.85
contextMenuInGutterFunction · 0.85

Calls 5

e_preventDefaultFunction · 0.85
hasHandlerFunction · 0.85
e_defaultPreventedFunction · 0.85
lineAtHeightFunction · 0.85
signalFunction · 0.85

Tested by

no test coverage detected