Skip to content

Commit

Permalink
remove ready event as it's no longer needed
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewharvey committed Apr 13, 2017
1 parent 4ef0c41 commit 208ed2d
Show file tree
Hide file tree
Showing 2 changed files with 132 additions and 148 deletions.
32 changes: 6 additions & 26 deletions src/ui/control/geolocate_control.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@ class GeolocateControl extends Evented {
'_setupUI',
'_updateCamera',
'_updateMarker',
'_setupMarker',
'_onClickGeolocate'
], this);
}
Expand Down Expand Up @@ -251,8 +250,12 @@ class GeolocateControl extends Evented {
// when showUserLocation is enabled, keep the Geolocate button disabled until the device location marker is setup on the map
if (this.options.showUserLocation) {
if (this.options.trackUserLocation) this._watchState = 'INITILIZE';
this._geolocateButton.disabled = true;
this._setupMarker();

this._dotElement = DOM.create('div', 'mapboxgl-user-location-dot');

this._userLocationDotMarker = new Marker(this._dotElement, { offset: [-13, -13] });

if (this.options.trackUserLocation) this._watchState = 'OFF';
}

this._geolocateButton.addEventListener('click',
Expand All @@ -273,20 +276,6 @@ class GeolocateControl extends Evented {
}
});
}

if (!this.options.showUserLocation) this.fire('ready');
}

_setupMarker() {
this._dotElement = DOM.create('div', 'mapboxgl-user-location-dot');

this._userLocationDotMarker = new Marker(this._dotElement, { offset: [-13, -13] });

if (this.options.trackUserLocation) this._watchState = 'OFF';

this._geolocateButton.disabled = false;

this.fire('ready');
}

_onClickGeolocate() {
Expand Down Expand Up @@ -409,15 +398,6 @@ module.exports = GeolocateControl;
*
*/

/**
* Fired when the Geolocate Control is ready and able to be clicked.
*
* @event ready
* @memberof GeolocateControl
* @instance
*
*/

/**
* Fired when the Geolocate Control changes to the active lock state, which happens either upon first obtaining a successful Geolocation API position for the user (a geolocate event will follow), or the user clicks the geolocate button when in the background state which uses the last known position to recenter the map and enter active lock state (no geolocate event will follow unless the users's location changes).
*
Expand Down
Loading

0 comments on commit 208ed2d

Please sign in to comment.