@micromag/viewer 0.3.803 → 0.3.805
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.
- package/es/index.js +57 -54
- package/package.json +2 -2
package/es/index.js
CHANGED
|
@@ -3173,7 +3173,10 @@ var Viewer = function Viewer(_ref) {
|
|
|
3173
3173
|
setPointerDownTime(null);
|
|
3174
3174
|
}, [screenIndex]);
|
|
3175
3175
|
useEffect(function () {
|
|
3176
|
-
|
|
3176
|
+
var _ref1 = playbackMedia || {},
|
|
3177
|
+
mediaTagName = _ref1.tagName;
|
|
3178
|
+
var mediaIsVideo = mediaTagName === 'VIDEO';
|
|
3179
|
+
if (pointerDownTime === null || !playing || !mediaIsVideo) {
|
|
3177
3180
|
return function () {};
|
|
3178
3181
|
}
|
|
3179
3182
|
var interval = setTimeout(function () {
|
|
@@ -3183,26 +3186,26 @@ var Viewer = function Viewer(_ref) {
|
|
|
3183
3186
|
return function () {
|
|
3184
3187
|
return clearInterval(interval);
|
|
3185
3188
|
};
|
|
3186
|
-
}, [playing, pointerDownTime, longPressPauseDelay]);
|
|
3189
|
+
}, [playing, pointerDownTime, longPressPauseDelay, playbackMedia]);
|
|
3187
3190
|
var onPointerDown = useCallback(function () {
|
|
3188
3191
|
setPointerDownTime(Date.now());
|
|
3189
3192
|
}, []);
|
|
3190
|
-
var onTap = useCallback(function (
|
|
3191
|
-
var currentTarget =
|
|
3192
|
-
event =
|
|
3193
|
-
target =
|
|
3194
|
-
|
|
3195
|
-
x =
|
|
3196
|
-
y =
|
|
3197
|
-
elapsedTime =
|
|
3198
|
-
|
|
3199
|
-
bindState =
|
|
3193
|
+
var onTap = useCallback(function (_ref10) {
|
|
3194
|
+
var currentTarget = _ref10.currentTarget,
|
|
3195
|
+
event = _ref10.event,
|
|
3196
|
+
target = _ref10.target,
|
|
3197
|
+
_ref10$xy = _slicedToArray(_ref10.xy, 2),
|
|
3198
|
+
x = _ref10$xy[0],
|
|
3199
|
+
y = _ref10$xy[1],
|
|
3200
|
+
elapsedTime = _ref10.elapsedTime,
|
|
3201
|
+
_ref10$args = _slicedToArray(_ref10.args, 1),
|
|
3202
|
+
bindState = _ref10$args[0];
|
|
3200
3203
|
setPointerDownTime(null);
|
|
3201
|
-
var
|
|
3202
|
-
|
|
3203
|
-
currentPlaying =
|
|
3204
|
-
|
|
3205
|
-
currentLongPressPaused =
|
|
3204
|
+
var _ref11 = bindState || {},
|
|
3205
|
+
_ref11$playing = _ref11.playing,
|
|
3206
|
+
currentPlaying = _ref11$playing === void 0 ? false : _ref11$playing,
|
|
3207
|
+
_ref11$longPressPause = _ref11.longPressPaused,
|
|
3208
|
+
currentLongPressPaused = _ref11$longPressPause === void 0 ? false : _ref11$longPressPause;
|
|
3206
3209
|
if (!currentPlaying && currentLongPressPaused) {
|
|
3207
3210
|
setPlaying(true);
|
|
3208
3211
|
setLongPressPaused(false);
|
|
@@ -3223,12 +3226,12 @@ var Viewer = function Viewer(_ref) {
|
|
|
3223
3226
|
y: y
|
|
3224
3227
|
});
|
|
3225
3228
|
}, [interactWithScreen, screenIndex, tapMaximumDuration]);
|
|
3226
|
-
var computeScreenProgress = useCallback(function (
|
|
3227
|
-
var active =
|
|
3228
|
-
|
|
3229
|
-
mx =
|
|
3230
|
-
|
|
3231
|
-
vx =
|
|
3229
|
+
var computeScreenProgress = useCallback(function (_ref12) {
|
|
3230
|
+
var active = _ref12.active,
|
|
3231
|
+
_ref12$movement = _slicedToArray(_ref12.movement, 1),
|
|
3232
|
+
mx = _ref12$movement[0],
|
|
3233
|
+
_ref12$velocity = _slicedToArray(_ref12.velocity, 1),
|
|
3234
|
+
vx = _ref12$velocity[0];
|
|
3232
3235
|
var p = mx / screenContainerWidth; // drag "ratio": how much of the screen width has been swiped?
|
|
3233
3236
|
var forwards = mx < 0; // true if swiping to left (to navigate forwards)
|
|
3234
3237
|
var newIndex = !forwards ? screenIndex - 1 : screenIndex + 1; // which item index are we moving towards?
|
|
@@ -3241,15 +3244,15 @@ var Viewer = function Viewer(_ref) {
|
|
|
3241
3244
|
}
|
|
3242
3245
|
return screenIndex - progress;
|
|
3243
3246
|
}, [screenContainerWidth, screenIndex]);
|
|
3244
|
-
var onScreenProgress = useCallback(function (progress,
|
|
3245
|
-
var active =
|
|
3246
|
-
|
|
3247
|
-
bindState =
|
|
3248
|
-
var
|
|
3249
|
-
|
|
3250
|
-
currentPlaying =
|
|
3251
|
-
|
|
3252
|
-
currentLongPressPaused =
|
|
3247
|
+
var onScreenProgress = useCallback(function (progress, _ref13) {
|
|
3248
|
+
var active = _ref13.active,
|
|
3249
|
+
_ref13$args = _slicedToArray(_ref13.args, 1),
|
|
3250
|
+
bindState = _ref13$args[0];
|
|
3251
|
+
var _ref14 = bindState || {},
|
|
3252
|
+
_ref14$playing = _ref14.playing,
|
|
3253
|
+
currentPlaying = _ref14$playing === void 0 ? false : _ref14$playing,
|
|
3254
|
+
_ref14$longPressPause = _ref14.longPressPaused,
|
|
3255
|
+
currentLongPressPaused = _ref14$longPressPause === void 0 ? false : _ref14$longPressPause;
|
|
3253
3256
|
if (!active && !currentPlaying && currentLongPressPaused) {
|
|
3254
3257
|
setPlaying(true);
|
|
3255
3258
|
setLongPressPaused(false);
|
|
@@ -3355,11 +3358,11 @@ var Viewer = function Viewer(_ref) {
|
|
|
3355
3358
|
menuDotsContainerRef = _useDimensionObserver3.ref,
|
|
3356
3359
|
_useDimensionObserver4 = _useDimensionObserver3.height,
|
|
3357
3360
|
menuDotsContainerHeight = _useDimensionObserver4 === void 0 ? 0 : _useDimensionObserver4;
|
|
3358
|
-
var onClickScreen = useCallback(function (
|
|
3359
|
-
var itemScreenId =
|
|
3361
|
+
var onClickScreen = useCallback(function (_ref15) {
|
|
3362
|
+
var itemScreenId = _ref15.screenId;
|
|
3360
3363
|
onInteractionPrivate();
|
|
3361
|
-
var index = screens.findIndex(function (
|
|
3362
|
-
var id =
|
|
3364
|
+
var index = screens.findIndex(function (_ref16) {
|
|
3365
|
+
var id = _ref16.id;
|
|
3363
3366
|
return id === itemScreenId;
|
|
3364
3367
|
});
|
|
3365
3368
|
changeIndex(index);
|
|
@@ -3430,26 +3433,26 @@ var Viewer = function Viewer(_ref) {
|
|
|
3430
3433
|
_useState12 = _slicedToArray(_useState11, 2),
|
|
3431
3434
|
shareIncentiveVisible = _useState12[0],
|
|
3432
3435
|
setShareIncentiveVisible = _useState12[1];
|
|
3433
|
-
var
|
|
3434
|
-
|
|
3435
|
-
header =
|
|
3436
|
-
var
|
|
3437
|
-
|
|
3438
|
-
shareIncentive =
|
|
3439
|
-
var
|
|
3440
|
-
|
|
3441
|
-
hasShareIncentive =
|
|
3442
|
-
_ref18$label = _ref18.label,
|
|
3443
|
-
shareIncentiveLabel = _ref18$label === void 0 ? null : _ref18$label;
|
|
3444
|
-
var _ref19 = currentShareIncentive || {},
|
|
3436
|
+
var _ref17 = currentScreen || {},
|
|
3437
|
+
_ref17$header = _ref17.header,
|
|
3438
|
+
header = _ref17$header === void 0 ? null : _ref17$header;
|
|
3439
|
+
var _ref18 = header || {},
|
|
3440
|
+
_ref18$shareIncentive = _ref18.shareIncentive,
|
|
3441
|
+
shareIncentive = _ref18$shareIncentive === void 0 ? null : _ref18$shareIncentive;
|
|
3442
|
+
var _ref19 = shareIncentive || {},
|
|
3443
|
+
_ref19$active = _ref19.active,
|
|
3444
|
+
hasShareIncentive = _ref19$active === void 0 ? false : _ref19$active,
|
|
3445
3445
|
_ref19$label = _ref19.label,
|
|
3446
|
-
|
|
3447
|
-
var _ref20 =
|
|
3448
|
-
_ref20$
|
|
3449
|
-
|
|
3450
|
-
var _ref21 =
|
|
3446
|
+
shareIncentiveLabel = _ref19$label === void 0 ? null : _ref19$label;
|
|
3447
|
+
var _ref20 = currentShareIncentive || {},
|
|
3448
|
+
_ref20$label = _ref20.label,
|
|
3449
|
+
currentShareIncentiveLabel = _ref20$label === void 0 ? null : _ref20$label;
|
|
3450
|
+
var _ref21 = shareIncentiveLabel || {},
|
|
3451
3451
|
_ref21$body = _ref21.body,
|
|
3452
|
-
|
|
3452
|
+
incentiveLabel = _ref21$body === void 0 ? null : _ref21$body;
|
|
3453
|
+
var _ref22 = currentShareIncentiveLabel || {},
|
|
3454
|
+
_ref22$body = _ref22.body,
|
|
3455
|
+
currentIncentiveLabel = _ref22$body === void 0 ? null : _ref22$body;
|
|
3453
3456
|
useEffect(function () {
|
|
3454
3457
|
setShareIncentiveVisible(true);
|
|
3455
3458
|
if (hasShareIncentive && shareIncentiveLabel !== currentShareIncentiveLabel) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@micromag/viewer",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.805",
|
|
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": "
|
|
94
|
+
"gitHead": "5b337b3f92c002c89a978475f49048468b3c44bd"
|
|
95
95
|
}
|