(code, x, y)
| 464 | code.stop(); |
| 465 | } |
| 466 | onTouchSelect(code, x, y) { |
| 467 | var anchor = this.anchor; |
| 468 | var bounds = code.bounds; |
| 469 | var offset = code.hitOffset(x - bounds.x, y - bounds.y); |
| 470 | if (this.mode == LINE_MODE) { |
| 471 | if (anchor.from < offset) |
| 472 | offset = code.findLineBreak(offset, true); |
| 473 | else |
| 474 | offset = code.findLineBreak(offset, false); |
| 475 | } |
| 476 | else if (this.mode == WORD_MODE) { |
| 477 | if (anchor.from < offset) |
| 478 | offset = code.findWordBreak(offset, true); |
| 479 | else |
| 480 | offset = code.findWordBreak(offset, false); |
| 481 | } |
| 482 | if (anchor.from < offset) |
| 483 | code.select(anchor.from, offset - anchor.from); |
| 484 | else |
| 485 | code.select(offset, anchor.to - offset); |
| 486 | } |
| 487 | }; |
| 488 | |
| 489 | export class CodeScrollerBehavior extends ScrollerBehavior { |
no test coverage detected