Open Jomy10 opened 2 years ago
Describe the bug Canvas doesn't draw a Path when Path.addRect is called before adding it to the GraphicsContext using GraphicsContext.fill.
Canvas
Path
Path.addRect
GraphicsContext
GraphicsContext.fill
(I have not tested this for other functions on Rect)
Rect
To Reproduce For the app:
struct TokamakApp: App { var body: some Scene { WindowGroup("Tokamak App") { ContentView() } } } struct ContentView: View { var body: some View { Canvas(renderer: renderer) } }
Then for our renderer function:
renderer
func renderer(gc: inout GraphicsContext, cSizee: CGSize) { var path = Path(CGRect(x: 0, y: 0, width: 10, height: 10)) path.addRect(CGRect(x: 0, y: 15, width: 10, height: 10)) gc.fill(path, with: .color(.red)) }
This will not draw the path to the screen (see first screenshot)
If we instead have the following renderer function:
func renderer(gc: inout GraphicsContext, cSizee: CGSize) { var path = Path(CGRect(x: 0, y: 0, width: 10, height: 10)) gc.fill(path, with: .color(.red)) }
Then it does draw to the screen (see second screenshot)
Expected behavior Two rectangles should be drawn to the screen (see third screenshot), but none are being drawn.
Screenshots For the first renderer function:
For the second renderer function:
In SwiftUI using the first renderer function (expected output):
Desktop (please complete the following information):
Additional context None I can think of
Describe the bug
Canvas
doesn't draw aPath
whenPath.addRect
is called before adding it to theGraphicsContext
usingGraphicsContext.fill
.(I have not tested this for other functions on
Rect
)To Reproduce For the app:
Then for our
renderer
function:This will not draw the path to the screen (see first screenshot)
If we instead have the following
renderer
function:Then it does draw to the screen (see second screenshot)
Expected behavior Two rectangles should be drawn to the screen (see third screenshot), but none are being drawn.
Screenshots For the first
renderer
function:For the second
renderer
function:In SwiftUI using the first
renderer
function (expected output):Desktop (please complete the following information):
Additional context None I can think of