You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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:
Deprecate createElementSize and create new primitives for each strategy:
createElementBorderBoxSize
createElementContentBoxSize
createElementContentRectSize
createElementBoundingClientRectSize
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.
The text was updated successfully, but these errors were encountered:
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
Before the change, createElementSize used both contentRect and getBoundingClientRect. getBoundingClientRect for initial value and contentRect in the resize callback.
In my mind using contentRect was a bug, which was fixed to keep the primitive consistent, even if you depended on it.
So unless the initial value is always zero/null, nothing besides getBoundingClientRect can't be used, because you cannot get the ResizeObserverEntry initially.
Also borderBoxSize and contentBoxSize properties do not return a simple Rect/Size object, but dimensions that depend on text direction, so I'm not sure if it's good to even provide options to choose those.
I think that another primitive could be added, that is much simpler so it could be easily composed and adapted to what needs to be read.
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 thetransform: 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:
createElementSize
and create new primitives for each strategy:contentBoxSize
andborderBoxSize
instead ofcontentRect
increateElementSize
#469, add astrategy
parameter tocreateElementSize
for how to calculate the size;'borderBoxSize' | 'contentBoxSize' | 'contentRect' | 'getBoundingClientRect'
. The default value of this parameter iscontentRect
, which match the behavior prior to2.0.22
.The text was updated successfully, but these errors were encountered: