diff --git a/README.md b/README.md index 3e29386..d2d6f6a 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # react-photo-sphere-viewer > Photosphere Viewer for React.JS -![Screenshot](https://user-images.githubusercontent.com/14907987/180764341-a23c8eec-95c4-4294-bd1c-dc686e53df9a.png) +![Screenshot](https://user-images.githubusercontent.com/14907987/194562000-0411b51e-f017-468a-a51c-c6ce6df9b629.png) ```bash diff --git a/example/public/Test_Pano.jpg b/example/public/Test_Pano.jpg index cc762b0..abd2560 100644 Binary files a/example/public/Test_Pano.jpg and b/example/public/Test_Pano.jpg differ diff --git a/example/src/App.js b/example/src/App.js index b64bddd..ac495f0 100644 --- a/example/src/App.js +++ b/example/src/App.js @@ -14,6 +14,10 @@ function App() { }); } + React.useEffect(() => { + console.log(photoSphereRef.current.getCurrentNavbar()) + }, []); + return (
diff --git a/package-lock.json b/package-lock.json index 79e5ce5..f5685f5 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,17 +1,17 @@ { "name": "react-photo-sphere-viewer", - "version": "2.0.8", + "version": "2.1.3", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "react-photo-sphere-viewer", - "version": "2.0.8", + "version": "2.1.3", "license": "MIT", "dependencies": { "autoprefixer": "^10.4.7", "eventemitter3": "^4.0.7", - "photo-sphere-viewer": "^4.7.2" + "photo-sphere-viewer": "^4.7.3" }, "devDependencies": { "@rollup/plugin-babel": "^5.3.1", @@ -3308,8 +3308,9 @@ }, "node_modules/copyfiles": { "version": "2.4.1", + "resolved": "https://registry.npmjs.org/copyfiles/-/copyfiles-2.4.1.tgz", + "integrity": "sha512-fereAvAvxDrQDOXybk3Qu3dPbOoKoysFMWtkY3mv5BsL8//OSZVL5DCLYqgRfY5cWirgRzlC+WSrxp6Bo3eNZg==", "dev": true, - "license": "MIT", "dependencies": { "glob": "^7.0.5", "minimatch": "^3.0.3", @@ -5347,9 +5348,9 @@ } }, "node_modules/photo-sphere-viewer": { - "version": "4.7.2", - "resolved": "https://registry.npmjs.org/photo-sphere-viewer/-/photo-sphere-viewer-4.7.2.tgz", - "integrity": "sha512-1+Cd3287oyprVwXhYJLMbjPQKyyHg7Papy1O+dS1z/31YrW4humuTNijROFokF3qalYDXhawH8NfdN49xxxpEw==", + "version": "4.7.3", + "resolved": "https://registry.npmjs.org/photo-sphere-viewer/-/photo-sphere-viewer-4.7.3.tgz", + "integrity": "sha512-Jr+ZUjM2gdVyGxM+uaNm7lBmwpgh8GWUMUy/t+AhhuHgyL7w+v+kG4cxkbA0rBTrQEC9Nv92+hZE1bGktTSKyQ==", "dependencies": { "three": "^0.144.0", "uevent": "^2.1.1" @@ -6212,8 +6213,9 @@ }, "node_modules/rimraf": { "version": "3.0.2", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", + "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", "dev": true, - "license": "ISC", "dependencies": { "glob": "^7.1.3" }, @@ -9181,6 +9183,8 @@ }, "copyfiles": { "version": "2.4.1", + "resolved": "https://registry.npmjs.org/copyfiles/-/copyfiles-2.4.1.tgz", + "integrity": "sha512-fereAvAvxDrQDOXybk3Qu3dPbOoKoysFMWtkY3mv5BsL8//OSZVL5DCLYqgRfY5cWirgRzlC+WSrxp6Bo3eNZg==", "dev": true, "requires": { "glob": "^7.0.5", @@ -10469,9 +10473,9 @@ "dev": true }, "photo-sphere-viewer": { - "version": "4.7.2", - "resolved": "https://registry.npmjs.org/photo-sphere-viewer/-/photo-sphere-viewer-4.7.2.tgz", - "integrity": "sha512-1+Cd3287oyprVwXhYJLMbjPQKyyHg7Papy1O+dS1z/31YrW4humuTNijROFokF3qalYDXhawH8NfdN49xxxpEw==", + "version": "4.7.3", + "resolved": "https://registry.npmjs.org/photo-sphere-viewer/-/photo-sphere-viewer-4.7.3.tgz", + "integrity": "sha512-Jr+ZUjM2gdVyGxM+uaNm7lBmwpgh8GWUMUy/t+AhhuHgyL7w+v+kG4cxkbA0rBTrQEC9Nv92+hZE1bGktTSKyQ==", "requires": { "three": "^0.144.0", "uevent": "^2.1.1" @@ -10954,6 +10958,8 @@ }, "rimraf": { "version": "3.0.2", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", + "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", "dev": true, "requires": { "glob": "^7.1.3" diff --git a/package.json b/package.json index c54f8a6..96cb431 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "react-photo-sphere-viewer", - "version": "2.1.2", + "version": "2.1.3", "description": "Photosphere Viewer for React.JS, wrapper of photo-sphere-viewer.js", "author": "Elius94", "license": "MIT", @@ -25,7 +25,7 @@ "dependencies": { "autoprefixer": "^10.4.7", "eventemitter3": "^4.0.7", - "photo-sphere-viewer": "^4.7.2" + "photo-sphere-viewer": "^4.7.3" }, "peerDependencies": { "prop-types": "^15.5.4", diff --git a/src/index.tsx b/src/index.tsx index a3c8593..7cf0221 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -72,6 +72,7 @@ const ReactPhotoSphereViewer = forwardRef((options: Props, ref: any): React.Reac const [LITTLEPLANET_DEF_LAT] = useState(-90) const [LITTLEPLANET_FISHEYE] = useState(2) const [LITTLEPLANET_DEF_ZOOM] = useState(0) + const [currentNavbar, setCurrentNavbar] = useState<(string | object)[]>(defaultNavbar) useEffect(() => { function handleResize() { @@ -117,7 +118,6 @@ const ReactPhotoSphereViewer = forwardRef((options: Props, ref: any): React.Reac moveInertia: options.moveInertia || true, mousewheel: options.littlePlanet ? false : options.mousewheel || true, mousemove: options.mousemove || true, - captureCursor: options.captureCursor || false, mousewheelCtrlKey: options.mousewheelCtrlKey || false, touchmoveTwoFingers: options.touchmoveTwoFingers || false, useXmpData: options.useXmpData || true, @@ -194,9 +194,12 @@ const ReactPhotoSphereViewer = forwardRef((options: Props, ref: any): React.Reac }) }, } - const currentNavbar: any[] = options.navbar || defaultNavbar - currentNavbar.push(resetLittlePlanetButton) - _c.setOption("navbar", currentNavbar) + const _currentNavbar: any[] = options.navbar || defaultNavbar + if (!_currentNavbar.find((item) => item.id === "resetLittlePlanetButton")) { + _currentNavbar.push(resetLittlePlanetButton) + _c.setOption("navbar", _currentNavbar) + setCurrentNavbar(_currentNavbar) + } } Emitter.on("animate", (options: AnimateOptions) => { @@ -243,6 +246,9 @@ const ReactPhotoSphereViewer = forwardRef((options: Props, ref: any): React.Reac setOptions(options: ViewerOptions): void { return spherePlayerInstance?.setOptions(options) }, + getCurrentNavbar(): (string | object)[] { + return currentNavbar + }, zoom(value: number) { Emitter.emit("zoom", value) }, diff --git a/src/test.ts b/src/test.ts index d7cac64..bae38ae 100644 --- a/src/test.ts +++ b/src/test.ts @@ -1,7 +1,8 @@ -import ExampleComponent from './' +/*import ExampleComponent from './' describe('ExampleComponent', () => { it('is truthy', () => { expect(ExampleComponent).toBeTruthy() }) }) +*/ \ No newline at end of file