(cm, e, type, prevent)
| 3806 | // Determines whether an event happened in the gutter, and fires the |
| 3807 | // handlers for the corresponding event. |
| 3808 | function gutterEvent(cm, e, type, prevent) { |
| 3809 | try { var mX = e.clientX, mY = e.clientY; } |
| 3810 | catch(e) { return false; } |
| 3811 | if (mX >= Math.floor(cm.display.gutters.getBoundingClientRect().right)) return false; |
| 3812 | if (prevent) e_preventDefault(e); |
| 3813 | |
| 3814 | var display = cm.display; |
| 3815 | var lineBox = display.lineDiv.getBoundingClientRect(); |
| 3816 | |
| 3817 | if (mY > lineBox.bottom || !hasHandler(cm, type)) return e_defaultPrevented(e); |
| 3818 | mY -= lineBox.top - display.viewOffset; |
| 3819 | |
| 3820 | for (var i = 0; i < cm.options.gutters.length; ++i) { |
| 3821 | var g = display.gutters.childNodes[i]; |
| 3822 | if (g && g.getBoundingClientRect().right >= mX) { |
| 3823 | var line = lineAtHeight(cm.doc, mY); |
| 3824 | var gutter = cm.options.gutters[i]; |
| 3825 | signal(cm, type, cm, line, gutter, e); |
| 3826 | return e_defaultPrevented(e); |
| 3827 | } |
| 3828 | } |
| 3829 | } |
| 3830 | |
| 3831 | function clickInGutter(cm, e) { |
| 3832 | return gutterEvent(cm, e, "gutterClick", true); |
no test coverage detected