Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Selection Rectangle Bulk Delete Implementation #3873

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

KobeGuo99
Copy link

Description:
This pull request introduces a new feature that allows users to bulk delete non-connected blocks by dragging a selection rectangle around them. This feature was integrated into activity.js and includes several new functions to handle user interactions with the canvas, such as mouse down, move, and up events, along with keypress detection for deletions.

Functions Added:
initializeSelectionEvents(): Sets up the event listeners for the canvas.
mouseDownHandler(event), mouseMoveHandler(event), mouseUpHandler(event): Handlers for mouse events to manage selection rectangle.
keyDownHandler(event): Detects the 'Delete' key to trigger the deletion of selected blocks.
updateCanvas(): Redraws the canvas, refreshing the display after block deletion.
drawSelectionRectangle(context): Draws the selection rectangle during the selection process.
findBlocksInSelection(): Identifies blocks within the selection rectangle, returning an array of block IDs. It calculates the selection bounds and checks each block's bounds to determine if it falls within the selection area.
deleteSelectedBlocks(): Deletes all blocks that have been selected. It iterates through the list of selected block IDs and removes each one, updating the canvas afterwards.
getBlockBounds(blockId): Retrieves the bounding box of a block, providing its position and dimensions. This function is essential for determining whether a block is within the selection rectangle.
removeBlock(blockId): Removes a block from the system and ensures that all references are properly cleared. This includes removing the block's visual representation and calling

Known Issues:
Canvas Interaction Limitation: Due to current limitations in the canvas interaction implementation, the selection rectangle does not trigger block deletions as expected. This might have something to do with the initialization of activity.js.

Request for Assistance:
I am seeking feedback and assistance on the following specific issues:
Enhancing Canvas Interactivity: Guidance on improving the interactivity of the canvas to ensure that the selection rectangle can effectively trigger block deletions, primarily with the initialization of activity.js.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant