-
Notifications
You must be signed in to change notification settings - Fork 90
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
Diagnosing the 5px "jump" on the inline text demo #76
Comments
In my example here adding |
Just seen this on email and haven’t checked the code but the 4px and inline-block sound familiar.
Could it be something to do with this issue?
https://css-tricks.com/fighting-the-space-between-inline-block-elements/ <https://css-tricks.com/fighting-the-space-between-inline-block-elements/>
Just a thought.
… On 10 Mar 2019, at 12:43, Sam Selikoff ***@***.***> wrote:
In my example here adding sprite.translate(0, -4); "fixed" the issue. I'm unable to figure out where the 4px number is coming from, even by pausing the animation & inspecting the DOM.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub <#76 (comment)>, or mute the thread <https://github.com/notifications/unsubscribe-auth/AACKoD7hmq_wPHoIM8RPjpnKD6aQhN7fks5vVO_qgaJpZM4bnNge>.
|
I've managed to use some escape hatches to get the animation working, which I'd like to post here both to share, and to get any feedback on in case there are better ways to use the Sprite APIs as escape hatches in situations like this. (i.e., how would you solve this problem?) Original transition: transition: function*({ sentSprites }) {
sentSprites.forEach(sprite => {
move(sprite);
adjustColor.property('color')(sprite);
});
} Updated transition: transition: function*({ sentSprites }) {
sentSprites.forEach(sprite => {
if (sprite.initialBounds.top === 4) {
let { left: initialLeft, top: initialTop } = sprite.absoluteInitialBounds;
sprite.startAtPixel({ x: initialLeft, y: initialTop - 4 });
}
if (sprite.finalBounds.top === 4) {
let { left: finalLeft, top: finalTop } = sprite.absoluteFinalBounds;
sprite.endAtPixel({ x: finalLeft, y: finalTop - 4 });
}
move(sprite);
adjustColor.property('color')(sprite);
});
} I tried to do some sort of |
The important thing about animated-orphans is that it must not itself move relative to anything else during the animations. The normal way to achieve that is to put it high up in the application.hbs route. In the tests, it appears below the QUnit output, which can cause it to bump downward, which messes things up. So in the tests we sometimes need to manually make sure it doesn't move when QUnit output gets taller. One of the most likely culprits for a vertical jump like this is margin collapse. ember-animated tries to predict margin collapse automatically so you don't need to deal with it, but it's quite possible you've found a case we don't do correctly. There are only a small number of places in the code that are likely to be responsible for the jump. I would especially look at Sprite's |
Could it be coming from ember-animated/addon/-private/sprite.js Line 1005 in a0180f7
In the inline-text demo, this would play out like this: // findOffsets
console.log(ownBounds.top) // 34
//...
if (effectiveOffsetParent) {
//...
if (eopComputedStyle.position !== 'static' || eopComputedStyle.transform !== 'none') {
let eopBounds = effectiveOffsetParent.getBoundingClientRect();
/**
* eopBounds:
* {
* "x": 292.859375,
* "y": 30,
* "width": 87.25,
* "height": 26,
* "top": 30,
* "right": 380.109375,
* "bottom": 56,
* "left": 292.859375
* }
*/
left -= eopBounds.left + parseFloat(eopComputedStyle.borderLeftWidth);
top -= eopBounds.top + parseFloat(eopComputedStyle.borderTopWidth); // top = 34 - 30
}
}
|
I've since managed to fix this by making these It might not be anything we can work around in the library – the advice might be that you need to always use |
I'm having trouble figuring out why there's a ~5px "jump" on the inline-text demo. I've been looking at the
moving-word
component from the Living Animation talk as well and can't figure out what's going on.animated-orphans
is put in aposition: absolute
orposition: fixed
div. I've tried different combinations of these but no luck. How does the position ofanimated-orphans
affect the orphans it renders?~
helper<AnimatedContainer>
, like inline-block and align-topAny ideas or pointers on what's going on?
The text was updated successfully, but these errors were encountered: