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)
|
||||
}
|
||||
|
||||
static func resetDeadzone() {
|
||||
deadZoneInitialPosition = nil
|
||||
isAllowedToMouseHover = false
|
||||
}
|
||||
|
||||
static func isAllowedToReactToPointerMovement(_ location: CGPoint) -> Bool {
|
||||
updateDeadzoneSituation(location)
|
||||
return isAllowedToMouseHover
|
||||
|
||||
@@ -230,6 +230,8 @@ class App: AppCenterApplication {
|
||||
}
|
||||
|
||||
static func cycleSelection(_ direction: Direction, allowWrap: Bool = true) {
|
||||
(TilesView.scrollView?.documentView as? TilesDocumentView)?.cancelDraggingTimer()
|
||||
CursorEvents.resetDeadzone()
|
||||
if direction == .up || direction == .down {
|
||||
TilesView.navigateUpOrDown(direction, allowWrap: allowWrap)
|
||||
} else {
|
||||
|
||||
@@ -736,13 +736,13 @@ class TilesDocumentView: FlippedView {
|
||||
resetDraggingState(true)
|
||||
return []
|
||||
}
|
||||
if dragTarget !== target {
|
||||
dragTarget = target
|
||||
restartDraggingTimer(location)
|
||||
} else if shouldRestartDraggingTimer(location) {
|
||||
restartDraggingTimer(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()
|
||||
}
|
||||
return .link
|
||||
@@ -764,6 +764,11 @@ class TilesDocumentView: FlippedView {
|
||||
if let dragAndDropTimer { RunLoop.main.add(dragAndDropTimer, forMode: .common) }
|
||||
}
|
||||
|
||||
func cancelDraggingTimer() {
|
||||
dragAndDropTimer?.invalidate()
|
||||
dragAndDropTimer = nil
|
||||
}
|
||||
|
||||
private func resetDraggingState(_ resetHoveredWindow: Bool) {
|
||||
lastDragLocation = nil
|
||||
dragTarget = nil
|
||||
|
||||
Reference in new issue
Block a user