Skip to content

Commit

Permalink
put sourcedata listener back in
Browse files Browse the repository at this point in the history
  • Loading branch information
Molly Lloyd committed Jan 11, 2018
1 parent a3a47b1 commit 942753d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
10 changes: 7 additions & 3 deletions src/ui/control/attribution_control.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ class AttributionControl {
this._updateEditLink();

this._map.on('styledata', this._updateData);
this._map.on('sourcedata', this._updateData);
this._map.on('moveend', this._updateEditLink);

if (compact === undefined) {
Expand All @@ -67,6 +68,7 @@ class AttributionControl {
onRemove() {
DOM.remove(this._container);

this._map.off('styledata', this._updateData);
this._map.off('sourcedata', this._updateData);
this._map.off('moveend', this._updateEditLink);
this._map.off('resize', this._updateCompact);
Expand Down Expand Up @@ -97,9 +99,11 @@ class AttributionControl {
}
}

_updateData() {
this._updateAttributions();
this._updateEditLink();
_updateData(e) {
if (e && (e.type === "styledata" || e.sourceDataType === "metadata")) {
this._updateAttributions();
this._updateEditLink();
}
}

_updateAttributions() {
Expand Down
6 changes: 4 additions & 2 deletions src/ui/control/logo_control.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,21 +33,23 @@ class LogoControl {
this._container.style.display = 'none';

this._map.on('styledata', this._updateLogo);
this._map.on('sourcedata', this._updateLogo);
this._updateLogo();
return this._container;
}

onRemove() {
DOM.remove(this._container);
this._map.off('styledata', this._updateLogo);
this._map.off('sourcedata', this._updateLogo);
}

getDefaultPosition() {
return 'bottom-left';
}

_updateLogo() {
this._container.style.display = this._logoRequired() ? 'block' : 'none';
_updateLogo(e) {
if (e && (e.type === 'styledata' || e.sourceDataType === "metadata")) this._container.style.display = this._logoRequired() ? 'block' : 'none';
}

_logoRequired() {
Expand Down

0 comments on commit 942753d

Please sign in to comment.