I have been using onMoving event to trace the changing values of start and end.
How can I find the delta between previous and current values of start and end ?
onMoving: function(item, callback) {
if (item.start < options.min) item.start = options.min;
if (item.video_start == 0 && item.segment_start < item.video_start) {
item.segment_start = item.video_start;
}
if (item.video_end > 0 && item.segment_end > item.video_end) {
item.segment_end = item.video_end;
}
callback(item);
rearrange_timeline_min_max_value();
},
I can see the values with following event, however this is also needed in onMove and onMoving in order to finalize it callback(item) or callback(null).
timeline_items.on('*', function (event, properties) {
console.log("Properties : " + JSON.stringify(properties));
});
How can I get the delta for start and end with onMoving ?
The item is not updated in the items DataSet until the callback function is called by
onMove
. You can therefore fetch the existing item from the DataSet within theonMove
andonMoving
functions and use the original values in your logic.Example is included into the post below and also at https://jsfiddle.net/2gmj8uec/. The example just logs the old start / end times along with the updated ones. When moving the 'From' time doesn't change until a moved event has fired to update the DataSet.