-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Simplify & optimize style calculation #3498
Conversation
55faf5f
to
54de836
Compare
Had to rebase to resolve a minor conflict with Flow PR, but made sure the tests pass on each commit so that they can be merged without squashing. |
return this.interp(oldValue, value, t); | ||
} | ||
|
||
_calculateTargetValue(globalProperties, featureProperties) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why did you decide to factor this out into a separate method? What does target
mean in this context?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This code earlier lived mostly in style_declaration
wrapTransitionedCalculate
here. What this method does is calculate the value the property is transitioning to, as opposed to calculate
which returns the current value that is transitioning from the old value to the target one with time — please see calculate
above.
); | ||
|
||
t.end(); | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why did you delete these tests?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah. I see. 👇
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I moved it into a new style_transition.test.js
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A couple questions. This looks ready to go if you're satisfied with their answers. 👍
A major cleanup of the style recalculation code. 50 less lines of code, much less confusion and also slightly improves performance. All commits are self-contained so review commit by commit.
One noteable architectural change is that
globalProperties
properties likezoomHistory
,time
andduration
that were specific to transition implementation are moved out and live where they belong. So nowglobalProperties
are always just{zoom}
, although I didn't replace it with justzoom
yet because @lucaswoj anticipates other global properties in future.👀 @lucaswoj @jfirebaugh