Skip to content

Commit 54ecdec

Browse files
authored
chore: mouse events are overrided only if windows were pinned (#4)
This allows move multiple windows by dragging only one of them.
1 parent cf85e13 commit 54ecdec

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

Sources/SpringMotionPanel.swift

+2-2
Original file line numberDiff line numberDiff line change
@@ -66,15 +66,15 @@ public extension SpringMotionPanel {
6666
override func mouseDown(with event: NSEvent) {
6767
super.mouseDown(with: event)
6868
// Stop window from moving if the user grabbed it.
69-
if isMovableByWindowBackground {
69+
if isMovableByWindowBackground, anchorWindowFrameObservation != nil {
7070
stopMotion()
7171
}
7272
}
7373

7474
override func mouseUp(with event: NSEvent) {
7575
super.mouseUp(with: event)
7676
// Continue movement after the user lets go.
77-
if isMovableByWindowBackground {
77+
if isMovableByWindowBackground, anchorWindowFrameObservation != nil {
7878
startMotion()
7979
}
8080
}

Sources/SpringMotionWindow.swift

+2-2
Original file line numberDiff line numberDiff line change
@@ -66,15 +66,15 @@ extension SpringMotionWindow {
6666
override open func mouseDown(with event: NSEvent) {
6767
super.mouseDown(with: event)
6868
// Stop window from moving if the user grabbed it.
69-
if isMovableByWindowBackground {
69+
if isMovableByWindowBackground, anchorWindowFrameObservation != nil {
7070
stopMotion()
7171
}
7272
}
7373

7474
override open func mouseUp(with event: NSEvent) {
7575
super.mouseUp(with: event)
7676
// Continue movement after the user lets go.
77-
if isMovableByWindowBackground {
77+
if isMovableByWindowBackground, anchorWindowFrameObservation != nil {
7878
startMotion()
7979
}
8080
}

0 commit comments

Comments
 (0)