-
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
add Mapbox wordmark as LogoControl #3933
Conversation
18274a3
to
69fbb02
Compare
|
||
class LogoControl { | ||
constructor() { | ||
} |
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.
you can omit empty constructors
} | ||
|
||
onAdd(map) { | ||
this._map = map; |
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.
Do we need to save the map reference if it's not used by the control?
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 guess we don't! I was following the IControl
docs, but you're right it isn't necessary in this case.
@@ -200,6 +203,7 @@ class Map extends Camera { | |||
if (options.style) this.setStyle(options.style); | |||
|
|||
if (options.attributionControl) this.addControl(new AttributionControl()); | |||
if (options.logoControl) this.addControl(new LogoControl(), 'bottom-left'); |
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 think it's better to code the default position in the control code by adding a getDefaultPosition
method.
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.
The equivalent control in Mapbox.js is shown or hidden automatically based on a status flag returned by the Mapbox API. We'll likely need to implement a similar facility in the Styles API.
69fbb02
to
299fc3b
Compare
299fc3b
to
71ee1c5
Compare
@jfirebaugh do you mean we should punt on this until we implement something at the TileJSON level? I'm looking in to what implementing a flag like that looks like, but some enterprise customers will still need to be able to remove the logo even if they're using our vector tiles depending on the terms of their Enterprise agreement. |
Per chat in slack and convos w @sean-heff @ErinQuinn I think we should add the logo as on by default, and actually not document how to remove it. This would be the same behavior that we have currently implemented in the iOS SDK (per @1ec5) and be the most effective way to prevent users from unwillingly violating our TOS. we have lines of communication open with all users that have approved white labeling (customer success) and so if they want info on how to remove the logo, we can provide it. |
@mollymerp it seems to be implemented at the TileJSON level (with |
~@mourner I think the Both the Android and iOS SDKs enable the Mapbox logo automatically for all users and I think it makes most sense to follow this pattern. |
@mollymerp Not required but might be a good idea to add |
@andrewharvey thank you so much for catching that! I'll have to get better about making a habit of including these. |
5e7c980
to
dbf00f4
Compare
While technically not a breaking change, it will act as a breaking change for those who've followed the current advice and manually added the logo (as they'll end up with two overlapping logos, potentially slightly offset from each other). So a notice about this in the CHANGELOG when released will be welcome. |
We are going to collaborate with the teams that maintain Mapbox's APIs to implement a |
I think we should merge now. This would make Mapbox GL JS have parity with our mobile SDKs and prevent further accidental violations of our TOS. We can always go back later when the API response contains appropriate flags to indicate permissible white-labeling and configure the control that way. |
13e331d
to
fa02935
Compare
Ok I've updated this PR to rely on the |
@@ -100,7 +100,7 @@ const defaultOptions = { | |||
* Keep in mind that these classes are used for controlling a style layer's paint properties, so are *not* reflected | |||
* in an HTML element's `class` attribute. To learn more about Mapbox style classes, read about | |||
* [Layers](https://www.mapbox.com/mapbox-gl-style-spec/#layers) in the style specification. | |||
* @param {boolean} [options.attributionControl=true] If `true`, an [AttributionControl](#AttributionControl) will be added to the map. |
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.
Did you really mean to replace attributionControl
with logoPosition
, or did you mean to replace logoControl
with logoPosition
?
Given further down you've dropped out options.logoControl
with options.logoPosition
but retained options.attributionControl
.
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.
yipes good catch @andrewharvey -- this was not intentional!
fa02935
to
6abb905
Compare
@@ -47,6 +48,7 @@ const defaultOptions = { | |||
hash: false, | |||
|
|||
attributionControl: true, | |||
logoControl: true, |
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 think you missed updating this to Or actually maybe you just need to remove as it's not used anywhere anymore from what I can see and the default is obtained from logoPosition: 'bottom-left'
..getDefaultPosition()
if the option is undefined
anyway...
6abb905
to
7b3ff3e
Compare
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.
🚢 after a few small changes.
class LogoControl { | ||
|
||
constructor() { | ||
util.bindAll(['_logoRequired', '_updateLogo'], this); |
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.
Nit: _logoRequired
doesn't need to be bound (it's not used as an event handler).
} | ||
|
||
onRemove() { | ||
this._container.parentNode.removeChild(this._container); |
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.
Also needs this._map.off('data', this._updateLogo)
.
Launch Checklist
closes #1825