Skip to content

Add mouse drag support for page navigation#99

Open
WaikikiGovernment with Copilot wants to merge 7 commits into
mainfrom
copilot/add-mouse-dragging-support
Open

Add mouse drag support for page navigation#99
WaikikiGovernment with Copilot wants to merge 7 commits into
mainfrom
copilot/add-mouse-dragging-support

Conversation

Copilot AI commented Dec 4, 2025

Copy link
Copy Markdown
Contributor

macOS Launchpad supports click-and-drag page navigation with a regular mouse. LaunchpadPlus only supported trackpad swipes and mouse wheel scrolling.

Implementation

State tracking

  • isMouseDragging, dragStartPage, dragOffset, pageWidth, allowBackgroundDrag
  • Constants: 10px initiation threshold, 100px page change threshold

Event handling

  • Added .leftMouseDown, .leftMouseDragged, .leftMouseUp to event monitor
  • Three lifecycle handlers: initiate → track movement → complete gesture

Visual feedback

  • calculatePageOffset() adds real-time drag offset to base page position
  • Animation disabled during drag for immediate cursor tracking
  • Spring animation on release for smooth page transitions

Behavior

  • Drag initiation requires 10px movement to avoid false positives
  • Page change requires 100px drag distance (or 15% of page width), otherwise snaps back
  • Only triggers when drag starts on background/empty space - preserves app icon drag-and-drop
  • Guards against interference from search/folders/settings/categories

Background detection

  • Added transparent background layer in SinglePageView to detect clicks on empty space
  • DragGesture on background layer sets allowBackgroundDrag flag
  • Page navigation only proceeds if drag initiated on background
  • App icons consume their own drag events, preventing page navigation conflict
private func calculatePageOffset(width: CGFloat) -> CGFloat {
   let baseOffset = -CGFloat(currentPage) * width
   if isMouseDragging {
      return baseOffset + dragOffset
   }
   return baseOffset
}
Original prompt

This section details on the original issue you should resolve

<issue_title>No Mouse dragging Support</issue_title>
<issue_description># Description :
Swiping to other LaunchpadPlus pages using a regular mouse is not possible unlike on the real Launchpad found in MacOS Sequoia and should therefore be added

Plattform Infos :

Host : Macbook Pro M5
OS : MacOS TheHoe 26.1 (25B78)
LaunchpadPlus Branch : main</issue_description>

Comments on the Issue (you are @copilot in this section)


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI self-assigned this Dec 4, 2025
Copilot AI and others added 3 commits December 4, 2025 10:41
Co-authored-by: WaikikiGovernment <93095571+WaikikiGovernment@users.noreply.github.com>
Co-authored-by: WaikikiGovernment <93095571+WaikikiGovernment@users.noreply.github.com>
Co-authored-by: WaikikiGovernment <93095571+WaikikiGovernment@users.noreply.github.com>
Copilot AI changed the title [WIP] Add mouse dragging support for LaunchpadPlus Add mouse drag support for page navigation Dec 4, 2025
@WaikikiGovernment WaikikiGovernment marked this pull request as ready for review December 4, 2025 10:53
@WaikikiGovernment

Copy link
Copy Markdown
Collaborator

@copilot It should only trigger page navigation if drag starts on the background.

Copilot AI and others added 2 commits December 4, 2025 12:20
Co-authored-by: WaikikiGovernment <93095571+WaikikiGovernment@users.noreply.github.com>
Co-authored-by: WaikikiGovernment <93095571+WaikikiGovernment@users.noreply.github.com>

Copilot AI commented Dec 4, 2025

Copy link
Copy Markdown
Contributor Author

@copilot It should only trigger page navigation if drag starts on the background.

Done! The mouse drag navigation now only triggers when the drag starts on the background (empty space). I've added a background detection layer in SinglePageView that sets a flag when clicked, and the page navigation only proceeds if this flag is set. This ensures that dragging app icons for reordering continues to work normally. (commit 1015e5f)

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.

No Mouse dragging Support

3 participants