fix: delete-area hit testing at non-default zoom (#10095) - #10096
Conversation
|
CI on this PR is failing because I opened a separate chore PR to fix I rebased |
lizschwab
left a comment
There was a problem hiding this comment.
Looks good once we get CI happy again
This reverts commit 3366b79.
|
I think this PR is correct and a net simplification but I was puzzled about the mechanism behind the bug as I felt the coordinates should roundtrip ok. After poking around with Claude I think this is what went wrong:
This explains why the red-cross cursor still shows (call 1, wouldDeleteDraggable, sees the correct coordinate) but things controlled by later calls go wrong (trashcan lid). From a non-Blockly-team perspective it seems a footgun that wsToScreenCoordinates mutates its argument. This seems like it might be an easy fix. I feel the same way about Coordinate's fluent-but-mutating API but that is a much more disruptive change. |
|
@mikeharv, interested in what you think about the mutability in wsToScreenCoordinates, worth some clean-up? |
The basics
The details
Resolves
Fixes #10095
Proposed Changes
Hit-test delete areas now us client/viewport coordinates (
clientX/clientY) instead of a client-to-workspace-to-client round-tripReason for Changes
After #10078, delete styling would still appear at non-default zoom but blocks were not reliably deleted and the trashcan lid did not animate. The coordinate round-trip misaligned hit tests with
getBoundingClientRect()at certain zoom levels, but using client coordinates fixes that.Test Coverage
dragger_test.jswith generated trashcan/toolbox delete tests at zoom 0.7 and 1.5 (delete style, trashcan lid, disposal)