forked from JeremyHeleine/Photo-Sphere-Viewer
-
-
Notifications
You must be signed in to change notification settings - Fork 693
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
44 changed files
with
1,939 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import { AbstractPlugin, Viewer } from '../types/photo-sphere-viewer'; | ||
|
||
export class CustomPlugin extends AbstractPlugin { | ||
|
||
static id = 'custom'; | ||
|
||
constructor(psv: Viewer) { | ||
super(psv); | ||
} | ||
|
||
doSomething() { | ||
|
||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
import { CONSTANTS, Viewer } from 'photo-sphere-viewer'; | ||
import MarkersPlugin, { MarkersPluginOptions } from 'photo-sphere-viewer/dist/plugins/markers'; | ||
import { CustomPlugin } from './CustomPlugin'; | ||
|
||
const viewer = new Viewer({ | ||
container: 'container', | ||
plugins: [ | ||
[MarkersPlugin, { | ||
clickEventOnMarker: true, | ||
} as MarkersPluginOptions], | ||
CustomPlugin, | ||
], | ||
}); | ||
|
||
viewer.setPanorama('test.jpg', { | ||
transition: false, | ||
}) | ||
.then(() => { | ||
|
||
}); | ||
|
||
viewer.animate({ | ||
longitude: 0, | ||
latitude: 0, | ||
speed: '2rpm', | ||
}) | ||
.then(() => { | ||
|
||
}); | ||
|
||
viewer.zoom(50); | ||
|
||
viewer.setOption('useXmpData', true); | ||
|
||
viewer.setOptions({ | ||
useXmpData: false, | ||
}); | ||
|
||
viewer.navbar.setCaption('Test'); | ||
|
||
viewer.panel.show({ | ||
content: 'Content', | ||
clickHandler: (e: MouseEvent) => null, | ||
}); | ||
|
||
viewer.once('ready', e => { | ||
|
||
}); | ||
|
||
viewer.on('position-updated', (e, position) => { | ||
const longitude: number = position.longitude; | ||
}); | ||
|
||
viewer.on(CONSTANTS.CHANGE_EVENTS.GET_ANIMATE_POSITION, (e, position) => { | ||
return {longitude: position.longitude + 0.1, latitude: position.latitude + 0.1}; | ||
}); | ||
|
||
const customPlugin: MarkersPlugin = viewer.getPlugin(CustomPlugin); | ||
customPlugin.doSomething(); | ||
|
||
const customPluginAgain = viewer.getPlugin<CustomPlugin>('custom'); | ||
customPluginAgain.doSomething(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"compilerOptions": { | ||
"baseUrl": "./", | ||
"typeRoots": [ | ||
"../types" | ||
], | ||
"paths": { | ||
"*": ["../types/*"] | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
export type AnimationOptions = { | ||
properties: { [K: string]: { start: number, end: number } }; | ||
duration: number; | ||
delay?: number; | ||
easing?: string | ((progress: number) => number); | ||
onTick: (properties: { [K: string]: number }, progress: number) => void; | ||
}; | ||
|
||
/** | ||
* @summary Interpolation helper for animations | ||
* @description | ||
* Implements the Promise API with an additional "cancel" and "finally" methods. | ||
* The promise is resolved when the animation is complete and rejected if the animation is cancelled. | ||
*/ | ||
export class Animation implements Promise<void> { | ||
|
||
constructor(options: AnimationOptions); | ||
|
||
// @ts-ignore | ||
then(onFulfilled?: (() => void | Animation | PromiseLike<void>) | undefined | null, onRejected?: (() => void | Animation | PromiseLike<void>) | undefined | null): Animation; | ||
|
||
// @ts-ignore | ||
catch(onRejected?: (() => void | Animation | PromiseLike<void>) | undefined | null): Animation; | ||
|
||
// @ts-ignore | ||
finally(onFinally?: (() => void | Animation | PromiseLike<void>) | undefined | null): Animation; | ||
|
||
cancel(); | ||
|
||
/** | ||
* @summary Returns a resolved animation promise | ||
*/ | ||
static resolve(): Animation; | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
/** | ||
* @summary Custom error used in the lib | ||
*/ | ||
export class PSVError extends Error { | ||
name: 'PSVError'; | ||
} |
Oops, something went wrong.