Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Fix shape-specific grid container sizing #1294

Merged
merged 5 commits into from
May 5, 2023

Conversation

gavin-ts
Copy link
Contributor

@gavin-ts gavin-ts commented May 4, 2023

Summary

Use shape specific sizing for grid containers.

Details

before/after

Screen Shot 2023-05-03 at 8 01 19 PM

@gavin-ts gavin-ts marked this pull request as ready for review May 4, 2023 03:06
@gavin-ts gavin-ts requested a review from a team May 4, 2023 03:06
@gavin-ts gavin-ts enabled auto-merge May 4, 2023 03:06
d2graph/d2graph.go Outdated Show resolved Hide resolved
@gavin-ts gavin-ts force-pushed the fix-grid-container-sizing branch from 9f9b464 to 5a3fa6b Compare May 4, 2023 23:41
@gavin-ts gavin-ts requested a review from alixander May 4, 2023 23:42
d2graph/d2graph.go Outdated Show resolved Hide resolved
@gavin-ts gavin-ts requested a review from alixander May 5, 2023 04:00
@gavin-ts gavin-ts merged commit c73397c into terrastruct:master May 5, 2023
shapeType := d2target.DSL_SHAPE_TO_SHAPE_TYPE[dslShape]
s := shape.NewShape(shapeType, geo.NewBox(geo.NewPoint(0, 0), contentWidth, contentHeight))

var fitWidth, fitHeight float64
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be a method in shape to avoid having to consider this everywhere

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is because we don't place labels inside the person shape, if we were fitting the shape to the label size, it would use the func below

} else {
fitWidth, fitHeight = s.GetDimensionsToFit(contentWidth, contentHeight, paddingX, paddingY)
}
obj.Width = math.Max(float64(desiredWidth), fitWidth)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not obeying the set size. Only if it is smaller than the content.
From what I remember, we simply ignore the set size for containers. Maybe, it should be same here. It doesn't make much sense to be different from the current behavior

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated tala to use desiredWidth as long as content fits

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

grid: container title is hided
3 participants