Skip to content

Commit

Permalink
Fixed allLensflares() functions:
Browse files Browse the repository at this point in the history
"toggleAllLensflares()",
"showAllLensflares()" and
"hideAllLensflares"
  • Loading branch information
Elius94 committed Feb 20, 2023
1 parent 16404b3 commit 8e9077c
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 11 deletions.
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -228,3 +228,8 @@ const viewer = new PhotoSphereViewer.Viewer({
### Result of the example

![multilens](https://user-images.githubusercontent.com/14907987/212864401-fa0861c7-b089-4681-b290-dce7a4a7c669.gif)


### CodeSandbox

[![Edit photo-sphere-viewer-lensflare-plugin](https://codesandbox.io/static/img/play-codesandbox.svg)](https://codesandbox.io/s/photo-sphere-viewer-lensflare-plugin-2oz3zh?fontsize=14&hidenavigation=1&theme=dark)
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "photo-sphere-viewer-lensflare-plugin",
"version": "1.0.5",
"version": "1.1.0",
"description": "Plugin to add lens flares on a 360° pano built with photo-sphere-viewer",
"main": "dist/index.js",
"module": "dist/index.module.js",
Expand Down
18 changes: 8 additions & 10 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,29 +61,27 @@ export class LensflarePlugin extends AbstractPlugin<LensflaresPluginEvents> {
* Toggles all lensflares
*/
toggleAllLensflares() {
if (this.state.visible) {
this.hideAllLensflares();
} else {
this.showAllLensflares();
for (const lensflare of this.getLensflares()) {
this.toggleLensflare(lensflare);
}
}

/**
* Shows all lensflares
*/
showAllLensflares() {
this.state.visible = true;

this.renderLensflares();
for (const lensflare of this.getLensflares()) {
this.toggleLensflare(lensflare, true);
}
}

/**
* Hides all lensflares
*/
hideAllLensflares() {
this.state.visible = false;

this.renderLensflares();
for (const lensflare of this.getLensflares()) {
this.toggleLensflare(lensflare, false);
}
}

/**
Expand Down

0 comments on commit 8e9077c

Please sign in to comment.