You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to change color of shape using following code: @discardableResult public func replaceColors(node: Node, color: Fill?) -> Bool {
if let shape = node as? Shape {
shape.fill = color
return true
}
return false
}
At that moment, following code will be called:
group.contentsVar.onChange { [weak self] _ in
self?.updateRenderers()
}
if let updatedRenderers = group?.contents.compactMap ({ child -> NodeRenderer? in
guard let interval = renderingInterval else {
print("setNeedsDisplay=6-2")
return RenderUtils.createNodeRenderer(child, view: view, animationCache: animationCache)
}
let index = AnimationUtils.absoluteIndex(child, useCache: true)
if index > interval.from && index < interval.to {
print("setNeedsDisplay=6-3")
return RenderUtils.createNodeRenderer(child, view: view, animationCache: animationCache, interval: interval)
}
return .none
}) {
renderers = updatedRenderers
}
}
Btw when the color of shape is changed, updateRenderers() will be called much time.
It lowered the speed of the app.
How can we call updateRenderers() only once for changed shape?
The text was updated successfully, but these errors were encountered:
I'm trying to change color of shape using following code:
@discardableResult public func replaceColors(node: Node, color: Fill?) -> Bool {
if let shape = node as? Shape {
shape.fill = color
return true
}
return false
}
At that moment, following code will be called:
group.contentsVar.onChange { [weak self] _ in
self?.updateRenderers()
}
private func updateRenderers() {
renderers.forEach { $0.dispose() }
renderers.removeAll()
Btw when the color of shape is changed, updateRenderers() will be called much time.
It lowered the speed of the app.
How can we call updateRenderers() only once for changed shape?
The text was updated successfully, but these errors were encountered: