fix: [timeline] correctly adapt time scale when expanding items

pull/4743/head
mokaddem 2019-06-13 15:12:29 +02:00
parent 93cea354ba
commit 21332e2d82
1 changed files with 23 additions and 1 deletions

View File

@ -132,12 +132,34 @@ function expandItem() {
}
function get_next_step(mom) {
var scale = eventTimeline.timeAxis.step.scale;
var scale = adapt_scale(eventTimeline.timeAxis.step.scale);
var momAhead = mom.clone();
momAhead.add(1, scale);
return momAhead;
}
function adapt_scale(scale) {
first_letter = scale.charAt(0);
if (first_letter !== 'm' && first_letter !== 'w') {
return first_letter;
} else {
switch (scale) {
case 'millisecond':
return 'ms';
case 'minute':
return 'm';
case 'month':
return 'M';
case 'week':
return 'w';
case 'weekday':
return 'd';
default:
return scale;
}
}
}
function build_attr_template(attr) {
var span = $('<span data-itemID="'+attr.id+'">');
if (!attr.seen_enabled) {