(cm, e, start)
| 2529 | |
| 2530 | var lastClick, lastDoubleClick; |
| 2531 | function leftButtonDown(cm, e, start) { |
| 2532 | setTimeout(bind(ensureFocus, cm), 0); |
| 2533 | |
| 2534 | var now = +new Date, type; |
| 2535 | if (lastDoubleClick && lastDoubleClick.time > now - 400 && cmp(lastDoubleClick.pos, start) == 0) { |
| 2536 | type = "triple"; |
| 2537 | } else if (lastClick && lastClick.time > now - 400 && cmp(lastClick.pos, start) == 0) { |
| 2538 | type = "double"; |
| 2539 | lastDoubleClick = {time: now, pos: start}; |
| 2540 | } else { |
| 2541 | type = "single"; |
| 2542 | lastClick = {time: now, pos: start}; |
| 2543 | } |
| 2544 | |
| 2545 | var sel = cm.doc.sel, addNew = mac ? e.metaKey : e.ctrlKey; |
| 2546 | if (cm.options.dragDrop && dragAndDrop && !addNew && !isReadOnly(cm) && |
| 2547 | type == "single" && sel.contains(start) > -1 && sel.somethingSelected()) |
| 2548 | leftButtonStartDrag(cm, e, start); |
| 2549 | else |
| 2550 | leftButtonSelect(cm, e, start, type, addNew); |
| 2551 | } |
| 2552 | |
| 2553 | // Start a text drag. When it ends, see if any dragging actually |
| 2554 | // happen, and treat as a click if it didn't. |
no test coverage detected