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

Playback only plays backwards #6

Closed
PennyBeames opened this issue Jun 17, 2015 · 3 comments
Closed

Playback only plays backwards #6

PennyBeames opened this issue Jun 17, 2015 · 3 comments
Milestone

Comments

@PennyBeames
Copy link

Hi!

I've seriously been waiting for something like this for ages. Thank you for putting the work into it.

One thing, though. I seem to have gotten the timeline to work, at least the draggable part, but the play button will only go backwards. If I press play as soon as the page loads, nothing happens. If I drag the circle to anywhere along the timeline and then press play, the timeline and dots play perfectly, but in reverse.

Any ideas?

Link: http://pennybeames.net/maps/PermitsTOTime.html

Code:

      var timeline = L.timeline(permits, {
          formatDate: function(date){
            return moment(date).format("YYYY-MM-DD");
          },
            pointToLayer: function (feature, latlng) {
            return L.circleMarker(latlng, permitsStyle(feature));},
            onEachFeature: onEachFeature
        });
        timeline.addTo(map);
@skeate
Copy link
Owner

skeate commented Jun 17, 2015

That's strange. Seems like it's some kind of overflow issue?

Your stepSize is (calculated to be) 2830294800, which in hex is 0xA8B2DF10, which interpreted as a signed 32-bit integer is -1464672496. Which is what the time is actually changing by on each step in your example.

It'd be nice if that were documented somewhere.

I can look into some possible fixes. For now, with the dataset you have on that site, you should be able to set steps: 2000 in the options. This could slow things down somewhat, depending on your system (set it to 10000 to see an extreme case), but for me 2000 seemed fine.

@PennyBeames
Copy link
Author

Hey!

Thanks for replying so quick. Your response has definitely expose my newbie-ness! Folks like you write the magic, hacks like me cram the magic into projects. :)

I've set the step size to 2000 and it works like a charm now.

@skeate skeate modified the milestone: 0.4.0 Jun 18, 2015
@skeate
Copy link
Owner

skeate commented Jun 18, 2015

Oh hey! I forgot this was something @vencax fixed in one of his PRs, with c275f85. Merging that stuff in now

Thanks again for reporting the issue!

@skeate skeate closed this as completed Jun 18, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants