Commit d9b1901
committed
Fix picking/hover to return closest object.
Add `View.pickClosest(xp, yp, maxDistance)` function to select / return
a single object that is the closest to the mouse pointer position.
Search region is restricted based on the `pointerSize` property.
Earlier, the function simply returned/handled the first object in the
`selection` array, which was unpredictable.
This change affects the 'click' and 'hover' picking modes.
The 'select' picking mode (which uses a shift + click-drag a
rectangular region) continues to use the previous implementation,
which returns all objects within that rectangular region (selection
zone) in no particular order.1 parent 6ffe697 commit d9b1901
1 file changed
+72
-12
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
214 | 214 | | |
215 | 215 | | |
216 | 216 | | |
217 | | - | |
218 | | - | |
219 | | - | |
220 | | - | |
221 | | - | |
222 | | - | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
223 | 221 | | |
224 | 222 | | |
225 | 223 | | |
| |||
238 | 236 | | |
239 | 237 | | |
240 | 238 | | |
241 | | - | |
242 | | - | |
243 | | - | |
244 | | - | |
245 | | - | |
246 | | - | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
247 | 243 | | |
248 | 244 | | |
249 | 245 | | |
| |||
525 | 521 | | |
526 | 522 | | |
527 | 523 | | |
| 524 | + | |
| 525 | + | |
| 526 | + | |
| 527 | + | |
| 528 | + | |
| 529 | + | |
| 530 | + | |
| 531 | + | |
| 532 | + | |
| 533 | + | |
| 534 | + | |
| 535 | + | |
| 536 | + | |
| 537 | + | |
| 538 | + | |
| 539 | + | |
| 540 | + | |
| 541 | + | |
| 542 | + | |
| 543 | + | |
| 544 | + | |
| 545 | + | |
| 546 | + | |
| 547 | + | |
| 548 | + | |
| 549 | + | |
| 550 | + | |
| 551 | + | |
| 552 | + | |
| 553 | + | |
| 554 | + | |
| 555 | + | |
| 556 | + | |
| 557 | + | |
| 558 | + | |
| 559 | + | |
| 560 | + | |
| 561 | + | |
| 562 | + | |
| 563 | + | |
| 564 | + | |
| 565 | + | |
| 566 | + | |
| 567 | + | |
| 568 | + | |
| 569 | + | |
| 570 | + | |
| 571 | + | |
| 572 | + | |
| 573 | + | |
| 574 | + | |
| 575 | + | |
| 576 | + | |
| 577 | + | |
| 578 | + | |
| 579 | + | |
| 580 | + | |
| 581 | + | |
| 582 | + | |
| 583 | + | |
| 584 | + | |
| 585 | + | |
| 586 | + | |
| 587 | + | |
528 | 588 | | |
529 | 589 | | |
530 | 590 | | |
| |||
0 commit comments