Skip to content

Commit b84bae1

Browse files
baloolaofftherailz
authored andcommitted
Timeline scroll (#3333)
Fix #3285 Timeline scroll. Fixed issues with range initialization
1 parent 98a7c6a commit b84bae1

3 files changed

Lines changed: 7 additions & 4 deletions

File tree

web/client/epics/timeline.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -186,11 +186,11 @@ module.exports = {
186186
const currentOffset = offsetTimeSelector(state);
187187
const rangeDistance = moment(end).diff(start);
188188
// Set current moment, if not set yet, to current viewport center. otherwise, it is set to now.
189-
let currentMoment = currentViewRange ? moment(start).add(rangeDistance / 2).toISOString() : moment(new Date());
189+
let currentMoment = currentViewRange ? moment(start).add(rangeDistance / 2).toISOString() : moment(new Date()).toISOString();
190190

191191
const initialOffsetTime = moment(time ? time : currentMoment).add(rangeDistance / RATIO);
192-
let setTime = action.enabled && !time ? Rx.Observable.of(setCurrentTime(currentMoment.toISOString())) : Rx.Observable.empty();
193-
let setOff = action.enabled && !currentOffset || action.enabled && moment(currentOffset.toISOString()).diff(time) < 0 ? Rx.Observable.of(setCurrentOffset(initialOffsetTime.toISOString()))
192+
let setTime = action.enabled && !time ? Rx.Observable.of(setCurrentTime(currentMoment)) : Rx.Observable.empty();
193+
let setOff = action.enabled && !currentOffset || action.enabled && moment(currentOffset).diff(time) < 0 ? Rx.Observable.of(setCurrentOffset(initialOffsetTime.toISOString()))
194194
: Rx.Observable.empty();
195195
const centerToCurrentViewRange = currentViewRange ? Rx.Observable.empty() : Rx.Observable.of(
196196
onRangeChanged({

web/client/plugins/timeline/Timeline.jsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,8 @@ const enhance = compose(
248248
defaultProps({
249249
key: 'timeline',
250250
options: {
251+
maxHeight: '150px',
252+
verticalScroll: true,
251253
stack: false,
252254
showMajorLabels: true,
253255
showCurrentTime: false,
@@ -292,7 +294,7 @@ const enhance = compose(
292294
type: 'background',
293295
className: 'ms-playback-range'
294296
} : null,
295-
offsetEnabled && playbackRange && playbackRange.startPlaybackTime !== undefined && playbackRange.endPlaybackTime !== undefined ? {
297+
offsetEnabled && currentTimeRange.start !== undefined && currentTimeRange.end !== undefined ? {
296298
id: 'current-range',
297299
...getStartEnd(currentTimeRange.start, currentTimeRange.end),
298300
type: 'background',

web/client/themes/default/less/timeline.less

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,7 @@
250250
.shadow;
251251
z-index: 30;
252252
.vis-content {
253+
margin-bottom: 30%;
253254
border-bottom: 1px solid @ms2-color-shade-lighter;
254255

255256
.vis-label {

0 commit comments

Comments
 (0)