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

@solid-primitives/resize-observer: Implement new strategies for determining element size and revert changes in 2.0.22 #523

Open
vveisard opened this issue Oct 8, 2023 · 0 comments

Comments

@vveisard
Copy link

vveisard commented Oct 8, 2023

Describe The Problem To Be Solved

The new strategy for createElementSize introduced in 2.0.22 (which to be fair, is more reasonable) is not backwards compatible. Instead, additional strategies for calculating element size should be added which respect semantic versioning.

In my case, I was using createElementSize for proportional scaling to change the transform: scale style of the observed element. Using bounding client rect breaks this behavior.

Suggest A Solution

I have two suggestions, both of which are minor revisions (2.1.0) that respect semantic versioning:

  1. Deprecate createElementSize and create new primitives for each strategy:
  • createElementBorderBoxSize
  • createElementContentBoxSize
  • createElementContentRectSize
  • createElementBoundingClientRectSize
  1. Like the suggestion in Use contentBoxSize and borderBoxSize instead of contentRect in createElementSize #469, add a strategy parameter to createElementSize for how to calculate the size; 'borderBoxSize' | 'contentBoxSize' | 'contentRect' | 'getBoundingClientRect'. The default value of this parameter is contentRect, which match the behavior prior to 2.0.22.
@vveisard vveisard changed the title @solid-primitives/resize-observer: Implement new strategies for determining element size @solid-primitives/resize-observer: Implement new strategies for determining element size and revert changes in 2.0.22 Oct 8, 2023
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

No branches or pull requests

1 participant