Skip to content

Fix #3555 ; scale elements in FLIP animations#3627

Merged
Rich-Harris merged 1 commit intosveltejs:masterfrom
simeydotme:3555-fix-flip-scaling
Nov 15, 2019
Merged

Fix #3555 ; scale elements in FLIP animations#3627
Rich-Harris merged 1 commit intosveltejs:masterfrom
simeydotme:3555-fix-flip-scaling

Conversation

@simeydotme
Copy link
Copy Markdown
Contributor

@simeydotme simeydotme commented Sep 27, 2019

Changes

  • divide the getBoundingClientRect dimensions by clientHeight or clientWidth
    • this gives us the element's scaled values as scaleX and scaleY
  • divide the "dx" and "dy" by the "scaleX" and "scaleY"

This aims to fix #3555 by using the node's un-scaled width/height to
calculate the amount it has been scaled. Then dividing the distance by
this scale factor removes the janky start position which was shown in
the test case.

resolves #3555

Before submitting the PR, please make sure you do the following

  • It's really useful if your PR relates to an outstanding issue, so please reference it in your PR, or create an explanatory one for discussion. In many cases features are absent for a reason.
  • This message body should clearly illustrate what problems it solves. If there are related issues, remember to reference them.
  • Ideally, include a test that fails without this PR but passes with it. PRs will only be merged once they pass CI. (Remember to npm run lint!)

Tests

  • Run the tests tests with npm test or yarn test)

- divide the getBoundingClientRect dimensions by clientHeight or clientWidth
  - this gives us the element's scaled values as scaleX and scaleY
- divide the "dx" and "dy" by the "scaleX" and "scaleY"

This aims to fix sveltejs#3555 by using the node's un-scaled width/height to
calculate the amount it has been scaled. Then dividing the distance by
this scale factor removes the janky start position which was shown in
the test case.

resolves sveltejs#3555
@simeydotme simeydotme changed the title Calculate scale factor of elements in FLIP animations Fix #3555 ; scale elements in FLIP animations Oct 11, 2019
@Rich-Harris Rich-Harris merged commit 05cf649 into sveltejs:master Nov 15, 2019
@Rich-Harris
Copy link
Copy Markdown
Member

Apologies for the delay — thank you, this is a great fix

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.

FLIP Animations janky; inside a parent with transform:scale()

2 participants