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

Minor fix for 3386 (provide empty object for lookup) #3414

Merged
merged 2 commits into from
Oct 24, 2016
Merged

Conversation

lbud
Copy link
Contributor

@lbud lbud commented Oct 19, 2016

This is only a small part of the fix for #3386 (more details on that ticket) — getPaintValue does an object lookup on globalProperties, so without providing an object for lookup this was sometimes throwing.

@lbud
Copy link
Contributor Author

lbud commented Oct 19, 2016

@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)) {
Copy link
Contributor

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)

Copy link
Contributor

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 👇

@lbud
Copy link
Contributor Author

lbud commented Oct 20, 2016

Ok, spun around in circles a bit here before figuring out there's a related bug that affects all properties (#3425) but here I switched from the empty objects to providing zoom like in other globalProperties. @lucaswoj 🍏?

Copy link
Contributor

@lucaswoj lucaswoj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 🚢

@lbud lbud merged commit bfe3b2b into master Oct 24, 2016
@lbud lbud deleted the 3386-minor-fix branch October 24, 2016 17:23
@@ -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)) {
Copy link
Contributor

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.

Copy link
Contributor Author

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

lbud pushed a commit that referenced this pull request Oct 24, 2016
@lbud lbud mentioned this pull request Oct 24, 2016
lbud pushed a commit that referenced this pull request Oct 24, 2016
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.

3 participants