(cm, e, start)
| 3481 | |
| 3482 | var lastClick, lastDoubleClick; |
| 3483 | function leftButtonDown(cm, e, start) { |
| 3484 | if (ie) setTimeout(bind(ensureFocus, cm), 0); |
| 3485 | else ensureFocus(cm); |
| 3486 | |
| 3487 | var now = +new Date, type; |
| 3488 | if (lastDoubleClick && lastDoubleClick.time > now - 400 && cmp(lastDoubleClick.pos, start) == 0) { |
| 3489 | type = "triple"; |
| 3490 | } else if (lastClick && lastClick.time > now - 400 && cmp(lastClick.pos, start) == 0) { |
| 3491 | type = "double"; |
| 3492 | lastDoubleClick = {time: now, pos: start}; |
| 3493 | } else { |
| 3494 | type = "single"; |
| 3495 | lastClick = {time: now, pos: start}; |
| 3496 | } |
| 3497 | |
| 3498 | var sel = cm.doc.sel, modifier = mac ? e.metaKey : e.ctrlKey, contained; |
| 3499 | if (cm.options.dragDrop && dragAndDrop && !isReadOnly(cm) && |
| 3500 | type == "single" && (contained = sel.contains(start)) > -1 && |
| 3501 | !sel.ranges[contained].empty()) |
| 3502 | leftButtonStartDrag(cm, e, start, modifier); |
| 3503 | else |
| 3504 | leftButtonSelect(cm, e, start, type, modifier); |
| 3505 | } |
| 3506 | |
| 3507 | // Start a text drag. When it ends, see if any dragging actually |
| 3508 | // happen, and treat as a click if it didn't. |
no test coverage detected