Skip to content

Commit

Permalink
photosphere: hide close button when pane is open
Browse files Browse the repository at this point in the history
  • Loading branch information
jovanbulck committed Nov 28, 2024
1 parent 6bfcaf4 commit 5eb311e
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions src/components/viewer/PhotoSphere.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<template>
<div id="viewer" class="viewer__photosphere top-left fill-block">
<NcButton
v-if="!hideCloseButton"
id="close-photosphere-viewer"
:ariaLabel="t('memories', 'Close')"
:title="t('memories', 'Close')"
Expand All @@ -24,6 +25,7 @@ import CloseThickIcon from 'vue-material-design-icons/CloseThick.vue';
import { Viewer } from '@photo-sphere-viewer/core';
import { AutorotatePlugin } from '@photo-sphere-viewer/autorotate-plugin';
import { events } from '@photo-sphere-viewer/core';
import '@photo-sphere-viewer/core/index.css';
export default defineComponent({
Expand All @@ -45,6 +47,7 @@ export default defineComponent({
data: () => ({
viewer: null as Viewer | null,
hideCloseButton: false,
}),
async mounted() {
Expand All @@ -68,6 +71,15 @@ export default defineComponent({
],
});
// Hide the close button when the PhotoSphere panel is open
this.viewer.addEventListener('show-panel', ({ panelId: string }) => {
this.hideCloseButton = true;
});
this.viewer.addEventListener('hide-panel', ({ panelId: string }) => {
this.hideCloseButton = false;
});
// Handle keyboard
window.addEventListener('keydown', this.handleKeydown, true);
},
Expand Down Expand Up @@ -95,7 +107,6 @@ export default defineComponent({
},
close() {
this.viewer?.destroy();
window.removeEventListener('keydown', this.handleKeydown, true);
this.$emit('close');
},
Expand Down Expand Up @@ -130,8 +141,6 @@ export default defineComponent({
right: 0;
top: 0;
z-index: 9999;
//background-color: transparent;
margin-right: 10px;
}
}
</style>

0 comments on commit 5eb311e

Please sign in to comment.