Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cesuim handle timebar click

How to handle Cesuim timebar click? It would be very comfortable to get clicked time in callback. Im nearly sure that it is implemented, so im looking for something like this.

function handleClick(event) {
  console.log(event.CLICKED_DATETIME);
}

viewer.timebar.ON_TIMEBAR_CLICK = handleClick;

Thanks.

like image 296
Sasha Kos Avatar asked Nov 20 '25 15:11

Sasha Kos


1 Answers

Yes, that's pretty simple. Here's what Viewer does currently:

viewer.timeline.addEventListener('settime', onTimelineScrubfunction, false);

But, some caveats:

  • This event will fire quite rapidly if the user "scrubs" (drags the current time bar across the timeline). Be prepared for a lot of events at once, like mousemove or touch/pointer move. Don't try to animate the globe during the event, just set some variable to take effect on the next animation frame like Viewer does.

  • This API is technically "private", which just means it is subject to change in any release without Cesium's normal deprecation policy. Even so, it's the only way to get this event, so go ahead and use it, just be careful to retest it particularly after reading about any timeline changes in the release notes (this is uncommon, as the timeline has been static for a long time now, but someday a full replacement could happen).

like image 132
emackey Avatar answered Nov 22 '25 05:11

emackey