feat: refinements on mouse hover and dragging (#5350)
This commit is contained in:
1 parent
a867171a45
commit
643cc80ae0
3 files changed
+18
-6
No files matched your search
@@ -109,6 +109,11 @@ class CursorEvents {
|
|||||||
return Unmanaged.passUnretained(cgEvent)
|
return Unmanaged.passUnretained(cgEvent)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static func resetDeadzone() {
|
||||||
|
deadZoneInitialPosition = nil
|
||||||
|
isAllowedToMouseHover = false
|
||||||
|
}
|
||||||
|
|
||||||
static func isAllowedToReactToPointerMovement(_ location: CGPoint) -> Bool {
|
static func isAllowedToReactToPointerMovement(_ location: CGPoint) -> Bool {
|
||||||
updateDeadzoneSituation(location)
|
updateDeadzoneSituation(location)
|
||||||
return isAllowedToMouseHover
|
return isAllowedToMouseHover
|
||||||
|
|||||||
@@ -230,6 +230,8 @@ class App: AppCenterApplication {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static func cycleSelection(_ direction: Direction, allowWrap: Bool = true) {
|
static func cycleSelection(_ direction: Direction, allowWrap: Bool = true) {
|
||||||
|
(TilesView.scrollView?.documentView as? TilesDocumentView)?.cancelDraggingTimer()
|
||||||
|
CursorEvents.resetDeadzone()
|
||||||
if direction == .up || direction == .down {
|
if direction == .up || direction == .down {
|
||||||
TilesView.navigateUpOrDown(direction, allowWrap: allowWrap)
|
TilesView.navigateUpOrDown(direction, allowWrap: allowWrap)
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -736,13 +736,13 @@ class TilesDocumentView: FlippedView {
|
|||||||
resetDraggingState(true)
|
resetDraggingState(true)
|
||||||
return []
|
return []
|
||||||
}
|
}
|
||||||
if dragTarget !== target {
|
|
||||||
dragTarget = target
|
|
||||||
restartDraggingTimer(location)
|
|
||||||
} else if shouldRestartDraggingTimer(location) {
|
|
||||||
restartDraggingTimer(location)
|
|
||||||
}
|
|
||||||
if let window, CursorEvents.isAllowedToReactToPointerMovement(window.convertPoint(toScreen: location)) {
|
if let window, CursorEvents.isAllowedToReactToPointerMovement(window.convertPoint(toScreen: location)) {
|
||||||
|
if dragTarget !== target {
|
||||||
|
dragTarget = target
|
||||||
|
restartDraggingTimer(location)
|
||||||
|
} else if shouldRestartDraggingTimer(location) {
|
||||||
|
restartDraggingTimer(location)
|
||||||
|
}
|
||||||
target.mouseMovedCallback()
|
target.mouseMovedCallback()
|
||||||
}
|
}
|
||||||
return .link
|
return .link
|
||||||
@@ -764,6 +764,11 @@ class TilesDocumentView: FlippedView {
|
|||||||
if let dragAndDropTimer { RunLoop.main.add(dragAndDropTimer, forMode: .common) }
|
if let dragAndDropTimer { RunLoop.main.add(dragAndDropTimer, forMode: .common) }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func cancelDraggingTimer() {
|
||||||
|
dragAndDropTimer?.invalidate()
|
||||||
|
dragAndDropTimer = nil
|
||||||
|
}
|
||||||
|
|
||||||
private func resetDraggingState(_ resetHoveredWindow: Bool) {
|
private func resetDraggingState(_ resetHoveredWindow: Bool) {
|
||||||
lastDragLocation = nil
|
lastDragLocation = nil
|
||||||
dragTarget = nil
|
dragTarget = nil
|
||||||
|
|||||||
Reference in new issue
Block a user