@micromag/screen-video-360 0.3.592 → 0.3.598
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 +35 -20
- package/package.json +3 -3
package/es/index.js
CHANGED
|
@@ -361,13 +361,28 @@ var Video360Screen = function Video360Screen(_ref) {
|
|
|
361
361
|
|
|
362
362
|
useEffect(function () {
|
|
363
363
|
if (THREE !== null && hasVideoUrl && withVideoSphere) {
|
|
364
|
-
var
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
364
|
+
var _ref7 = THREE || {},
|
|
365
|
+
_ref7$Scene = _ref7.Scene,
|
|
366
|
+
Scene = _ref7$Scene === void 0 ? null : _ref7$Scene,
|
|
367
|
+
_ref7$PerspectiveCame = _ref7.PerspectiveCamera,
|
|
368
|
+
PerspectiveCamera = _ref7$PerspectiveCame === void 0 ? null : _ref7$PerspectiveCame,
|
|
369
|
+
_ref7$SphereBufferGeo = _ref7.SphereBufferGeometry,
|
|
370
|
+
SphereBufferGeometry = _ref7$SphereBufferGeo === void 0 ? null : _ref7$SphereBufferGeo,
|
|
371
|
+
_ref7$VideoTexture = _ref7.VideoTexture,
|
|
372
|
+
VideoTexture = _ref7$VideoTexture === void 0 ? null : _ref7$VideoTexture,
|
|
373
|
+
_ref7$MeshBasicMateri = _ref7.MeshBasicMaterial,
|
|
374
|
+
MeshBasicMaterial = _ref7$MeshBasicMateri === void 0 ? null : _ref7$MeshBasicMateri,
|
|
375
|
+
_ref7$Mesh = _ref7.Mesh,
|
|
376
|
+
Mesh = _ref7$Mesh === void 0 ? null : _ref7$Mesh,
|
|
377
|
+
_ref7$WebGLRenderer = _ref7.WebGLRenderer,
|
|
378
|
+
WebGLRenderer = _ref7$WebGLRenderer === void 0 ? null : _ref7$WebGLRenderer;
|
|
379
|
+
if (Scene === null || PerspectiveCamera === null || SphereBufferGeometry === null || VideoTexture === null || MeshBasicMaterial === null || Mesh === null || WebGLRenderer === null) {
|
|
380
|
+
return function () {
|
|
381
|
+
camera.current = null;
|
|
382
|
+
scene.current = null;
|
|
383
|
+
renderer.current = null;
|
|
384
|
+
};
|
|
385
|
+
}
|
|
371
386
|
var _canvasRef$current = canvasRef.current,
|
|
372
387
|
canvasWidth = _canvasRef$current.offsetWidth,
|
|
373
388
|
canvasHeight = _canvasRef$current.offsetHeight;
|
|
@@ -375,9 +390,9 @@ var Video360Screen = function Video360Screen(_ref) {
|
|
|
375
390
|
scene.current = new Scene();
|
|
376
391
|
var geometry = new SphereBufferGeometry(500, 60, 40);
|
|
377
392
|
geometry.scale(-1, 1, 1);
|
|
378
|
-
var
|
|
379
|
-
|
|
380
|
-
videoElement =
|
|
393
|
+
var _ref8 = mediaRef || {},
|
|
394
|
+
_ref8$current = _ref8.current,
|
|
395
|
+
videoElement = _ref8$current === void 0 ? null : _ref8$current;
|
|
381
396
|
var videoTexture = new VideoTexture(videoElement);
|
|
382
397
|
var videoMaterial = new MeshBasicMaterial({
|
|
383
398
|
map: videoTexture
|
|
@@ -436,20 +451,20 @@ var Video360Screen = function Video360Screen(_ref) {
|
|
|
436
451
|
var pixelsMovedTracked = useRef(false);
|
|
437
452
|
var onPointerMove = useCallback(function (e) {
|
|
438
453
|
if (pointerDown.current) {
|
|
439
|
-
var
|
|
440
|
-
|
|
441
|
-
clientX =
|
|
442
|
-
|
|
443
|
-
clientY =
|
|
454
|
+
var _ref9 = e || {},
|
|
455
|
+
_ref9$clientX = _ref9.clientX,
|
|
456
|
+
clientX = _ref9$clientX === void 0 ? null : _ref9$clientX,
|
|
457
|
+
_ref9$clientY = _ref9.clientY,
|
|
458
|
+
clientY = _ref9$clientY === void 0 ? null : _ref9$clientY;
|
|
444
459
|
var downDeltaX = pointerDownX.current - clientX;
|
|
445
460
|
var downDeltaY = pointerDownY.current - clientY;
|
|
446
461
|
lon.current = downDeltaX * 0.2 + pointerLon.current;
|
|
447
462
|
lat.current = downDeltaY * 0.2 + pointerLat.current;
|
|
448
|
-
var
|
|
449
|
-
|
|
450
|
-
lastX =
|
|
451
|
-
|
|
452
|
-
lastY =
|
|
463
|
+
var _ref10 = lastPointerClient.current || {},
|
|
464
|
+
_ref10$x = _ref10.x,
|
|
465
|
+
lastX = _ref10$x === void 0 ? clientX : _ref10$x,
|
|
466
|
+
_ref10$y = _ref10.y,
|
|
467
|
+
lastY = _ref10$y === void 0 ? clientY : _ref10$y;
|
|
453
468
|
var deltaX = Math.abs(lastX - clientX) || 0;
|
|
454
469
|
var deltaY = Math.abs(lastY - clientY) || 0;
|
|
455
470
|
pixelsMoved.current += deltaX + deltaY;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@micromag/screen-video-360",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.598",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "",
|
|
6
6
|
"keywords": [
|
|
@@ -65,7 +65,7 @@
|
|
|
65
65
|
"@micromag/element-background": "^0.3.592",
|
|
66
66
|
"@micromag/element-closed-captions": "^0.3.590",
|
|
67
67
|
"@micromag/element-container": "^0.3.590",
|
|
68
|
-
"@micromag/element-footer": "^0.3.
|
|
68
|
+
"@micromag/element-footer": "^0.3.595",
|
|
69
69
|
"@micromag/element-header": "^0.3.590",
|
|
70
70
|
"@micromag/element-image": "^0.3.590",
|
|
71
71
|
"@micromag/element-video": "^0.3.592",
|
|
@@ -81,5 +81,5 @@
|
|
|
81
81
|
"access": "public",
|
|
82
82
|
"registry": "https://registry.npmjs.org/"
|
|
83
83
|
},
|
|
84
|
-
"gitHead": "
|
|
84
|
+
"gitHead": "372bf20cd6b87388c729d8b824b5fe48618ccb2c"
|
|
85
85
|
}
|