diff --git a/dist/mapbox-gl.css b/dist/mapbox-gl.css
index efca2ec68cb..9067f7fdb34 100644
--- a/dist/mapbox-gl.css
+++ b/dist/mapbox-gl.css
@@ -161,11 +161,12 @@ a.mapboxgl-ctrl-logo {
color: inherit;
text-decoration: underline;
}
-.mapboxgl-ctrl-attrib .mapboxgl-improve-map {
+/* stylelint-disable */
+.mapboxgl-ctrl-attrib .mapbox-improve-map {
font-weight: bold;
margin-left: 2px;
}
-
+/*stylelint-enable*/
.mapboxgl-ctrl-scale {
background-color: rgba(255,255,255,0.75);
font-size: 10px;
@@ -318,8 +319,11 @@ a.mapboxgl-ctrl-logo {
border: 2px dotted #202020;
opacity: 0.5;
}
+
@media print {
- .mapboxgl-improve-map {
+/* stylelint-disable */
+ .mapbox-improve-map {
display:none;
}
+/* stylelint-enable */
}
diff --git a/src/ui/control/attribution_control.js b/src/ui/control/attribution_control.js
index f84d1c038ef..b7fc6044c66 100644
--- a/src/ui/control/attribution_control.js
+++ b/src/ui/control/attribution_control.js
@@ -66,11 +66,14 @@ class AttributionControl {
}
_updateEditLink() {
- if (!this._editLink) this._editLink = this._container.querySelector('.mapboxgl-improve-map');
+ if (!this._editLink) this._editLink = this._container.querySelector('.mapbox-improve-map');
if (this._editLink) {
const center = this._map.getCenter();
this._editLink.href = `https://www.mapbox.com/map-feedback/#/${
- center.lng}/${center.lat}/${Math.round(this._map.getZoom() + 1)}`;
+ Math.round(center.lng * 1000) / 1000}/${Math.round(center.lat * 1000) / 1000}/${Math.round(this._map.getZoom())}`;
+ if (this.styleOwner && this.styleId) {
+ this._editLink.href += `?owner=${this.styleOwner}&id=${this.styleId}`;
+ }
}
}
@@ -85,6 +88,12 @@ class AttributionControl {
if (!this._map.style) return;
let attributions = [];
+ if (this._map.style.stylesheet) {
+ const stylesheet = this._map.style.stylesheet;
+ this.styleOwner = stylesheet.owner;
+ this.styleId = stylesheet.id;
+ }
+
const sourceCaches = this._map.style.sourceCaches;
for (const id in sourceCaches) {
const source = sourceCaches[id].getSource();
diff --git a/test/unit/ui/control/attribution.test.js b/test/unit/ui/control/attribution.test.js
index 41be18e9300..baa1f882003 100644
--- a/test/unit/ui/control/attribution.test.js
+++ b/test/unit/ui/control/attribution.test.js
@@ -13,7 +13,9 @@ function createMap() {
style: {
version: 8,
sources: {},
- layers: []
+ layers: [],
+ owner: 'mapbox',
+ id: 'streets-v10'
}
});
}
@@ -105,12 +107,12 @@ test('AttributionControl has the correct edit map link', (t) => {
map.addControl(attribution);
map.on('load', () => {
- map.addSource('1', {type: 'vector', attribution: 'Improve this map'});
+ map.addSource('1', {type: 'vector', attribution: 'Improve this map'});
map.on('data', (e) => {
if (e.dataType === 'source' && e.sourceDataType === 'metadata') {
- t.equal(attribution._editLink.href, 'https://www.mapbox.com/map-feedback/#/0/0/1', 'edit link contains map location data');
+ t.equal(attribution._editLink.href, 'https://www.mapbox.com/map-feedback/#/0/0/0?owner=mapbox&id=streets-v10', 'edit link contains map location data');
map.setZoom(2);
- t.equal(attribution._editLink.href, 'https://www.mapbox.com/map-feedback/#/0/0/3', 'edit link updates on mapmove');
+ t.equal(attribution._editLink.href, 'https://www.mapbox.com/map-feedback/#/0/0/2?owner=mapbox&id=streets-v10', 'edit link updates on mapmove');
t.end();
}
});