(event: PointerEvent)
| 521 | } |
| 522 | |
| 523 | grab(event: PointerEvent) { |
| 524 | this.page.clickSelection.perform(this, event); |
| 525 | |
| 526 | if (this.page.react.readOnly) { |
| 527 | return; |
| 528 | } |
| 529 | |
| 530 | const path = document.querySelector( |
| 531 | `#arrow-${this.id} .arrow`, |
| 532 | ) as SVGPathElement; |
| 533 | |
| 534 | if (path == null) { |
| 535 | return; |
| 536 | } |
| 537 | |
| 538 | const absoluteWorldPos = this.page.pos.clientToWorld( |
| 539 | new Vec2(event.clientX, event.clientY), |
| 540 | ); |
| 541 | |
| 542 | const originWorldPos = this.react.interregional |
| 543 | ? this.react.region.react.islandRoot.getOriginWorldPos() |
| 544 | : this.react.region.getOriginWorldPos(); |
| 545 | |
| 546 | if (originWorldPos == null) { |
| 547 | return; |
| 548 | } |
| 549 | |
| 550 | const relativeWorldPos = absoluteWorldPos.sub(originWorldPos); |
| 551 | |
| 552 | if (getClosestPathPointPercent(path, relativeWorldPos) < 0.5) { |
| 553 | listenPointerEvents(event, { |
| 554 | dragStartDistance: 5, |
| 555 | |
| 556 | dragStart: () => { |
| 557 | this.page.arrowCreation.start({ |
| 558 | anchorNote: this.react.targetNote, |
| 559 | looseEndpoint: 'source', |
| 560 | baseArrow: this, |
| 561 | event, |
| 562 | }); |
| 563 | |
| 564 | this.delete(); |
| 565 | }, |
| 566 | }); |
| 567 | } else { |
| 568 | listenPointerEvents(event, { |
| 569 | dragStartDistance: 5, |
| 570 | |
| 571 | dragStart: () => { |
| 572 | this.page.arrowCreation.start({ |
| 573 | anchorNote: this.react.sourceNote, |
| 574 | looseEndpoint: 'target', |
| 575 | baseArrow: this, |
| 576 | event, |
| 577 | }); |
| 578 | |
| 579 | this.delete(); |
| 580 | }, |
nothing calls this directly
no test coverage detected