Closed gavinhenderson closed 2 weeks ago
@willwade would you say this is a feature we need in v1 or something we can scope to v2?
V2
in settings
var allowFirstLoopFastScan: Bool = false
Maybe just adjust setNextMoveTimer and the scanning speed based on the current loop.
private func setNextMoveTimer() throws {
if disableScanningAsHidden { return }
let maxScanLoops = settings?.scanLoops ?? 0
guard let siblings = hoveredNode.parent?.getChildren("setnextmovetimer") else {
try clickNode(settings?.currentVocab?.rootNode, isStartup: true)
throw EchoError.noSiblings
}
let newWorkItem = DispatchWorkItem(block: {
do {
try self.nextNode(siblings)
} catch {
self.errorHandling?.handle(error: error)
}
})
workItem = newWorkItem
// Determine the scanning speed based on the current loop and settings
let isFirstLoop = scanLoops == 0
let timeInterval: Double
if isFirstLoop && settings?.allowFirstLoopFastScan == true {
timeInterval = settings?.scanWaitTime ?? 3 / 2 // Fast scan (half the normal time)
} else {
timeInterval = settings?.scanWaitTime ?? 3 // Regular scan
}
if hoveredNode.index ?? 0 == siblings.count - 1 {
scanLoops += 1
}
if scanLoops < maxScanLoops {
DispatchQueue.main.asyncAfter(deadline: .now() + timeInterval, execute: newWorkItem)
}
}
and in UI settings
Toggle("Allow First Loop Fast Scan", isOn: $settings.allowFirstLoopFastScan)
Doing it like this pros: No need to set speed. Cons: you cant set speed.
A user might want to have a really fast scan through the options but if they miss what they want they might want to do a slower second scan.