(cm, e, type, prevent)
| 10385 | // Determines whether an event happened in the gutter, and fires the |
| 10386 | // handlers for the corresponding event. |
| 10387 | function gutterEvent(cm, e, type, prevent) { |
| 10388 | var mX, mY |
| 10389 | if (e.touches) { |
| 10390 | mX = e.touches[0].clientX |
| 10391 | mY = e.touches[0].clientY |
| 10392 | } else { |
| 10393 | try { |
| 10394 | mX = e.clientX |
| 10395 | mY = e.clientY |
| 10396 | } catch (e) { |
| 10397 | return false |
| 10398 | } |
| 10399 | } |
| 10400 | if (mX >= Math.floor(cm.display.gutters.getBoundingClientRect().right)) { |
| 10401 | return false |
| 10402 | } |
| 10403 | if (prevent) { |
| 10404 | e_preventDefault(e) |
| 10405 | } |
| 10406 | |
| 10407 | var display = cm.display |
| 10408 | var lineBox = display.lineDiv.getBoundingClientRect() |
| 10409 | |
| 10410 | if (mY > lineBox.bottom || !hasHandler(cm, type)) { |
| 10411 | return e_defaultPrevented(e) |
| 10412 | } |
| 10413 | mY -= lineBox.top - display.viewOffset |
| 10414 | |
| 10415 | for (var i = 0; i < cm.options.gutters.length; ++i) { |
| 10416 | var g = display.gutters.childNodes[i] |
| 10417 | if (g && g.getBoundingClientRect().right >= mX) { |
| 10418 | var line = lineAtHeight(cm.doc, mY) |
| 10419 | var gutter = cm.options.gutters[i] |
| 10420 | signal(cm, type, cm, line, gutter, e) |
| 10421 | return e_defaultPrevented(e) |
| 10422 | } |
| 10423 | } |
| 10424 | } |
| 10425 | |
| 10426 | function clickInGutter(cm, e) { |
| 10427 | return gutterEvent(cm, e, "gutterClick", true) |
no test coverage detected