I have created my own toolbar which handles the clocks events such as the pause, forward and backwards functions. I now want to display the multiplier, date and time in this toolbox but can't seem to find a way of doing this?
I have been looking at the dateLabel, multiplierLabel and timeLabel for this is that the right area or is there another way of achieving this?
I have managed to get this to display now however the time and multiplier are not dynamic they do not change as they do on the clock?
dateLabel
, timeLabel
, etc. are observable properties [1], which means that they can notify subscribers when their value changes. In Cesium, we use Knockout with the ES5 plugin [2] to implement this. The Animation widget uses Knockout data binding to update the UI when the properties change, but you can also subscribe to the changes and update your display manually:
function dateLabelChanged(value) {
// value is the new value of dateLabel, update your display to display the new value however you need to
}
// attach the listener to dateLabel
Cesium.knockout.getObservable(animationViewModel, ‘dateLabel’).subscribe(dateLabelChanged);
// set the initial value immediately
dateLabelChanged(animationViewModel.dateLabel);
You can register other listeners for the other properties to update the display for each of them in the same way.
[1] http://knockoutjs.com/documentation/observables.html
[2] http://blog.stevensanderson.com/2013/05/20/knockout-es5-a-plugin-to-simplify-your-syntax/
I am currently displaying each using something like this:
var date = new Text();
date.setValue(animationViewModel.dateLabel);
toolbox.addChild(date);
How do I incorporate this with the way I am using?
I've got it! Thanks very much.