MCPcopy
hub / github.com/csev/py4e / gutterEvent

Function gutterEvent

tools/pythonauto/static/codemirrorepl/codemirror.js:2717–2738  ·  view source on GitHub ↗
(cm, e, type, prevent, signalfn)

Source from the content-addressed store, hash-verified

2715 // Determines whether an event happened in the gutter, and fires the
2716 // handlers for the corresponding event.
2717 function gutterEvent(cm, e, type, prevent, signalfn) {
2718 try { var mX = e.clientX, mY = e.clientY; }
2719 catch(e) { return false; }
2720 if (mX >= Math.floor(cm.display.gutters.getBoundingClientRect().right)) return false;
2721 if (prevent) e_preventDefault(e);
2722
2723 var display = cm.display;
2724 var lineBox = display.lineDiv.getBoundingClientRect();
2725
2726 if (mY > lineBox.bottom || !hasHandler(cm, type)) return e_defaultPrevented(e);
2727 mY -= lineBox.top - display.viewOffset;
2728
2729 for (var i = 0; i < cm.options.gutters.length; ++i) {
2730 var g = display.gutters.childNodes[i];
2731 if (g && g.getBoundingClientRect().right >= mX) {
2732 var line = lineAtHeight(cm.doc, mY);
2733 var gutter = cm.options.gutters[i];
2734 signalfn(cm, type, cm, line, gutter, e);
2735 return e_defaultPrevented(e);
2736 }
2737 }
2738 }
2739
2740 function clickInGutter(cm, e) {
2741 return gutterEvent(cm, e, "gutterClick", true, signalLater);

Callers 2

clickInGutterFunction · 0.70
contextMenuInGutterFunction · 0.70

Calls 4

e_preventDefaultFunction · 0.70
hasHandlerFunction · 0.70
e_defaultPreventedFunction · 0.70
lineAtHeightFunction · 0.70

Tested by

no test coverage detected