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

Manage copyright from Mapbox layer #418

Merged
merged 4 commits into from
Mar 3, 2020
Merged

Manage copyright from Mapbox layer #418

merged 4 commits into from
Mar 3, 2020

Conversation

oterral
Copy link
Contributor

@oterral oterral commented Dec 19, 2019

No description provided.

@netlify
Copy link

netlify bot commented Dec 19, 2019

Deploy preview for react-spatial ready!

Built with commit ee01f35

https://deploy-preview-418--react-spatial.netlify.com

@oterral oterral requested a review from gevos January 7, 2020 10:54
Copy link
Contributor

@gevos gevos left a comment

Choose a reason for hiding this comment

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

LGTM, but small fix

);
}
});
return [...new Set(copyrights.filter(copyright => !!copyright))].join(', ');
Copy link
Contributor

Choose a reason for hiding this comment

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

Array.from(new Set(...))?

Copy link
Contributor Author

@oterral oterral Jan 8, 2020

Choose a reason for hiding this comment

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

[..new Set()] is the shorter version

Copy link
Contributor

Choose a reason for hiding this comment

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

It didn't work for me.

Copy link
Contributor Author

@oterral oterral Jan 8, 2020

Choose a reason for hiding this comment

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

I just tested it in the console it works : [...new Set(['lala', 'lala'])] => ['lala'']

Copy link
Contributor

Choose a reason for hiding this comment

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

@oterral But [...new Set()] is compiled to [].concat[new Set()]. And this returns [object Set].

Copy link
Contributor Author

Choose a reason for hiding this comment

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

thx for the explanation. I fix.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed

// Trick from Mapbox AttributionControl to know if the source is used.
const { sourceCaches } = mbMap.style;
Object.entries(sourceCaches).forEach(([, sourceCache]) => {
if (sourceCache.used) {
Copy link
Contributor

Choose a reason for hiding this comment

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

In this example, sourceCache.used is false. Is this intended?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We display the source's copyright only if the source is used by the style.

src/layers/MapboxLayer.js Outdated Show resolved Hide resolved
@danji90
Copy link
Contributor

danji90 commented Mar 2, 2020

@oterral I merged master into branch and successfully tested on Plan-Editor and and Trafimage-Maps. I would say LGTM

@oterral oterral merged commit 8b2336e into master Mar 3, 2020
@oterral oterral deleted the olivier/copyright branch March 3, 2020 17:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

4 participants