mit-cml / workspace-multiselect

A Blockly plugin that allows you to drag, select and manipulate multiple blocks in the workspace.
https://hollowman6.github.io/workspace-multiselect/multi-workspace
11 stars 12 forks source link

Fix the transparent SVG issue related to Drag to Select #56

Open HollowMan6 opened 4 months ago

HollowMan6 commented 4 months ago

Check for duplicates

Description

Currently, we rely on DragSelect to know which block gets selected. DragSelect seems to listen to the "blocks". However, it actually works by listening to the SVG path element, which is always a rectangle with some transparent parts forming a block. For irregularly shaped blocks, if you click on the transparent area that within the SVG rectangle, it will still get selected. (a mitigation has already been introduced in v0.1.4.)

Reproduction steps

See https://github.com/mit-cml/workspace-multiselect/pull/6#issuecomment-1315829670

Stack trace

No response

Screenshots

No response

Browsers

No response

HollowMan6 commented 4 months ago

After the discussion with the Blockly team, one possible way is to temporarily turn the SVG group into a canvas when the coordinates fall into the bounding box of those blockSVGs. Then we can convert coordinates and check the color of those coordinates to see if we are touching the transparent part.