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

Ruler marker resize for non-stretching grid items #6696

Merged
merged 4 commits into from
Dec 4, 2024

Conversation

ruggi
Copy link
Contributor

@ruggi ruggi commented Dec 4, 2024

Problem:

It should be possible to resize non-stretching grid items via the ruler markers.

Fix:

Because of how grids are rendered, similarly to what happened in #6691, we need to calculate the rendered dimensions of grid cells (not their contained items!) after they are rendered, since for non-stretching grid items their dimensions (via getGridChildCellCoordBoundsFromCanvas) don't match the ones of the cell(s) they are configured to target.

This PR uses the logic introduced in #6691 to calculate the size of a grid cell starting from its item, and uses that to correctly place the ruler markers for non-stretching items.

Manual Tests:
I hereby swear that:

  • I opened a hydrogen project and it loaded
  • I could navigate to various routes in Play mode

Fixes #6695

Copy link
Contributor

github-actions bot commented Dec 4, 2024

Try me

Copy link

relativeci bot commented Dec 4, 2024

#15358 Bundle Size — 58.2MiB (~+0.01%).

feb8279(current) vs d1d46c1 master#15351(baseline)

Warning

Bundle contains 70 duplicate packages – View duplicate packages

Bundle metrics  Change 2 changes Regression 1 regression
                 Current
#15358
     Baseline
#15351
Regression  Initial JS 41.17MiB(~+0.01%) 41.17MiB
No change  Initial CSS 0B 0B
Change  Cache Invalidation 18.24% 18.11%
No change  Chunks 20 20
No change  Assets 22 22
No change  Modules 4189 4189
No change  Duplicate Modules 213 213
No change  Duplicate Code 27.24% 27.24%
No change  Packages 477 477
No change  Duplicate Packages 70 70
Bundle size by type  Change 2 changes Regression 1 regression Improvement 1 improvement
                 Current
#15358
     Baseline
#15351
Regression  JS 58.19MiB (~+0.01%) 58.19MiB
Improvement  HTML 9.4KiB (-0.21%) 9.42KiB

Bundle analysis reportBranch feat/ruler-resize-fixedProject dashboard


Generated by RelativeCIDocumentationReport issue

const gap = gridMetadata.specialSizeMeasurements.gap
gridElement.style.gap = gap == null ? 'initial' : `${gap}px`
} else {
const hasRowGap = gridMetadata.specialSizeMeasurements.rowGap != null
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 a fix tangential to this PR, the problem is that gap itself might be null even if rowGap and columnGap are defined - the example is a configuration with uneven row/col gaps.

@ruggi ruggi merged commit 290e747 into master Dec 4, 2024
14 checks passed
@ruggi ruggi deleted the feat/ruler-resize-fixed branch December 4, 2024 15:35
liady pushed a commit that referenced this pull request Dec 13, 2024
**Problem:**

It should be possible to resize non-stretching grid items via the ruler
markers.

**Fix:**

Because of how grids are rendered, similarly to what happened in
#6691, we need to
calculate the rendered dimensions of grid _cells_ (not their contained
items!) after they are rendered, since for non-stretching grid items
their dimensions (via `getGridChildCellCoordBoundsFromCanvas`) don't
match the ones of the cell(s) they are configured to target.

This PR uses the logic introduced in
#6691 to calculate the
size of a grid cell starting from its item, and uses that to correctly
place the ruler markers for non-stretching items.

**Manual Tests:**
I hereby swear that:

- [x] I opened a hydrogen project and it loaded
- [x] I could navigate to various routes in Play mode

Fixes #6695
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 ruler marker resize for fixed-size elements
3 participants