From 24f9ca368bd5d23133b26c9b652a288147611d10 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A0=8D=E7=A0=8D?= Date: Tue, 20 Aug 2024 15:33:19 +0800 Subject: [PATCH] Export Render Scale --- .../ColorfulX/AnimatedMulticolorGradientView+SwiftUI.swift | 2 +- Sources/ColorfulX/AnimatedMulticolorGradientView.swift | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/Sources/ColorfulX/AnimatedMulticolorGradientView+SwiftUI.swift b/Sources/ColorfulX/AnimatedMulticolorGradientView+SwiftUI.swift index 76537f0..14b97d3 100644 --- a/Sources/ColorfulX/AnimatedMulticolorGradientView+SwiftUI.swift +++ b/Sources/ColorfulX/AnimatedMulticolorGradientView+SwiftUI.swift @@ -45,7 +45,7 @@ public struct AnimatedMulticolorGradientViewRepresentable { public func updatePropertyToView(_ view: AnimatedMulticolorGradientView, initialSetup: Bool) { view.frameLimit = frameLimit - view.metalLink?.scaleFactor = renderScale + view.renderScale = renderScale view.setColors( color, diff --git a/Sources/ColorfulX/AnimatedMulticolorGradientView.swift b/Sources/ColorfulX/AnimatedMulticolorGradientView.swift index 5888972..5a81be1 100644 --- a/Sources/ColorfulX/AnimatedMulticolorGradientView.swift +++ b/Sources/ColorfulX/AnimatedMulticolorGradientView.swift @@ -54,6 +54,11 @@ open class AnimatedMulticolorGradientView: MulticolorGradientView { didSet { renderInputWasModified = true } } + public var renderScale: Double { + get { metalLink?.scaleFactor ?? 1 } + set { metalLink?.scaleFactor = newValue } + } + // MARK: - FUNCTION override public init() {