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

ScrollTrigger refreshPriority interface required property #400

Closed
dexster opened this issue Jul 21, 2020 · 2 comments
Closed

ScrollTrigger refreshPriority interface required property #400

dexster opened this issue Jul 21, 2020 · 2 comments

Comments

@dexster
Copy link

dexster commented Jul 21, 2020

3.4.1 has a breaking change due to the refreshPriority in the ScrollTriggerInstanceVars interface not being optional.

Please add new properties as optional if possible or up the minor version (should be major but I realise that's not always best depending on versioning strategy).

I've added the refreshPriority to my code and set it to 1 for now as I can't find documentation on this property.

@ZachSaucier
Copy link
Member

ZachSaucier commented Jul 21, 2020

Hey dexster. I presume you are using Typescript?

You're right that refreshPriority should be optional. In the scroll-trigger.ts file you can fix this on your side simply by changing the following line (line 407):

refreshPriority: number;
// to 
refreshPriority?: number;

Your work around of setting it all to the same number is also valid. Or you could stick with 3.4.0.

Sorry for the trouble. We'll make sure that this is included in the next minor version (which should be pushed very soon). And we'll make sure that the docs get updated to include a description of the property as well. Until then, here's the thread related to the property if you're interested.

ZachSaucier referenced this issue Jul 21, 2020
- NEW: ScrollTrigger.sort() method. You should generally create your ScrollTriggers in the order they'd happen on the page (top-to-bottom or left-to-right), but if that's not possible you can use ScrollTrigger.sort() to either use your own custom method for sorting or if none is provided, it'll sort by "refreshPriority" first, then by each ScrollTrigger's "start" value. So, for example, a ScrollTrigger with refreshPriority: 1 will get refreshed earlier than one with refreshPriority: 0 (the default). You're welcome to use negative numbers too.

- NEW: each media query function in the object passed to ScrollTrigger.matchMedia() can now [optionally] return a function which will be called when the media query becomes inactive, so it's a great place to put cleanup code.

- IMPROVED: you can now make multiple calls to ScrollTrigger.matchMedia() with the same media query string(s). It's generally not useful/necessary, but in some component-based environments it can be quite handy.

- IMPROVED: if you set once: true on a ScrollTrigger that has a scrub value, it will honor that and only scrub once to completion.

- FIXED: the "float" CSS property of a ScrollTrigger-pinned element wasn't copied to the pin-spacer.

- FIXED: added missing TypeScript definition for MotionPathPlugin.cacheRawPathMeasurements(). See #396

- FIXED: a regression in ScrollTrigger's invalidateOnRefresh: true prevented it from working properly in some cases. See https://greensock.com/forums/topic/24765-multiple-scrolltriggers-in-multiple-each-functions-jquery/?tab=comments#comment-118817

- FIXED: if you disable() a ScrollTrigger that has a pinned element, its measurements may still inadvertently affect other ScrollTriggers that have the SAME pin element (very rare).

- FIXED: if a ScrollTrigger was disabled, later when it gets re-enabled it may revert to the previous scroll position (not generally desirable).

- FIXED: if you pin the same element multiple times, but at least one of those times it was NOT the "trigger", it could throw off the start/end calculations. See https://greensock.com/forums/topic/24811-pining-multiple-elements/

- FIXED: if there were multiple ScrollTriggers back-to-back that pin the same element, when you scroll backwards it may appear "stuck" in certain situations.

- FIXED: under certain conditions, a paused animation that was scrubbed may act as though invalidate() kept getting called on it (basically it wouldn't init while paused).

- FIXED: if you define a "render" function in a MorphSVGPlugin tween, it was interpreted as a function-based value (thus it would get called for each target and the RESULT of that function was used).
jackdoyle added a commit that referenced this issue Jul 21, 2020
- FIXED: regression in 3.4.1 could cause pinning to break in certain scenarios.

- FIXED: if you try pinning an element that has a child with collapsing margins, ScrollTrigger will now automatically sense if the pinned element has no scrollable content and set overflow: hidden as an inline style to prevent the collapsing margin issue. This should resolve most cases like that where collapsing margins cause a jump (by the amount of the collapse) when pinning.

- FIXED: in the TypeScript definitions file, refreshPriority was accidentally set to be required instead of optional. See #400
@jackdoyle
Copy link
Member

Sorry about that! Silly mistake on my part. Should be fixed in the most recent release.

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

3 participants