Skip to content
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

Option tracks layer name #79

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,8 @@ var playback = new L.Playback(map, geoJSON, onPlaybackTimeChange, options);

* `fadeMarkersWhenStale` - Set `true` markers should hide when not yet present in time and fade out after staleTime has passed **Default: `false`**.

* `tracksLayerName` - String with the name of the tracks layer **Default: `GPS Tracks`**.

### playback#setData(geoJSON)

Reset current data and add new.
Expand Down
6 changes: 3 additions & 3 deletions dist/LeafletPlayback.js
Original file line number Diff line number Diff line change
Expand Up @@ -737,6 +737,7 @@ L.Playback = L.Playback || {};
L.Playback.TracksLayer = L.Class.extend({
initialize : function (map, options) {
var layer_options = options.layer || {};
this._tracksLayerName = options.tracksLayerName || 'GPS Tracks';

if (jQuery.isFunction(layer_options)){
layer_options = layer_options(feature);
Expand All @@ -750,9 +751,8 @@ L.Playback.TracksLayer = L.Class.extend({

this.layer = new L.GeoJSON(null, layer_options);

var overlayControl = {
'GPS Tracks' : this.layer
};
var overlayControl = {};
overlayControl[this._tracksLayerName] = this.layer;

L.control.layers(null, overlayControl, {
collapsed : false
Expand Down
2 changes: 1 addition & 1 deletion dist/LeafletPlayback.min.js

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions src/TracksLayer.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ L.Playback = L.Playback || {};
L.Playback.TracksLayer = L.Class.extend({
initialize : function (map, options) {
var layer_options = options.layer || {};
this._tracksLayerName = options.tracksLayerName || 'GPS Tracks';

if (jQuery.isFunction(layer_options)){
layer_options = layer_options(feature);
Expand All @@ -19,9 +20,8 @@ L.Playback.TracksLayer = L.Class.extend({

this.layer = new L.GeoJSON(null, layer_options);

var overlayControl = {
'GPS Tracks' : this.layer
};
var overlayControl = {};
overlayControl[this._tracksLayerName] = this.layer;

L.control.layers(null, overlayControl, {
collapsed : false
Expand Down