Refuse a placement aimed at the toolbar, and say why (#33) #1124
No reviewers
Labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
jaylouisw/packetforge!1124
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "fix/place-under-toolbar"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
The toolbar is HTML floating over the drawing surface. A press that starts on the canvas and is released over the toolbar still arrives at the SVG — pointer capture keeps sending it there — so the app placed the device at those coordinates. The device existed on the server, was painted on the drawing, and sat underneath the panel, where it could not be clicked, dragged or deleted. From the user's side the drop worked and the device vanished.
The fix
Placement now asks the document what is actually at that pixel:
Anything that is not the SVG, and not inside it, is an overlay, and a placement aimed at an overlay places nothing. The user is told — "was not placed: that spot is under the toolbar. Click the canvas." — and placing mode stays armed, so the next click works without reselecting the device from the palette.
Why the rule is testable
elementCoversPointis pure and exported asPFCanvas.elementCoversPoint, so the interesting cases run without a browser: the toolbar blocks, a device inside the surface does not, the surface itself does not, nothing reported does not block on a guess, and a throwingelementFromPointis survivable (feature-detected, wrapped).21 checks — the rule, the placement branch, the callback table, and that
app.jstoasts the cause without disarming placing mode.Full suite: 112 suites, 4968 assertions, 0 failed. Closes #33.