Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Rectangle frame is not being set properly #185

Closed
Outcue opened this issue Jul 14, 2020 · 4 comments · Fixed by #200
Closed

Rectangle frame is not being set properly #185

Outcue opened this issue Jul 14, 2020 · 4 comments · Fixed by #200
Labels
bug Something isn't working

Comments

@Outcue
Copy link
Contributor

Outcue commented Jul 14, 2020

A simple rectangle example like this:

Rectangle()
    .background(Color.black)
    .frame(width: 100, height: 100)

is not rendering properly.

The width and height properties are being set properly on the div representing the rectangle, but the svg object that is a child of the rectangle div is not inheriting the width and height. The width and height of the svg div is 0, 0.

If the width and height of the svg object are set, the rectangle will render properly.

@MaxDesiatov MaxDesiatov added the bug Something isn't working label Jul 14, 2020
@MaxDesiatov
Copy link
Collaborator

Thanks for reporting this @Outcue!

@carson-katri do you think that something like #176 would help here? I imagine we could read width/height from the geometry proxy value and pass that to SVG?

@carson-katri
Copy link
Member

Yeah, that could work.

Another solution would be to set the width and height of SVG to 100% if no size is specified.

@MaxDesiatov
Copy link
Collaborator

I imagine setting it to 100% by default also saves some cycles that would be spent on layout updates with GeometryReader 🤔

@carson-katri
Copy link
Member

For reference, this is where the size of the SVG element is calculated: https://github.com/swiftwasm/Tokamak/blob/11af0f8d981ced3142f84e9ac1fa13e71c5ce0da/Sources/TokamakDOM/Shapes/Path.swift#L148

@MaxDesiatov MaxDesiatov changed the title Rectangle frame is not being set properly Rectangle frame is not being set properly Jul 14, 2020
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
bug Something isn't working
Development

Successfully merging a pull request may close this issue.

3 participants