-
Notifications
You must be signed in to change notification settings - Fork 591
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
dca6a21
commit 87ac146
Showing
22 changed files
with
480 additions
and
416 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
machine: | ||
node: | ||
version: 4.3.2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
'use strict'; | ||
|
||
module.exports = Control; | ||
|
||
/** | ||
* A base class for map-related interface elements. | ||
* | ||
* @class Control | ||
*/ | ||
function Control() {} | ||
|
||
Control.prototype = { | ||
/** | ||
* Add this control to the map, returning the control itself | ||
* for chaining. This will insert the control's DOM element into | ||
* the map's DOM element if the control has a `position` specified. | ||
* | ||
* @param {Map} map | ||
* @returns {Control} `this` | ||
*/ | ||
addTo: function(map) { | ||
this._map = map; | ||
var container = this._container = this.onAdd(map); | ||
if (this.options && this.options.position) { | ||
var pos = this.options.position; | ||
var corner = map._controlCorners[pos]; | ||
container.className += ' mapboxgl-ctrl'; | ||
if (pos.indexOf('bottom') !== -1) { | ||
corner.insertBefore(container, corner.firstChild); | ||
} else { | ||
corner.appendChild(container); | ||
} | ||
} | ||
|
||
return this; | ||
}, | ||
|
||
/** | ||
* Remove this control from the map it has been added to. | ||
* | ||
* @returns {Control} `this` | ||
*/ | ||
remove: function() { | ||
this._container.parentNode.removeChild(this._container); | ||
if (this.onRemove) this.onRemove(this._map); | ||
this._map = null; | ||
return this; | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.