(cm, e, type, prevent)
| 7535 | // Determines whether an event happened in the gutter, and fires the |
| 7536 | // handlers for the corresponding event. |
| 7537 | function gutterEvent(cm, e, type, prevent) { |
| 7538 | var mX, mY; |
| 7539 | if (e.touches) { |
| 7540 | mX = e.touches[0].clientX; |
| 7541 | mY = e.touches[0].clientY; |
| 7542 | } else { |
| 7543 | try { mX = e.clientX; mY = e.clientY; } |
| 7544 | catch(e) { return false } |
| 7545 | } |
| 7546 | if (mX >= Math.floor(cm.display.gutters.getBoundingClientRect().right)) { return false } |
| 7547 | if (prevent) { e_preventDefault(e); } |
| 7548 | |
| 7549 | var display = cm.display; |
| 7550 | var lineBox = display.lineDiv.getBoundingClientRect(); |
| 7551 | |
| 7552 | if (mY > lineBox.bottom || !hasHandler(cm, type)) { return e_defaultPrevented(e) } |
| 7553 | mY -= lineBox.top - display.viewOffset; |
| 7554 | |
| 7555 | for (var i = 0; i < cm.options.gutters.length; ++i) { |
| 7556 | var g = display.gutters.childNodes[i]; |
| 7557 | if (g && g.getBoundingClientRect().right >= mX) { |
| 7558 | var line = lineAtHeight(cm.doc, mY); |
| 7559 | var gutter = cm.options.gutters[i]; |
| 7560 | signal(cm, type, cm, line, gutter, e); |
| 7561 | return e_defaultPrevented(e) |
| 7562 | } |
| 7563 | } |
| 7564 | } |
| 7565 | |
| 7566 | function clickInGutter(cm, e) { |
| 7567 | return gutterEvent(cm, e, "gutterClick", true) |
no test coverage detected