Skip to content

fix(ui): clamp drag previews to overlay bounds - #4069

Open
Radium000 wants to merge 1 commit into
noctalia-dev:mainfrom
Radium000:fix/drag-preview-bounds
Open

fix(ui): clamp drag previews to overlay bounds#4069
Radium000 wants to merge 1 commit into
noctalia-dev:mainfrom
Radium000:fix/drag-preview-bounds

Conversation

@Radium000

Copy link
Copy Markdown

Summary

  • Keep drag previews fully inside the overlay bounds.
  • Update both coordinates independently when the pointer moves beyond an edge.
  • Account for the preview scale when calculating its allowed position.
  • Add regression tests for edge clamping and movement parallel to an edge.

Motivation

When a drag preview reached an overlay boundary, it could either stop moving
completely or remain partially outside the overlay.

Node::mapFromScene() still calculates the local coordinates when the pointer
is outside the overlay, but returns false because the mapped point is not
contained by the node. DragDropController::updatePreview() previously
discarded the entire update in that case.

This also prevented movement along the unaffected axis. For example, after
reaching the left edge, moving the pointer vertically no longer moved the
preview.

The new behavior uses the calculated coordinates and clamps each axis
independently. The preview therefore remains fully visible while continuing
to follow pointer movement parallel to the overlay edge.

Type of Change

  • Bug fix

Related Issue

N/A — reproduced and verified locally against Noctalia v5.

Testing

  • Ran just format with clang-format 22.1.8.
  • Ran just test debug --print-errorlogs: 91/91 tests passed.
  • Added regression tests for clamping and movement along overlay edges.
  • Manually verified on Hyprland.

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.

1 participant