-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
Minor fix for 3386 (provide empty object for lookup) #3414
Conversation
@lucaswoj can you 🍏 this? 🙏 |
@@ -79,7 +79,7 @@ class Bucket { | |||
let type = options.layer.type; | |||
if (type === 'fill' && (!options.layer.isPaintValueFeatureConstant('fill-extrude-height') || | |||
!options.layer.isPaintValueZoomConstant('fill-extrude-height') || | |||
options.layer.getPaintValue('fill-extrude-height') !== 0)) { | |||
options.layer.getPaintValue('fill-extrude-height', {}) !== 0)) { |
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.
Would we head off similar bugs if we added this default value further upstream? (such as within StyleLayer#getPaintValue
)
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.
Alternately, perhaps we should be passing a globalProperties
object with a zoom here and 👇
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.
LGTM 🚢
@@ -282,7 +282,7 @@ Bucket.create = function(options) { | |||
let type = options.layer.type; | |||
if (type === 'fill' && (!options.layer.isPaintValueFeatureConstant('fill-extrude-height') || | |||
!options.layer.isPaintValueZoomConstant('fill-extrude-height') || | |||
options.layer.getPaintValue('fill-extrude-height') !== 0)) { | |||
options.layer.getPaintValue('fill-extrude-height', {zoom: this.zoom}) !== 0)) { |
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 doesn't look right -- this
here will be Bucket
the class/constructor function, not a Bucket
instance.
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.
Oops, good catch @jfirebaugh. Following up in 79dd26a
…ntructor's zoom property) (#3448)
This is only a small part of the fix for #3386 (more details on that ticket) —
getPaintValue
does an object lookup onglobalProperties
, so without providing an object for lookup this was sometimes throwing.