Skip to content

Mutator Delete Areas Incorrect After Zoom When Dragging from Flyout #2319

@BeksOmega

Description

@BeksOmega

Problem statement

The delete areas are incorrect after zooming, specifically when you drag from the flyout. Delete areas are not recalculated when dragging from the flyout unless there document has been scrolled. They are recalculated when there is an event on the workspace, e.g. a move event, or a delete event. This means that the behavior works correctly when dragging from the workspace to the flyout after zoom, but not the other way around.

Expected Behavior

Delete areas should be calculated correctly, so that blocks are always deleted when dropped on the flyout, and not otherwise.

Actual Behavior

Delete areas are not recalculated, this causes blocks to be deleted when you do not expect it, and to not be deleted when you do expect it.

Steps to Reproduce

  1. Add a 'controls_if' block to the playground.
  2. Open its mutator and drag a block out of the flyout. This activates updateScreenCalculationsIfScrolled_ before we zoom, so that it won't activate after we zoom.
  3. Zoom the workspace in.
  4. Drag a block from the flyout, observe how the delete area of the flyout is incorrect.

Stack Traces

Initial drag from flyout that fires the recalculation:

Blockly.WorkspaceSvg.recordDeleteAreas | @ | workspace_svg.js:1188
-- | -- | --
  | Blockly.WorkspaceSvg.updateScreenCalculations_ | @ | workspace_svg.js:717
  | Blockly.WorkspaceSvg.updateScreenCalculationsIfScrolled | @ | workspace_svg.js:776
  | Blockly.Gesture.updateIsDraggingFromFlyout_ | @ | gesture.js:336
  | Blockly.Gesture.updateIsDraggingBlock_ | @ | gesture.js:385
  | Blockly.Gesture.updateIsDragging_ | @ | gesture.js:441
  | Blockly.Gesture.updateFromEvent_ | @ | gesture.js:287
  | Blockly.Gesture.handleMove | @ | gesture.js:542
  | Blockly.TouchGesture.handleMove | @ | touch_gesture.js:181
  | wrapFunc

Operating System and Browser

I am assuming this is not browser specific.

Additional Information

Suggestions:

  • Add a call here to update the delete areas even if the document isn't scrolled, but only for mutators.
  • Wait until zoom events are a thing, which should fix this automatically (as well as allow a call to be removed from the main workspace).

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions