Skip to content

Commit

Permalink
feat: Export timestamp with notifications.
Browse files Browse the repository at this point in the history
  • Loading branch information
QuentinRoy committed Aug 2, 2017
1 parent 2ea5955 commit 3547121
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 4 deletions.
3 changes: 2 additions & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ const exportNotification = n => ({
position: n.position ? n.position.slice() : undefined,
active: n.active,
selection: n.selection,
center: n.center ? n.center.slice() : undefined
center: n.center ? n.center.slice() : undefined,
timeStamp: n.timeStamp
});

/**
Expand Down
6 changes: 4 additions & 2 deletions src/move/linear-drag.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,16 @@ const createPEventFromTouchEvent = touchEvt => {
const meanY = sumY / touchList.length;
return {
originalEvent: touchEvt,
position: [meanX, meanY]
position: [meanX, meanY],
timeStamp: touchEvt.timeStamp
};
};

// Create a custom pointer from a mouse event.
const createPEventFromMouseEvent = mouseEvt => ({
originalEvent: mouseEvt,
position: [mouseEvt.clientX, mouseEvt.clientY]
position: [mouseEvt.clientX, mouseEvt.clientY],
timeStamp: mouseEvt.timeStamp
});

/**
Expand Down
8 changes: 7 additions & 1 deletion src/navigation/noviceNavigation.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,14 @@ const noviceNavigation = (
const angleDrag$ = mapAngleDrag(drag$, menuCenter);

// Start observable.
// prettier-ignore
const start$ = menuCenter
? Observable.of({ type: 'open', menu, center: menuCenter })
? Observable.of({
type: 'open',
menu,
center: menuCenter,
timeStamp: performance ? performance.now() : Date.now()
})
: angleDrag$.first().map(n => Object.assign({ type: 'open', menu }, n));

// Analyse local movements.
Expand Down

0 comments on commit 3547121

Please sign in to comment.