feat(settings): 默认启用短动效并提供独立减弱动画选项

This commit is contained in:
2026-11-04 11:53:17 +08:00
parent 40a7a55edf
commit f18f6652ff
23 changed files with 443 additions and 34 deletions
+15 -1
View File
@@ -30,7 +30,10 @@ import AppKit
windowNumber: controller.panel.isVisible ? controller.panel.windowNumber : nil,
hoveredPlots: views.filter { $0.input?.hoveredIndex != nil }.count, nativePlots: views.count,
pointerInsidePanel: controller.panel.isVisible && controller.panel.frame.contains(NSEvent.mouseLocation),
plotBounds: views.map { [Double($0.bounds.width), Double($0.bounds.height)] })
plotBounds: views.map { [Double($0.bounds.width), Double($0.bounds.height)] },
animatedPlots: views.filter { $0.input?.animates == true }.count)
if event == "open1.10", ProcessInfo.processInfo.environment["KYMO_AUDIT_CAPTURE"] == "1",
let content = controller.panel.contentView { capture(content) }
}
func wait(_ seconds: Int) async { try? await Task.sleep(for: .seconds(seconds)) }
// Pin the test window so unrelated focus changes cannot invalidate a measurement.
@@ -59,6 +62,17 @@ import AppKit
NSApp.terminate(nil)
}
}
/// Captures only our own hosted panel, never the desktop. Excluded from normal Release.
private static func capture(_ content: NSView) {
guard content.bounds.width > 0, content.bounds.height > 0,
content.bounds.width * content.bounds.height <= 1_100_000,
let bitmap = content.bitmapImageRepForCachingDisplay(in: content.bounds) else { return }
content.cacheDisplay(in: content.bounds, to: bitmap)
guard let png = bitmap.representation(using: .png, properties: [:]),
let data = try? JSONSerialization.data(withJSONObject: ["event": "audit.capture", "png": png.base64EncodedString()]) else { return }
try? FileHandle.standardOutput.write(contentsOf: data + Data([10]))
}
/// Uses real connection lifecycle but injects local callbacks; peer auth is tested separately by RPCs.
private static func checkRequestCompletion() async {
for _ in 0..<20 {