-
Notifications
You must be signed in to change notification settings - Fork 14
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
Conversation
Deploy preview for react-spatial ready! Built with commit ee01f35 |
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, but small fix
src/layers/MapboxLayer.js
Outdated
); | ||
} | ||
}); | ||
return [...new Set(copyrights.filter(copyright => !!copyright))].join(', '); |
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.
Array.from(new Set(...))
?
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.
[..new Set()] is the shorter version
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.
It didn't work for me.
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 just tested it in the console it works : [...new Set(['lala', 'lala'])] => ['lala'']
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.
@oterral But [...new Set()]
is compiled to [].concat[new Set()]
. And this returns [object Set]
.
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.
thx for the explanation. I fix.
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.
fixed
// Trick from Mapbox AttributionControl to know if the source is used. | ||
const { sourceCaches } = mbMap.style; | ||
Object.entries(sourceCaches).forEach(([, sourceCache]) => { | ||
if (sourceCache.used) { |
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.
In this example, sourceCache.used
is false. Is this intended?
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.
We display the source's copyright only if the source is used by the style.
c7a78ed
to
8dd6476
Compare
@oterral I merged master into branch and successfully tested on Plan-Editor and and Trafimage-Maps. I would say LGTM |
No description provided.