Skip to content

Commit fd24cf4

Browse files
committed
BREAKING CHANGE! now the original library and plugins must be installed manually
1 parent 89db201 commit fd24cf4

File tree

11 files changed

+264
-324
lines changed

11 files changed

+264
-324
lines changed

README.md

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,15 @@
55

66

77
```bash
8-
npm install react-photo-sphere-viewer
8+
npm install @photo-sphere-viewer/core react-photo-sphere-viewer
99
```
1010

11+
> [!IMPORTANT]
12+
> Since v5.0.0-psv5.7.1, to use `<ReactPhotoSphereViewer />` you have to manually install the JS library `@photo-sphere-viewer/core`. This is a breaking change. The library is not included in the package anymore. You can install it using the command `npm install @photo-sphere-viewer/core` or `yarn add @photo-sphere-viewer/core`. I decided to remove the library from the package to reduce the size of the package and to avoid the need to update the package every time the original library is updated. In particular, from now on, to use a plugin or an adapter, you need to import it directly from the package. For example, to use the `MarkersPlugin` you need to import it from the package `import { MarkersPlugin } from '@photo-sphere-viewer/markers-plugin'`.
13+
1114
## Library Version
12-
Original Wrapped Library: [PhotoSphereViewer](https://github.com/mistic100/Photo-Sphere-Viewer) Version: 5.6.0 [<font color="green">**NEW**</font>]
13-
Now the component version is composed by the semantic version of the wrapper and the version of the original library. For example, the current version is 4.2.1-psv5.6.0. This means that the wrapper is in version 4.2.1 and the original library [psv](https://github.com/mistic100/Photo-Sphere-Viewer) is in version 5.6.0.
15+
Original Wrapped Library: [PhotoSphereViewer](https://github.com/mistic100/Photo-Sphere-Viewer) Version: 5.7.1 [<font color="green">**NEW**</font>]
16+
Now the component version is composed by the semantic version of the wrapper and the version of the original library. For example, the current version is 5.0.0-psv5.7.1. This means that the wrapper is in version 5.0.0 and the original library [psv](https://github.com/mistic100/Photo-Sphere-Viewer) is in version 5.7.1.
1417

1518
## Description
1619

@@ -198,15 +201,23 @@ type ViewerConfig = {
198201
> This code is generated from the original library. Click [here](http://photo-sphere-viewer.js.org/guide/config.html) to see documentation.
199202
200203
### Plugins
201-
To use the standard plugins provided by the original library, you need to pass the `plugins` prop to the component. The prop is an array of plugins. Each plugin can be a constructor or an array of constructor and options. To include them in the component, you need to import them directly from the "react-photo-sphere-viewer" package.
204+
To use the standard plugins provided by the original library, you need to pass the `plugins` prop to the component. The prop is an array of plugins. Each plugin can be a constructor or an array of constructor and options. To include them in the component, you need to import them directly from the "@photo-sphere-viewer/" package.
202205

203-
> The only "third-party" plugin that is supported is the "Lensflare" plugin. To use it, you need to import it from the "react-photo-sphere-viewer" package.
206+
> The only "third-party" plugin that is supported is the "Lensflare" plugin. To use it, you need to import it from the "react-photo-sphere-viewer" package, not from the original. That's because the plugin is made by me and it is not included in the original library.
204207
205208
```jsx
206-
import { ReactPhotoSphereViewer, CompassPlugin, MarkersPlugin } from 'react-photo-sphere-viewer';
209+
import { ReactPhotoSphereViewer, LensflarePlugin } from 'react-photo-sphere-viewer';
210+
import { CompassPlugin } from '@photo-sphere-viewer/compass-plugin';
211+
import { MarkersPlugin } from '@photo-sphere-viewer/markers-plugin';
207212

208213
function App() {
209214
const plugins = [
215+
[LensflarePlugin, {
216+
position: { pitch: 0, yaw: 0 },
217+
src: 'lensflare.png',
218+
width: 1000,
219+
height: 1000,
220+
}],
210221
[CompassPlugin, {
211222
hotspots: [
212223
{ longitude: '0deg' },
@@ -292,7 +303,7 @@ To use the standard library adapters provided by the original library, you need
292303

293304
```jsx
294305

295-
import { CubemapAdapter, CubemapAdapterOptions } from 'react-photo-sphere-viewer';
306+
import { CubemapAdapter, CubemapAdapterOptions } from '@photo-sphere-viewer/cubemap-adapter';
296307
```
297308

298309
> Click [here](https://photo-sphere-viewer.js.org/guide/adapters/) to see adapters documentation.

example/generic/package-lock.json

Lines changed: 99 additions & 36 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

example/generic/package.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,13 @@
33
"version": "0.1.0",
44
"private": true,
55
"dependencies": {
6+
"@photo-sphere-viewer/autorotate-plugin": "^5.7.1",
7+
"@photo-sphere-viewer/markers-plugin": "^5.7.1",
8+
"@photo-sphere-viewer/plan-plugin": "^5.7.1",
69
"@testing-library/jest-dom": "^5.16.4",
710
"@testing-library/react": "^13.3.0",
811
"@testing-library/user-event": "^13.5.0",
12+
"leaflet": "^1.9.4",
913
"prop-types": "^15.5.4",
1014
"react": "^18.2.0",
1115
"react-dom": "^18.2.0",

example/generic/src/App.js

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
import './App.css';
2-
import { ReactPhotoSphereViewer, MarkersPlugin, LensflarePlugin } from 'react-photo-sphere-viewer';
2+
import { MarkersPlugin } from '@photo-sphere-viewer/markers-plugin';
3+
import { ReactPhotoSphereViewer, LensflarePlugin } from 'react-photo-sphere-viewer';
4+
import { PlanPlugin } from '@photo-sphere-viewer/plan-plugin';
5+
import { TileLayer } from 'leaflet';
36
import React from 'react';
7+
import "@photo-sphere-viewer/plan-plugin/index.css"
48

59
function App() {
610
const photoSphereRef = React.useRef();
@@ -26,6 +30,34 @@ function App() {
2630

2731
const plugins = [
2832
[
33+
[PlanPlugin, {
34+
defaultZoom: 14,
35+
coordinates: [6.78677, 44.58241],
36+
bearing: '120deg',
37+
layers: [
38+
{
39+
name: 'OpenStreetMap',
40+
urlTemplate: 'https://tile.openstreetmap.org/{z}/{x}/{y}.png',
41+
attribution: '&copy; OpenStreetMap',
42+
},
43+
{
44+
name: 'OpenTopoMap',
45+
layer: new TileLayer('https://{s}.tile.opentopomap.org/{z}/{x}/{y}.png', {
46+
subdomains: ['a', 'b', 'c'],
47+
maxZoom: 17,
48+
}),
49+
attribution: '&copy; OpenTopoMap',
50+
},
51+
],
52+
hotspots: [
53+
{
54+
coordinates: [6.7783, 44.58506],
55+
id: 'green-lake',
56+
tooltip: 'Lac vert',
57+
color: 'green',
58+
},
59+
],
60+
}],
2961
MarkersPlugin,
3062
{
3163
// list of markers

0 commit comments

Comments
 (0)