@micromag/viewer 0.3.771 → 0.3.773

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/es/index.js +16 -10
  2. package/package.json +2 -2
package/es/index.js CHANGED
@@ -2768,6 +2768,7 @@ var propTypes$2 = {
2768
2768
  shareBasePath: PropTypes.string,
2769
2769
  afterShareMenuButton: PropTypes.node,
2770
2770
  beforeScreensMenuButton: PropTypes.node,
2771
+ backToFirstScreenTimeout: PropTypes.number,
2771
2772
  closeable: PropTypes.bool,
2772
2773
  withMetadata: PropTypes.bool,
2773
2774
  withMicromagBranding: PropTypes.bool,
@@ -2827,6 +2828,7 @@ var defaultProps$2 = {
2827
2828
  shareBasePath: null,
2828
2829
  afterShareMenuButton: null,
2829
2830
  beforeScreensMenuButton: null,
2831
+ backToFirstScreenTimeout: null,
2830
2832
  menuDotsButtons: null,
2831
2833
  closeable: false,
2832
2834
  withMetadata: false,
@@ -2882,6 +2884,7 @@ var Viewer = function Viewer(_ref) {
2882
2884
  shareBasePath = _ref.shareBasePath,
2883
2885
  afterShareMenuButton = _ref.afterShareMenuButton,
2884
2886
  beforeScreensMenuButton = _ref.beforeScreensMenuButton,
2887
+ backToFirstScreenTimeout = _ref.backToFirstScreenTimeout,
2885
2888
  menuDotsButtons = _ref.menuDotsButtons,
2886
2889
  closeable = _ref.closeable,
2887
2890
  withMetadata = _ref.withMetadata,
@@ -3285,9 +3288,6 @@ var Viewer = function Viewer(_ref) {
3285
3288
  progressSpring = _useDragProgress.progress,
3286
3289
  dragContentBind = _useDragProgress.bind,
3287
3290
  transitionDirection = _useDragProgress.direction;
3288
-
3289
- // console.log('isDragging', isDragging, transitionDirection);
3290
-
3291
3291
  var getScreenStylesByIndex = function getScreenStylesByIndex(index, spring) {
3292
3292
  if (transitionType === 'stack') {
3293
3293
  return {
@@ -3472,13 +3472,19 @@ var Viewer = function Viewer(_ref) {
3472
3472
  bottomHeight = playbackControlsContainerHeight / screenScale;
3473
3473
  }
3474
3474
  var NavigationHint = withNavigationHint === 'hand' ? HandTap : ArrowHint;
3475
-
3476
- // console.log({
3477
- // screenIndex,
3478
- // transitionDirection,
3479
- // transitioned,
3480
- // });
3481
-
3475
+ useEffect(function () {
3476
+ var timeout = null;
3477
+ if (backToFirstScreenTimeout !== null && isView && screensCount > 1 && screenIndex !== 0) {
3478
+ timeout = setTimeout(function () {
3479
+ changeIndex(0);
3480
+ }, backToFirstScreenTimeout);
3481
+ }
3482
+ return function () {
3483
+ if (timeout !== null) {
3484
+ clearTimeout(timeout);
3485
+ }
3486
+ };
3487
+ }, [backToFirstScreenTimeout, isView, screenIndex, screensCount, changeIndex, isDragging]);
3482
3488
  return /*#__PURE__*/React.createElement(StoryProvider, {
3483
3489
  story: parsedStory
3484
3490
  }, /*#__PURE__*/React.createElement(ScreenSizeProvider, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@micromag/viewer",
3
- "version": "0.3.771",
3
+ "version": "0.3.773",
4
4
  "private": false,
5
5
  "description": "",
6
6
  "keywords": [
@@ -91,5 +91,5 @@
91
91
  "access": "public",
92
92
  "registry": "https://registry.npmjs.org/"
93
93
  },
94
- "gitHead": "a74bf984979f2bee58b57859808a8d9f6fa31f4a"
94
+ "gitHead": "27df255b8730e76971a90991695f40b3a5fc694a"
95
95
  }