Skip to content

Commit

Permalink
chore: mouse events are overrided only if windows were pinned (#4)
Browse files Browse the repository at this point in the history
This allows move multiple windows by dragging only one of them.
  • Loading branch information
ostenemes authored Jan 9, 2025
1 parent cf85e13 commit 54ecdec
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions Sources/SpringMotionPanel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -66,15 +66,15 @@ public extension SpringMotionPanel {
override func mouseDown(with event: NSEvent) {
super.mouseDown(with: event)
// Stop window from moving if the user grabbed it.
if isMovableByWindowBackground {
if isMovableByWindowBackground, anchorWindowFrameObservation != nil {
stopMotion()
}
}

override func mouseUp(with event: NSEvent) {
super.mouseUp(with: event)
// Continue movement after the user lets go.
if isMovableByWindowBackground {
if isMovableByWindowBackground, anchorWindowFrameObservation != nil {
startMotion()
}
}
Expand Down
4 changes: 2 additions & 2 deletions Sources/SpringMotionWindow.swift
Original file line number Diff line number Diff line change
Expand Up @@ -66,15 +66,15 @@ extension SpringMotionWindow {
override open func mouseDown(with event: NSEvent) {
super.mouseDown(with: event)
// Stop window from moving if the user grabbed it.
if isMovableByWindowBackground {
if isMovableByWindowBackground, anchorWindowFrameObservation != nil {
stopMotion()
}
}

override open func mouseUp(with event: NSEvent) {
super.mouseUp(with: event)
// Continue movement after the user lets go.
if isMovableByWindowBackground {
if isMovableByWindowBackground, anchorWindowFrameObservation != nil {
startMotion()
}
}
Expand Down

0 comments on commit 54ecdec

Please sign in to comment.