Fixed bug that setting frequency didn't work
This commit is contained in:
parent
210ca5a41f
commit
b7f9a2a5f7
|
@ -20,7 +20,7 @@ struct FlickerCodeTanView: View {
|
||||||
@State private var showBit4: Bool = true
|
@State private var showBit4: Bool = true
|
||||||
@State private var showBit5: Bool = true
|
@State private var showBit5: Bool = true
|
||||||
|
|
||||||
private let animator: FlickerCodeAnimator = FlickerCodeAnimator()
|
@State private var animator: FlickerCodeAnimator = FlickerCodeAnimator() // real curious bug: if @State is omitted setting frequency doesn't work (why?)
|
||||||
|
|
||||||
|
|
||||||
private var tanMethodSettings: TanMethodSettings? = nil
|
private var tanMethodSettings: TanMethodSettings? = nil
|
||||||
|
@ -33,7 +33,7 @@ struct FlickerCodeTanView: View {
|
||||||
set: {
|
set: {
|
||||||
if (self.frequency != $0) {
|
if (self.frequency != $0) {
|
||||||
let newFrequency = $0
|
let newFrequency = $0
|
||||||
|
|
||||||
self.animator.setFrequency(frequency: Int(newFrequency))
|
self.animator.setFrequency(frequency: Int(newFrequency))
|
||||||
|
|
||||||
DispatchQueue.main.async {
|
DispatchQueue.main.async {
|
||||||
|
@ -85,7 +85,7 @@ struct FlickerCodeTanView: View {
|
||||||
self._scaleFactor = State(initialValue: CGFloat(settings.width))
|
self._scaleFactor = State(initialValue: CGFloat(settings.width))
|
||||||
self._frequency = State(initialValue: CGFloat(settings.frequency))
|
self._frequency = State(initialValue: CGFloat(settings.frequency))
|
||||||
}
|
}
|
||||||
|
|
||||||
animator.setFrequency(frequency: Int(frequency))
|
animator.setFrequency(frequency: Int(frequency))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue