@micromag/screen-image-360 0.4.49 → 0.4.50
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 +104 -93
- package/package.json +11 -11
package/es/index.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { FormattedMessage, defineMessage } from 'react-intl';
|
|
2
|
+
import _objectSpread from '@babel/runtime/helpers/objectSpread2';
|
|
2
3
|
import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
3
4
|
import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
|
|
4
5
|
import { getSizeWithinBounds } from '@folklore/size';
|
|
5
6
|
import classNames from 'classnames';
|
|
6
|
-
import
|
|
7
|
+
import { useState, useEffect, useRef, useCallback } from 'react';
|
|
7
8
|
import { ScreenElement, PlaceholderVideo360 } from '@micromag/core/components';
|
|
8
9
|
import { useScreenRenderContext, useScreenSize, useViewerNavigation, useViewerWebView, useViewerContext, usePlaybackContext, usePlaybackMediaRef } from '@micromag/core/contexts';
|
|
9
10
|
import { useTrackScreenEvent, useDevicePixelRatio, useAnimationFrame } from '@micromag/core/hooks';
|
|
@@ -13,6 +14,7 @@ import Container from '@micromag/element-container';
|
|
|
13
14
|
import Footer from '@micromag/element-footer';
|
|
14
15
|
import Header from '@micromag/element-header';
|
|
15
16
|
import Image from '@micromag/element-image';
|
|
17
|
+
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
16
18
|
|
|
17
19
|
/**
|
|
18
20
|
* Locale loader
|
|
@@ -347,99 +349,108 @@ function Image360Screen(_ref) {
|
|
|
347
349
|
}
|
|
348
350
|
pointerDown.current = false;
|
|
349
351
|
}, [gotoPreviousScreen, gotoNextScreen, landscape]);
|
|
350
|
-
return /*#__PURE__*/
|
|
352
|
+
return /*#__PURE__*/jsxs("div", {
|
|
351
353
|
className: classNames([styles.container, className, _defineProperty({}, styles.showVideo, isPreview || isStatic || isCapture)]),
|
|
352
|
-
"data-screen-ready": (isStatic || isCapture) && posterReady || ready
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
354
|
+
"data-screen-ready": (isStatic || isCapture) && posterReady || ready,
|
|
355
|
+
children: [/*#__PURE__*/jsxs(Container, {
|
|
356
|
+
width: width,
|
|
357
|
+
height: height,
|
|
358
|
+
className: styles.content,
|
|
359
|
+
children: [/*#__PURE__*/jsx("div", {
|
|
360
|
+
ref: canvasContainerRef,
|
|
361
|
+
className: styles.videoContainer,
|
|
362
|
+
style: {
|
|
363
|
+
width: resizedImageWidth,
|
|
364
|
+
height: resizedImageHeight,
|
|
365
|
+
left: resizedImageLeft,
|
|
366
|
+
top: resizedImageTop
|
|
367
|
+
}
|
|
368
|
+
}), /*#__PURE__*/jsxs("div", {
|
|
369
|
+
className: styles.inner,
|
|
370
|
+
children: [!isPlaceholder && hasHeader ? /*#__PURE__*/jsx("div", {
|
|
371
|
+
className: styles.header,
|
|
372
|
+
style: {
|
|
373
|
+
paddingTop: spacing / 2,
|
|
374
|
+
paddingLeft: spacing,
|
|
375
|
+
paddingRight: spacing
|
|
376
|
+
},
|
|
377
|
+
children: /*#__PURE__*/jsx(Header, _objectSpread({}, header))
|
|
378
|
+
}) : null, /*#__PURE__*/jsx(ScreenElement, {
|
|
379
|
+
placeholder: /*#__PURE__*/jsx(PlaceholderVideo360, {
|
|
380
|
+
className: styles.placeholder,
|
|
381
|
+
width: "100%",
|
|
382
|
+
height: "100%"
|
|
383
|
+
}),
|
|
384
|
+
emptyClassName: styles.empty,
|
|
385
|
+
emptyLabel: /*#__PURE__*/jsx(FormattedMessage, {
|
|
386
|
+
id: "/YQ+xP",
|
|
387
|
+
defaultMessage: [{
|
|
388
|
+
"type": 0,
|
|
389
|
+
"value": "Image 360"
|
|
390
|
+
}]
|
|
391
|
+
}),
|
|
392
|
+
isEmpty: !withSphere,
|
|
393
|
+
children: withSphere ? /*#__PURE__*/jsxs(Fragment, {
|
|
394
|
+
children: [/*#__PURE__*/jsx("canvas", {
|
|
395
|
+
ref: canvasRef,
|
|
396
|
+
className: styles.canvas
|
|
397
|
+
}), /*#__PURE__*/jsx("button", {
|
|
398
|
+
className: styles.canvasButton,
|
|
399
|
+
type: "button",
|
|
400
|
+
"aria-label": "canvas-interaction",
|
|
401
|
+
onPointerDown: onPointerDown,
|
|
402
|
+
onPointerMove: onPointerMove,
|
|
403
|
+
onPointerUp: onPointerUp,
|
|
404
|
+
tabIndex: current && isView ? null : '-1'
|
|
405
|
+
})]
|
|
406
|
+
}) : /*#__PURE__*/jsx("div", {
|
|
407
|
+
className: styles.videoContainer,
|
|
408
|
+
style: {
|
|
409
|
+
width: resizedImageWidth,
|
|
410
|
+
height: resizedImageHeight,
|
|
411
|
+
left: resizedImageLeft,
|
|
412
|
+
top: resizedImageTop
|
|
413
|
+
},
|
|
414
|
+
children: /*#__PURE__*/jsx(Image, {
|
|
415
|
+
className: styles.video,
|
|
416
|
+
media: {
|
|
417
|
+
url: thumbnailUrl,
|
|
418
|
+
metadata: {
|
|
419
|
+
width: imageWidth,
|
|
420
|
+
height: imageHeight
|
|
421
|
+
}
|
|
422
|
+
},
|
|
423
|
+
width: resizedImageWidth,
|
|
424
|
+
height: resizedImageHeight,
|
|
425
|
+
resolution: resolution,
|
|
426
|
+
shouldLoad: mediaShouldLoad
|
|
427
|
+
})
|
|
428
|
+
})
|
|
429
|
+
}), !isPlaceholder && hasFooter ? /*#__PURE__*/jsx("div", {
|
|
430
|
+
className: styles.footer,
|
|
431
|
+
style: {
|
|
432
|
+
transform: current && !isPreview ? "translate(0, -".concat(viewerBottomHeight, "px)") : null,
|
|
433
|
+
paddingLeft: Math.max(spacing / 2, viewerBottomSidesWidth),
|
|
434
|
+
paddingRight: Math.max(spacing / 2, viewerBottomSidesWidth),
|
|
435
|
+
paddingBottom: spacing / 2,
|
|
436
|
+
paddingTop: 0
|
|
437
|
+
},
|
|
438
|
+
children: /*#__PURE__*/jsx(Footer, _objectSpread({}, footerProps))
|
|
439
|
+
}) : null]
|
|
440
|
+
})]
|
|
441
|
+
}), !isPlaceholder ? /*#__PURE__*/jsx(Background, {
|
|
442
|
+
background: background,
|
|
443
|
+
width: width,
|
|
444
|
+
height: height,
|
|
445
|
+
resolution: resolution,
|
|
446
|
+
playing: backgroundPlaying,
|
|
447
|
+
muted: muted,
|
|
448
|
+
shouldLoad: mediaShouldLoad,
|
|
449
|
+
mediaRef: mediaRef,
|
|
450
|
+
withoutVideo: isPreview,
|
|
451
|
+
className: styles.background
|
|
452
|
+
}) : null]
|
|
453
|
+
});
|
|
443
454
|
}
|
|
444
455
|
|
|
445
456
|
// import * as transforms from './transforms/index';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@micromag/screen-image-360",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.50",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "",
|
|
6
6
|
"keywords": [
|
|
@@ -62,15 +62,15 @@
|
|
|
62
62
|
"dependencies": {
|
|
63
63
|
"@babel/runtime": "^7.28.6",
|
|
64
64
|
"@folklore/size": "^0.1.20",
|
|
65
|
-
"@micromag/core": "^0.4.
|
|
66
|
-
"@micromag/element-background": "^0.4.
|
|
67
|
-
"@micromag/element-closed-captions": "^0.4.
|
|
68
|
-
"@micromag/element-container": "^0.4.
|
|
69
|
-
"@micromag/element-footer": "^0.4.
|
|
70
|
-
"@micromag/element-header": "^0.4.
|
|
71
|
-
"@micromag/element-image": "^0.4.
|
|
72
|
-
"@micromag/element-video": "^0.4.
|
|
73
|
-
"@micromag/transforms": "^0.4.
|
|
65
|
+
"@micromag/core": "^0.4.50",
|
|
66
|
+
"@micromag/element-background": "^0.4.50",
|
|
67
|
+
"@micromag/element-closed-captions": "^0.4.50",
|
|
68
|
+
"@micromag/element-container": "^0.4.50",
|
|
69
|
+
"@micromag/element-footer": "^0.4.50",
|
|
70
|
+
"@micromag/element-header": "^0.4.50",
|
|
71
|
+
"@micromag/element-image": "^0.4.50",
|
|
72
|
+
"@micromag/element-video": "^0.4.50",
|
|
73
|
+
"@micromag/transforms": "^0.4.50",
|
|
74
74
|
"classnames": "^2.2.6",
|
|
75
75
|
"lodash": "^4.17.23",
|
|
76
76
|
"react-intl": "^8.1.3 || ^10.0.0",
|
|
@@ -81,6 +81,6 @@
|
|
|
81
81
|
"access": "public",
|
|
82
82
|
"registry": "https://registry.npmjs.org/"
|
|
83
83
|
},
|
|
84
|
-
"gitHead": "
|
|
84
|
+
"gitHead": "940d5ca98f8f448b79eaa3e2fa685c3ee95185b8",
|
|
85
85
|
"types": "es/index.d.ts"
|
|
86
86
|
}
|