Skip to content

Commit 8396cd0

Browse files
committed
🎨 Format
1 parent 2f63ae0 commit 8396cd0

6 files changed

Lines changed: 30 additions & 29 deletions

File tree

‎Loop/Core/LoopManager.swift‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,10 +65,10 @@ final class LoopManager {
6565
},
6666
checkIfLoopOpen: { [weak self] in self?.isLoopActive ?? false }
6767
)
68-
68+
6969
private(set) lazy var multitouchTrigger = MultitouchTrigger(
7070
windowActionCache: windowActionCache,
71-
openCallback: { [weak self] action in
71+
openCallback: { [weak self] action in
7272
Task {
7373
await self?.openLoop(startingAction: action)
7474
}
@@ -333,7 +333,7 @@ extension LoopManager {
333333
if resizeContext.action.direction.isNoOp || resizeContext.action.willManipulateExistingWindowFrame {
334334
if let targetWindow = resizeContext.window {
335335
let screenSwitchingCustomActionName = "autogenerated_screen_switching_action"
336-
336+
337337
if let lastAction = await WindowRecords.shared.getCurrentAction(for: targetWindow),
338338
lastAction.getName() != screenSwitchingCustomActionName,
339339
!lastAction.forceProportionalFrameOnScreenChange {

‎Loop/Core/Observers/MultitouchTrigger.swift‎

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
// Created by Kai Azim on 2026-01-30.
66
//
77

8-
import Subsurface
98
import Scribe
9+
import Subsurface
1010
import SwiftUI
1111

1212
@Loggable
@@ -27,7 +27,7 @@ final class MultitouchTrigger {
2727
private var maxTouchesInCurrentGesture: Int = 0
2828
private var isCurrentGestureRejected = false
2929
private var didOpenLoopWithThisGesture = false
30-
30+
3131
private var lastTriggeredActionIndex: Int?
3232
private var lastTriggeredDistance: CGFloat = 0
3333
private var lastTriggeredZoomDistance: CGFloat = 0
@@ -40,7 +40,7 @@ final class MultitouchTrigger {
4040
}
4141

4242
private var positionHistory: [PositionHistoryEntry] = []
43-
private let maxHistoryEntries = 5 // Track last 5 positions for smoothing
43+
private let maxHistoryEntries = 5 // Track last 5 positions for smoothing
4444

4545
private let initialGestureThreshold: CGFloat = 0.025
4646
private let gestureRepeatThreshold: CGFloat = 0.25
@@ -122,7 +122,7 @@ final class MultitouchTrigger {
122122
guard let originInfo = originGestureInfo, let lastInfo = lastGestureInfo else {
123123
// Check if cursor is over a titlebar before activating
124124
guard isCursorOverTitlebar() else {
125-
isCurrentGestureRejected = true // Mark as rejected to skip future events
125+
isCurrentGestureRejected = true // Mark as rejected to skip future events
126126
return
127127
}
128128

@@ -132,7 +132,7 @@ final class MultitouchTrigger {
132132
lastGestureInfo = info
133133
lastTriggeredActionIndex = nil
134134
lastTriggeredDistance = 0
135-
lastTriggeredZoomDistance = info.distance // Initialize to current finger distance
135+
lastTriggeredZoomDistance = info.distance // Initialize to current finger distance
136136
gestureBlocker.start()
137137

138138
// Reset position history for new gesture
@@ -179,7 +179,7 @@ final class MultitouchTrigger {
179179
if let oldFingerDistance = fingerDistanceFromHistory() {
180180
// Use position history for stable detection
181181
let distanceChange = fingerDistance - oldFingerDistance
182-
isZooming = distanceChange > initialGestureThreshold // Use initial threshold for sensitive detection
182+
isZooming = distanceChange > initialGestureThreshold // Use initial threshold for sensitive detection
183183
} else if positionHistory.count >= 1 {
184184
// Use last frame's distance if history is building up
185185
let lastFingerDistance = lastInfo.distance
@@ -206,7 +206,7 @@ final class MultitouchTrigger {
206206
lastTriggeredActionIndex = centerActionIndex
207207
lastTriggeredDistance = fingerDistance
208208
triggerAction(at: centerActionIndex, from: actions[...])
209-
return // Don't process directional actions while zooming
209+
return // Don't process directional actions while zooming
210210
}
211211

212212
// Process directional actions (swiping)
@@ -238,13 +238,13 @@ final class MultitouchTrigger {
238238
magFromOrigin > 0 {
239239
let magMovement = hypot(movementDirection.width, movementDirection.height)
240240

241-
if magMovement >= initialGestureThreshold { // Only if meaningful movement occurred
241+
if magMovement >= initialGestureThreshold { // Only if meaningful movement occurred
242242
let dotProduct = movementDirection.width * vectorFromOrigin.width +
243243
movementDirection.height * vectorFromOrigin.height
244244
let cosAngle = dotProduct / (magFromOrigin * magMovement)
245245

246246
// Negative dot product means moving toward origin (opposite direction)
247-
if cosAngle < -0.5 { // ~120 degree threshold
247+
if cosAngle < -0.5 { // ~120 degree threshold
248248
originGestureInfo = info
249249
lastTriggeredActionIndex = nil
250250
lastTriggeredDistance = 0
@@ -325,7 +325,7 @@ final class MultitouchTrigger {
325325
lastGestureInfo = nil
326326
maxTouchesInCurrentGesture = 0
327327
didOpenLoopWithThisGesture = false
328-
positionHistory.removeAll() // Clear history on gesture end
328+
positionHistory.removeAll() // Clear history on gesture end
329329
}
330330

331331
private func averagePosition(of touches: [MTContact]) -> CGPoint {
@@ -382,7 +382,7 @@ final class MultitouchTrigger {
382382
/// - Parameter cardinalBias: How much larger cardinals are relative to diagonals.
383383
/// A value of 0.1 makes cardinal zones 10% wider and diagonal zones 10% narrower than uniform (0.0 = equal sizes, 1.0 = diagonals disappear).
384384
private func indexWithCardinalBias(angle: CGFloat, actionCount: Int, cardinalBias: CGFloat = 0.1) -> Int {
385-
let baseAngleSpan = (.pi * 2) / CGFloat(actionCount) // 45° for 8 actions
385+
let baseAngleSpan = (.pi * 2) / CGFloat(actionCount) // 45° for 8 actions
386386
let halfAngleSpan = baseAngleSpan / 2.0
387387

388388
// Match the original centered mapping (boundaries at ±22.5° for 8 actions)

‎Loop/Settings Window/Settings/Keybinds/Modal Views/Components/WindowActionFramedPreview.swift‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,15 @@
55
// Created by Kai Azim on 2026-02-15.
66
//
77

8-
import SwiftUI
98
import Luminare
9+
import SwiftUI
1010

1111
struct WindowActionFramedPreview: View {
1212
@ObservedObject private var accentColorController: AccentColorController = .shared
1313
@Environment(\.luminareAnimation) private var luminareAnimation
1414
@State private var frame: CGRect = .zero
1515
let action: WindowAction
16-
16+
1717
var body: some View {
1818
ScreenView(isBlurred: action.sizeMode != .custom) {
1919
GeometryReader { geo in
@@ -42,7 +42,7 @@ struct WindowActionFramedPreview: View {
4242
}
4343
}
4444
}
45-
45+
4646
private var blurredWindow: some View {
4747
VisualEffectView(material: .hudWindow, blendingMode: .withinWindow)
4848
.overlay {

‎Loop/Stashing/StashManager.swift‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ extension StashManager {
181181
else {
182182
return
183183
}
184-
184+
185185
onWindowResized(action: action, window: window, screen: screen)
186186
}
187187
} else if action.direction.willGrow

‎Loop/Stashing/StashedWindowInfo.swift‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ struct StashedWindowInfo: Equatable {
1515
let screen: NSScreen
1616
let action: WindowAction
1717

18-
// MARK: - Frame computation
18+
// MARK: - Frame computation
19+
1920
// TODO: Move to WindowFrameResolver
2021

2122
/// Computes the frame for a stashed window.

‎Loop/Window Action Indicators/Preview Window/PreviewViewModel.swift‎

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -39,28 +39,28 @@ final class PreviewViewModel: ObservableObject {
3939
Task {
4040
let isCurrentlyHidden = !isShown
4141
var paddedFrame = await context.getTargetFrame().padded
42-
42+
4343
if let bounds = context.screen?.displayBounds {
4444
paddedFrame.origin.x -= bounds.minX
4545
paddedFrame.origin.y -= bounds.minY
4646
}
47-
47+
4848
// In settings preview, actions that manipulate existing window frames (larger/smaller,
4949
// grow/shrink, move) cannot be previewed without a real window.
5050
let shouldBecomeVisible = if isSettingsPreview, context.action.willManipulateExistingWindowFrame {
5151
false
5252
} else {
5353
paddedFrame.size.area > 0
5454
}
55-
55+
5656
var newShownState: Bool = isShown
5757
var newComputedFrame: CGRect = computedFrame
58-
58+
5959
// If the window is currently shown, but needs to be hidden
6060
if !isCurrentlyHidden, !shouldBecomeVisible {
6161
newShownState = false
6262
}
63-
63+
6464
// If the window is currently hidden, but it needs to be shown.
6565
else if isCurrentlyHidden, shouldBecomeVisible {
6666
if !isScreenSwitch {
@@ -69,20 +69,20 @@ final class PreviewViewModel: ObservableObject {
6969
targetFrame: paddedFrame,
7070
context: context
7171
)
72-
72+
7373
// Set starting position without animation
7474
computedFrame = startingFrame
7575
}
76-
76+
7777
newShownState = true
7878
newComputedFrame = paddedFrame
7979
}
80-
80+
8181
// Window is already visible and should stay visible - update frame
8282
else if !isCurrentlyHidden, shouldBecomeVisible {
8383
newComputedFrame = paddedFrame
8484
}
85-
85+
8686
if isScreenSwitch {
8787
computedFrame = newComputedFrame
8888
isShown = newShownState
@@ -92,7 +92,7 @@ final class PreviewViewModel: ObservableObject {
9292
isShown = newShownState
9393
}
9494
}
95-
95+
9696
log.ui("Current previewed frame: \(computedFrame) for \(context.action)")
9797
}
9898
}

0 commit comments

Comments
 (0)