diff --git a/README.md b/README.md index 2941b3e9..92afebac 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ [![Join the chat at https://gitter.im/skeate/Leaflet.timeline](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/skeate/Leaflet.timeline?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) -# Leaflet.timeline 0.4.3 +# Leaflet.timeline 1.0.0-beta Show any changing geospatial data over time, from points to polygons. @@ -38,8 +38,12 @@ it handle everything. ## Usage -`Leaflet.timeline` is a subclass of `L.GeoJSON`, so use it as you would that. -The data you pass in should be something like this: +There are actually two classes here. `L.Timeline` and `L.TimelineSliderControl`. + +### `L.Timeline` + +`L.Timeline` is a subclass of `L.GeoJSON`, so use it as you would that. The data +you pass in should be something like this: ``` json { @@ -57,33 +61,60 @@ The data you pass in should be something like this: } ``` -The date can really be anything `Date()` can process. +Though you can also pass in a `getInterval` function to parse the data as you +wish. (see below) -It does add some extra options: +The date can really be any numerical value -- if you're using this for timed +data, a Unix timestamp (the ms version for easier JS usage) probably makes +sense. -## Options +#### Options see also [all GeoJSON's options](http://leafletjs.com/reference.html#geojson) -#### `start` +##### `getInterval` (Function -- optional) + +This is a function which should return an object with `start` and `end` +properties. By default it assumes a structure as above. + +##### `drawOnSetTime` (Boolean -- optional, default `true`) + +Make the layer draw as soon as `setTime` is called. If this is set to false, you +will need to call `updateDisplayedLayers()` manually when you want it to +actually update. + +#### Events + +##### `change` +Fired when the selected time changes (either through manually sliding or +through playback). + +### `L.TimelineSliderControl` + +This is the actual control that allows playback and whatnot. It can control +multiple `L.Timeline`s. + +#### Options + +##### `start` *default: earliest `start` in GeoJSON* The beginning/minimum value of the timeline. -#### `end` +##### `end` *default: latest `end` in GeoJSON* The end/maximum value of the timeline. -#### `position` +##### `position` *default: bottomleft* [Position](http://leafletjs.com/reference.html#control) for the timeline controls. Probably doesn't really matter as you'll likely want to expand them anyway. -#### `formatDate` -*default: `(date) -> ""`* +#### `formatOutput` +*default: `(date) -> date.toString()`* A function that takes in a Unix timestamp and outputs a string. Ideally for formatting the timestamp, but hey, you can do whatever you want. @@ -116,7 +147,8 @@ step time. #### `showTicks` *default: true* -Show tick marks on slider, representing changes in value(s). +Show tick marks on slider (if the browser supports it), representing changes in +value(s). #### `waitToUpdateMap` *default: false* @@ -125,18 +157,6 @@ Wait until the user is finished changing the date to update the map. By default, both the map and the date update for every change. With complex data, this can slow things down, so set this to true to only update the displayed date. -#### `intervalFromFeature` - -A function that should, given a feature, return an object with `start` and `end` -properties, representing the start time and end time of the feature. By default -it will use `feature.properties.start` and `feature.properties.end`. - -## Events - -#### `change` -Fired when the selected time changes (either through manually sliding or -through playback). - ## Methods #### `setTime` @@ -151,18 +171,38 @@ on the map. To get the project running locally, clone this repo and run these commands within the project folder: + ``` npm install -gulp start +npm test-watch ``` -Open your browser to http://localhost:8000/examples/borders.html or http://localhost:8000/examples/earthquakes.html -The page will reload whenever file changes are made, so you can use the examples to test the changes you want to contribute to the project. +To view the examples, you'll need to build: -Please create a pull request from your fork of the project, and provide details of the intent of the changes. +``` +npm run build +``` + +Then open up the HTML files in the "examples" folders in your browser. + +~~The page will reload whenever file changes are made, so you can use the examples +to test the changes you want to contribute to the project.~~ + +Eventually the examples will be handily self-updating and such again soon, once +I get a handle on webpack-dev-server. + +Please create a pull request from your fork of the project, and provide details +of the intent of the changes. ## Change log +### 1.0.0-beta +- Completely rewrote in ES6 +- Overhauled build system with webpack +- Separated layer from control, allowing the control to handle multiple + layers at the same time +- Added tests! + ### 0.4.3 - Build tweaks diff --git a/bower.json b/bower.json index d4a9af6b..a8bcc248 100644 --- a/bower.json +++ b/bower.json @@ -1,6 +1,6 @@ { "name": "leaflet.timeline", - "version": "1.0.0-alpha.1", + "version": "1.0.0-beta", "authors": [ "Jonathan Skeate " ], diff --git a/dist/leaflet.timeline.min.js b/dist/leaflet.timeline.min.js index f93552a0..27273fec 100644 --- a/dist/leaflet.timeline.min.js +++ b/dist/leaflet.timeline.min.js @@ -1 +1 @@ -!function(t){function e(n){if(i[n])return i[n].exports;var s=i[n]={exports:{},id:n,loaded:!1};return t[n].call(s.exports,s,s.exports,e),s.loaded=!0,s.exports}var i={};return e.m=t,e.c=i,e.p="",e(0)}([function(t,e,i){"use strict";L.TimelineVersion="1.0.0",i(1),i(3),i(4)},function(t,e,i){"use strict";function n(t){return t&&t.__esModule?t:{"default":t}}var s=function(){function t(t,e){var i=[],n=!0,s=!1,r=void 0;try{for(var a,o=t[Symbol.iterator]();!(n=(a=o.next()).done)&&(i.push(a.value),!e||i.length!==e);n=!0);}catch(u){s=!0,r=u}finally{try{!n&&o["return"]&&o["return"]()}finally{if(s)throw r}}return i}return function(e,i){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return t(e,i);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),r=i(2),a=n(r);L.Timeline=L.GeoJSON.extend({times:[],displayedLayers:[],ranges:null,initialize:function(t){var e=this,i=arguments.length<=1||void 0===arguments[1]?{}:arguments[1];this.ranges=new a["default"];var n=/^(\d+)(\.(\d+))?(\.(\d+))?(-(.*))?(\+(.*))?$/,r=n.exec(L.version),o=s(r,4),u=o[1],l=o[3];this.isOldVersion=0===parseInt(u,10)&&parseInt(l,10)<=7;var h={drawOnSetTime:!0};L.GeoJSON.prototype.initialize.call(this,null,i),L.Util.setOptions(this,h),L.Util.setOptions(this,i),this.options.getInterval&&(this._getInterval=function(){var t;return(t=e.options).getInterval.apply(t,arguments)}),t&&this._process(t)},_getInterval:function(t){return{start:new Date(t.properties.start).getTime(),end:new Date(t.properties.end).getTime()}},_process:function(t){var e=this,i=1/0,n=-(1/0);t.features.forEach(function(t){var s=e._getInterval(t);e.ranges.insert(s.start,s.end,t),e.times.push(s.start),e.times.push(s.end),i=Math.min(i,s.start),n=Math.max(n,s.end)}),this.start=this.options.start||i,this.end=this.options.end||n,this.time=this.start,0!==this.times.length&&(this.times.sort(function(t,e){return t-e}),this.times=this.times.reduce(function(t,e,i){if(0===i)return t;var n=t[t.length-1];return n!==e&&t.push(e),t},[this.times[0]]))},addData:function(t){var e=this,i=L.Util.isArray(t)?t:t.features;if(i)return i.filter(function(t){return t.geometries||t.geometry||t.features||t.coordinates}).forEach(function(t){return e.addData(t)}),this;if(this.options.filter&&!this.options.filter(t))return this;var n=L.GeoJSON.geometryToLayer(t,this.isOldVersion?this.options.pointToLayer:this.options);return n?(this.displayedLayers.push({layer:n,geoJSON:t}),n.feature=L.GeoJSON.asFeature(t),n.defaultOptions=n.options,this.resetStyle(n),this.options.onEachFeature&&this.options.onEachFeature(t,n),void this.addLayer(n)):this},removeLayer:function(t){var e=arguments.length<=1||void 0===arguments[1]?!0:arguments[1];L.GeoJSON.prototype.removeLayer.call(this,t),e&&(this.displayedLayers=this.displayedLayers.filter(function(e){return e.layer!==t}))},setTime:function(t){this.time="number"==typeof t?t:new Date(t).getTime(),this.options.drawOnSetTime&&this.updateDisplayedLayers(),this.fire("change")},updateDisplayedLayers:function(){for(var t=this,e=this.ranges.lookup(this.time),i=0;i=t&&e.push(n.data),e.push.apply(e,i(this.lookup(t,n.right)))),e)}}]),t}();e["default"]=a},function(t,e){"use strict";function i(t){return t&&"undefined"!=typeof Symbol&&t.constructor===Symbol?"symbol":typeof t}function n(t){if(Array.isArray(t)){for(var e=0,i=Array(t.length);e=t.start&&e<=t.end});e.push.apply(e,n(s))}),e.length){var s=function(){e.sort(function(t,e){return t-e});var t=[e[0]];return e.reduce(function(e,i){return e!==i&&t.push(i),i}),{v:t}}();if("object"===("undefined"==typeof s?"undefined":i(s)))return s.v}return e},_recalculate:function(){var t="undefined"!=typeof this.options.start,e="undefined"!=typeof this.options.end,i=this.options.duration,n=1/0,s=-(1/0);this.timelines.forEach(function(t){t.starts&&(s=t.end)}),t||(this.start=n,this._timeSlider.min=n===1/0?0:n,this._timeSlider.value=this._timeSlider.min),e||(this.end=s,this._timeSlider.max=s===-(1/0)?0:s),this._stepSize=Math.max(1,(this.end-this.start)/this.options.steps),this._stepDuration=Math.max(1,i/this.options.steps)},_nearestEventTime:function(t){for(var e=arguments.length<=1||void 0===arguments[1]?0:arguments[1],i=this._getTimes(),n=!1,s=i[0],r=1;r=t){if(-1===e)return s;if(1!==e){var o=Math.abs(t-s),u=Math.abs(t-a);return u>o?s:a}if(a!==t)return a;n=!0}s=a}return s},_createDOM:function(){var t=["leaflet-control-layers","leaflet-control-layers-expanded","leaflet-timeline-control"],e=L.DomUtil.create("div",t.join(" "));if(this.container=e,this.options.enablePlayback){var i=L.DomUtil.create("div","sldr-ctrl-container",e),n=L.DomUtil.create("div","button-container",i);this._makeButtons(n),this.options.enableKeyboardControls&&this._addKeyListeners(),this._makeOutput(i)}this._makeSlider(e),this.options.showTicks&&this._buildDataList(e)},_addKeyListeners:function(){var t=this;this._listener=function(){return t._onKeydown.apply(t,arguments)},document.addEventListener("keydown",this._listener)},_removeKeyListeners:function(){document.removeEventListener("keydown",this._listener)},_buildDataList:function(t){this._datalist=L.DomUtil.create("datalist","",t);var e=Math.floor(1e6*Math.random());this._datalist.id="timeline-datalist-"+e,this._timeSlider.setAttribute("list",this._datalist.id),this._rebuildDataList()},_rebuildDataList:function(){for(var t=this._datalist;t.firstChild;)t.removeChild(t.firstChild);var e=L.DomUtil.create("select","",this._datalist);this._getTimes().forEach(function(t){L.DomUtil.create("option","",e).value=t})},_makeButton:function(t,e){var i=this,n=L.DomUtil.create("button",e,t);n.addEventListener("click",function(){return i[e]()}),L.DomEvent.disableClickPropagation(n)},_makeButtons:function(t){this._makeButton(t,"prev"),this._makeButton(t,"play"),this._makeButton(t,"pause"),this._makeButton(t,"next")},_makeSlider:function(t){var e=this,i=L.DomUtil.create("input","time-slider",t);i.type="range",i.min=this.start||0,i.max=this.end||0,i.value=this.start||0,i.addEventListener("change",function(t){return e._sliderChanged(t)}),i.addEventListener("input",function(t){return e._sliderChanged(t)}),i.addEventListener("mousedown",function(){return e.map.dragging.disable()}),document.addEventListener("mouseup",function(){return e.map.dragging.enable()}),this._timeSlider=i},_makeOutput:function(t){this._output=L.DomUtil.create("output","time-text",t),this._output.innerHTML=this.options.formatOutput(this.start)},_onKeydown:function(t){switch(t.keyCode||t.which){case 37:this.prev();break;case 39:this.next();break;case 32:this.toggle();break;default:return}t.preventDefault()},_sliderChanged:function(t){var e=parseFloat(t.target.value,10);this.time=e,this.options.waitToUpdateMap&&"change"!==t.type||this.timelines.forEach(function(t){return t.setTime(e)}),this._output&&(this._output.innerHTML=this.options.formatOutput(e))},addTimelines:function(){var t=this;this.pause();for(var e=this.timelines.length,i=arguments.length,n=Array(i),s=0;i>s;s++)n[s]=arguments[s];n.forEach(function(e){-1===t.timelines.indexOf(e)&&t.timelines.push(e)}),this.timelines.length!==e&&(this._recalculate(),this.options.showTicks&&this._rebuildDataList(),this.setTime(this.start))},removeTimelines:function(){var t=this;this.pause();for(var e=this.timelines.length,i=arguments.length,n=Array(i),s=0;i>s;s++)n[s]=arguments[s];n.forEach(function(e){var i=t.timelines.indexOf(e);-1!==i&&t.timelines.splice(i,1)}),this.timelines.length!==e&&(this._recalculate(),this.options.showTicks&&this._rebuildDataList(),this.setTime(this.start))},toggle:function(){this._playing?this.pause():this.play()},prev:function(){this.pause();var t=this._nearestEventTime(this.time,-1);this._timeSlider.value=t,this.setTime(t)},pause:function(){clearTimeout(this._timer),this._playing=!1,this.container.classList.remove("playing")},play:function(){var t=this;clearTimeout(this._timer),parseFloat(this._timeSlider.value,10)===this.end&&(this._timeSlider.value=this.start),this._timeSlider.value=parseFloat(this._timeSlider.value,10)+this._stepSize,this.setTime(this._timeSlider.value),parseFloat(this._timeSlider.value,10)===this.end?(this._playing=!1,this.container.classList.remove("playing")):(this._playing=!0,this.container.classList.add("playing"),this._timer=setTimeout(function(){return t.play()},this._stepDuration))},next:function(){this.pause();var t=this._nearestEventTime(this.time,1);this._timeSlider.value=t,this.setTime(t)},setTime:function(t){this._sliderChanged({type:"change",target:{value:t}})},onAdd:function(t){return this.map=t,this._createDOM(),this.setTime(this.start),this.container},onRemove:function(){this.options.enableKeyboardControls&&this._removeKeyListeners()}}),L.timelineSliderControl=function(t,e,i,n){return new L.TimelineSliderControl(t,e,i,n)}},function(t,e){}]); \ No newline at end of file +!function(t){function e(n){if(i[n])return i[n].exports;var s=i[n]={exports:{},id:n,loaded:!1};return t[n].call(s.exports,s,s.exports,e),s.loaded=!0,s.exports}var i={};return e.m=t,e.c=i,e.p="",e(0)}([function(t,e,i){"use strict";L.TimelineVersion="1.0.0-beta",i(1),i(3),i(4)},function(t,e,i){"use strict";function n(t){return t&&t.__esModule?t:{"default":t}}var s=function(){function t(t,e){var i=[],n=!0,s=!1,r=void 0;try{for(var a,o=t[Symbol.iterator]();!(n=(a=o.next()).done)&&(i.push(a.value),!e||i.length!==e);n=!0);}catch(u){s=!0,r=u}finally{try{!n&&o["return"]&&o["return"]()}finally{if(s)throw r}}return i}return function(e,i){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return t(e,i);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),r=i(2),a=n(r);L.Timeline=L.GeoJSON.extend({times:[],displayedLayers:[],ranges:null,initialize:function(t){var e=this,i=arguments.length<=1||void 0===arguments[1]?{}:arguments[1];this.ranges=new a["default"];var n=/^(\d+)(\.(\d+))?(\.(\d+))?(-(.*))?(\+(.*))?$/,r=n.exec(L.version),o=s(r,4),u=o[1],l=o[3];this.isOldVersion=0===parseInt(u,10)&&parseInt(l,10)<=7;var h={drawOnSetTime:!0};L.GeoJSON.prototype.initialize.call(this,null,i),L.Util.setOptions(this,h),L.Util.setOptions(this,i),this.options.getInterval&&(this._getInterval=function(){var t;return(t=e.options).getInterval.apply(t,arguments)}),t&&this._process(t)},_getInterval:function(t){return{start:new Date(t.properties.start).getTime(),end:new Date(t.properties.end).getTime()}},_process:function(t){var e=this,i=1/0,n=-(1/0);t.features.forEach(function(t){var s=e._getInterval(t);e.ranges.insert(s.start,s.end,t),e.times.push(s.start),e.times.push(s.end),i=Math.min(i,s.start),n=Math.max(n,s.end)}),this.start=this.options.start||i,this.end=this.options.end||n,this.time=this.start,0!==this.times.length&&(this.times.sort(function(t,e){return t-e}),this.times=this.times.reduce(function(t,e,i){if(0===i)return t;var n=t[t.length-1];return n!==e&&t.push(e),t},[this.times[0]]))},addData:function(t){var e=this,i=L.Util.isArray(t)?t:t.features;if(i)return i.filter(function(t){return t.geometries||t.geometry||t.features||t.coordinates}).forEach(function(t){return e.addData(t)}),this;if(this.options.filter&&!this.options.filter(t))return this;var n=L.GeoJSON.geometryToLayer(t,this.isOldVersion?this.options.pointToLayer:this.options);return n?(this.displayedLayers.push({layer:n,geoJSON:t}),n.feature=L.GeoJSON.asFeature(t),n.defaultOptions=n.options,this.resetStyle(n),this.options.onEachFeature&&this.options.onEachFeature(t,n),void this.addLayer(n)):this},removeLayer:function(t){var e=arguments.length<=1||void 0===arguments[1]?!0:arguments[1];L.GeoJSON.prototype.removeLayer.call(this,t),e&&(this.displayedLayers=this.displayedLayers.filter(function(e){return e.layer!==t}))},setTime:function(t){this.time="number"==typeof t?t:new Date(t).getTime(),this.options.drawOnSetTime&&this.updateDisplayedLayers(),this.fire("change")},updateDisplayedLayers:function(){for(var t=this,e=this.ranges.lookup(this.time),i=0;i=t&&e.push(n.data),e.push.apply(e,i(this.lookup(t,n.right)))),e)}}]),t}();e["default"]=a},function(t,e){"use strict";function i(t){return t&&"undefined"!=typeof Symbol&&t.constructor===Symbol?"symbol":typeof t}function n(t){if(Array.isArray(t)){for(var e=0,i=Array(t.length);e=t.start&&e<=t.end});e.push.apply(e,n(s))}),e.length){var s=function(){e.sort(function(t,e){return t-e});var t=[e[0]];return e.reduce(function(e,i){return e!==i&&t.push(i),i}),{v:t}}();if("object"===("undefined"==typeof s?"undefined":i(s)))return s.v}return e},_recalculate:function(){var t="undefined"!=typeof this.options.start,e="undefined"!=typeof this.options.end,i=this.options.duration,n=1/0,s=-(1/0);this.timelines.forEach(function(t){t.starts&&(s=t.end)}),t||(this.start=n,this._timeSlider.min=n===1/0?0:n,this._timeSlider.value=this._timeSlider.min),e||(this.end=s,this._timeSlider.max=s===-(1/0)?0:s),this._stepSize=Math.max(1,(this.end-this.start)/this.options.steps),this._stepDuration=Math.max(1,i/this.options.steps)},_nearestEventTime:function(t){for(var e=arguments.length<=1||void 0===arguments[1]?0:arguments[1],i=this._getTimes(),n=!1,s=i[0],r=1;r=t){if(-1===e)return s;if(1!==e){var o=Math.abs(t-s),u=Math.abs(t-a);return u>o?s:a}if(a!==t)return a;n=!0}s=a}return s},_createDOM:function(){var t=["leaflet-control-layers","leaflet-control-layers-expanded","leaflet-timeline-control"],e=L.DomUtil.create("div",t.join(" "));if(this.container=e,this.options.enablePlayback){var i=L.DomUtil.create("div","sldr-ctrl-container",e),n=L.DomUtil.create("div","button-container",i);this._makeButtons(n),this.options.enableKeyboardControls&&this._addKeyListeners(),this._makeOutput(i)}this._makeSlider(e),this.options.showTicks&&this._buildDataList(e)},_addKeyListeners:function(){var t=this;this._listener=function(){return t._onKeydown.apply(t,arguments)},document.addEventListener("keydown",this._listener)},_removeKeyListeners:function(){document.removeEventListener("keydown",this._listener)},_buildDataList:function(t){this._datalist=L.DomUtil.create("datalist","",t);var e=Math.floor(1e6*Math.random());this._datalist.id="timeline-datalist-"+e,this._timeSlider.setAttribute("list",this._datalist.id),this._rebuildDataList()},_rebuildDataList:function(){for(var t=this._datalist;t.firstChild;)t.removeChild(t.firstChild);var e=L.DomUtil.create("select","",this._datalist);this._getTimes().forEach(function(t){L.DomUtil.create("option","",e).value=t})},_makeButton:function(t,e){var i=this,n=L.DomUtil.create("button",e,t);n.addEventListener("click",function(){return i[e]()}),L.DomEvent.disableClickPropagation(n)},_makeButtons:function(t){this._makeButton(t,"prev"),this._makeButton(t,"play"),this._makeButton(t,"pause"),this._makeButton(t,"next")},_makeSlider:function(t){var e=this,i=L.DomUtil.create("input","time-slider",t);i.type="range",i.min=this.start||0,i.max=this.end||0,i.value=this.start||0,i.addEventListener("change",function(t){return e._sliderChanged(t)}),i.addEventListener("input",function(t){return e._sliderChanged(t)}),i.addEventListener("mousedown",function(){return e.map.dragging.disable()}),document.addEventListener("mouseup",function(){return e.map.dragging.enable()}),this._timeSlider=i},_makeOutput:function(t){this._output=L.DomUtil.create("output","time-text",t),this._output.innerHTML=this.options.formatOutput(this.start)},_onKeydown:function(t){switch(t.keyCode||t.which){case 37:this.prev();break;case 39:this.next();break;case 32:this.toggle();break;default:return}t.preventDefault()},_sliderChanged:function(t){var e=parseFloat(t.target.value,10);this.time=e,this.options.waitToUpdateMap&&"change"!==t.type||this.timelines.forEach(function(t){return t.setTime(e)}),this._output&&(this._output.innerHTML=this.options.formatOutput(e))},addTimelines:function(){var t=this;this.pause();for(var e=this.timelines.length,i=arguments.length,n=Array(i),s=0;i>s;s++)n[s]=arguments[s];n.forEach(function(e){-1===t.timelines.indexOf(e)&&t.timelines.push(e)}),this.timelines.length!==e&&(this._recalculate(),this.options.showTicks&&this._rebuildDataList(),this.setTime(this.start))},removeTimelines:function(){var t=this;this.pause();for(var e=this.timelines.length,i=arguments.length,n=Array(i),s=0;i>s;s++)n[s]=arguments[s];n.forEach(function(e){var i=t.timelines.indexOf(e);-1!==i&&t.timelines.splice(i,1)}),this.timelines.length!==e&&(this._recalculate(),this.options.showTicks&&this._rebuildDataList(),this.setTime(this.start))},toggle:function(){this._playing?this.pause():this.play()},prev:function(){this.pause();var t=this._nearestEventTime(this.time,-1);this._timeSlider.value=t,this.setTime(t)},pause:function(){clearTimeout(this._timer),this._playing=!1,this.container.classList.remove("playing")},play:function(){var t=this;clearTimeout(this._timer),parseFloat(this._timeSlider.value,10)===this.end&&(this._timeSlider.value=this.start),this._timeSlider.value=parseFloat(this._timeSlider.value,10)+this._stepSize,this.setTime(this._timeSlider.value),parseFloat(this._timeSlider.value,10)===this.end?(this._playing=!1,this.container.classList.remove("playing")):(this._playing=!0,this.container.classList.add("playing"),this._timer=setTimeout(function(){return t.play()},this._stepDuration))},next:function(){this.pause();var t=this._nearestEventTime(this.time,1);this._timeSlider.value=t,this.setTime(t)},setTime:function(t){this._sliderChanged({type:"change",target:{value:t}})},onAdd:function(t){return this.map=t,this._createDOM(),this.setTime(this.start),this.container},onRemove:function(){this.options.enableKeyboardControls&&this._removeKeyListeners()}}),L.timelineSliderControl=function(t,e,i,n){return new L.TimelineSliderControl(t,e,i,n)}},function(t,e){}]); \ No newline at end of file diff --git a/package.json b/package.json index 7f59172c..b76002cf 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "leaflet.timeline", - "version": "1.0.0-alpha.1", + "version": "1.0.0-beta", "description": "Show GeoJSON objects on a timeline", "scripts": { "build": "webpack", diff --git a/src/Timeline.js b/src/Timeline.js index 43d0b691..70b5c073 100644 --- a/src/Timeline.js +++ b/src/Timeline.js @@ -16,7 +16,7 @@ L.Timeline = L.GeoJSON.extend({ * data. * @param {Boolean} [options.drawOnSetTime=true] Make the layer draw as soon * as `setTime` is called. If this is set to false, you will need to call - * `draw()` manually. + * `updateDisplayedLayers()` manually. */ initialize(geojson, options = {}) { // Some functionality was changed after Leaflet 0.7; some people use the diff --git a/src/index.js b/src/index.js index 8f3a6556..97f6c5b0 100644 --- a/src/index.js +++ b/src/index.js @@ -1,6 +1,6 @@ /* global require, L */ -L.TimelineVersion = '1.0.0'; +L.TimelineVersion = '1.0.0-beta'; require('./Timeline.js'); require('./TimelineSliderControl.js');