Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 26 additions & 4 deletions Sources/Components/Compositions/ShapeDrawingNode.swift
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ public final class ShapeDrawingNode: ASDisplayNode, ShapeDisplaying {
var shapePath: UIBezierPath?
var shapeLineWidth: CGFloat = 0
var shapeStrokeColor: UIColor?
var userInterfaceStyle: UIUserInterfaceStyle = .unspecified
}

private final class ParameterBox: NSObject {
Expand Down Expand Up @@ -104,17 +105,38 @@ public final class ShapeDrawingNode: ASDisplayNode, ShapeDisplaying {
let backing = parameter.backing

guard let path = backing.shapePath else { return }


let userInterfaceStyle = backing.userInterfaceStyle

path.lineWidth = backing.shapeLineWidth

backing.shapeFillColor?.setFill()
backing.shapeFillColor?
.resolvedColor(with: .init(userInterfaceStyle: userInterfaceStyle))
.setFill()

path.fill()

backing.shapeStrokeColor?.setStroke()
backing.shapeStrokeColor?
.resolvedColor(with: .init(userInterfaceStyle: userInterfaceStyle))
.setStroke()

path.stroke()

}


public override func asyncTraitCollectionDidChange(
withPreviousTraitCollection previousTraitCollection: ASPrimitiveTraitCollection
) {
super.asyncTraitCollectionDidChange(withPreviousTraitCollection: previousTraitCollection)
let userInterfaceStyle = asyncTraitCollection().userInterfaceStyle
guard
self.backing.userInterfaceStyle != userInterfaceStyle
else {
return
}
self.backing.userInterfaceStyle = userInterfaceStyle
}


}