Merge branch 'seadragon-fix' into 'v3'
Stop closing seadragon when going full screen Closes #718 See merge request openflexure/openflexure-microscope-server!533
This commit is contained in:
commit
84b96809ad
2 changed files with 30 additions and 3 deletions
|
|
@ -30,6 +30,8 @@ export default {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
|
emits: ["entering-fullscreen"],
|
||||||
|
|
||||||
data: function () {
|
data: function () {
|
||||||
return {
|
return {
|
||||||
osdViewer: null,
|
osdViewer: null,
|
||||||
|
|
@ -83,7 +85,8 @@ export default {
|
||||||
this.loadOpenSeaDragon(this.src);
|
this.loadOpenSeaDragon(this.src);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (this.osdViewer) {
|
// Don't destroy if viewer is in fullscreen
|
||||||
|
if (this.osdViewer && !this.osdViewer.isFullPage()) {
|
||||||
this.osdViewer.destroy();
|
this.osdViewer.destroy();
|
||||||
this.osdViewer = null;
|
this.osdViewer = null;
|
||||||
}
|
}
|
||||||
|
|
@ -110,7 +113,7 @@ export default {
|
||||||
},
|
},
|
||||||
|
|
||||||
updateFilter() {
|
updateFilter() {
|
||||||
const viewerEl = document.getElementById("openseadragon");
|
const viewerEl = this.$refs.osdContainer;
|
||||||
if (viewerEl) {
|
if (viewerEl) {
|
||||||
viewerEl.style.filter = `
|
viewerEl.style.filter = `
|
||||||
brightness(${this.brightness})
|
brightness(${this.brightness})
|
||||||
|
|
@ -121,7 +124,12 @@ export default {
|
||||||
},
|
},
|
||||||
openFullscreen() {
|
openFullscreen() {
|
||||||
if (this.osdViewer) {
|
if (this.osdViewer) {
|
||||||
this.osdViewer.setFullScreen(true);
|
// Alert the modal we are about to enter fullscreen so it can prevent closing.
|
||||||
|
this.$emit("entering-fullscreen");
|
||||||
|
// Wait a bit for DOM to resize
|
||||||
|
this.$nextTick(() => {
|
||||||
|
this.osdViewer.setFullScreen(true);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,7 @@
|
||||||
:brightness="brightness"
|
:brightness="brightness"
|
||||||
:contrast="contrast"
|
:contrast="contrast"
|
||||||
:saturation="saturation"
|
:saturation="saturation"
|
||||||
|
@entering-fullscreen="enteringFullscreen = true"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
@ -76,6 +77,9 @@ export default {
|
||||||
brightness: 1,
|
brightness: 1,
|
||||||
contrast: 1,
|
contrast: 1,
|
||||||
saturation: 1,
|
saturation: 1,
|
||||||
|
enteringFullscreen: false,
|
||||||
|
modalEl: null,
|
||||||
|
beforeHideHandler: null,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
|
|
@ -86,6 +90,21 @@ export default {
|
||||||
return null;
|
return null;
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
mounted() {
|
||||||
|
this.modalEl = this.$refs.scanModal;
|
||||||
|
this.beforeHideHandler = (event) => {
|
||||||
|
if (this.enteringFullscreen) {
|
||||||
|
event.preventDefault();
|
||||||
|
this.enteringFullscreen = false;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
this.modalEl.addEventListener("beforehide", this.beforeHideHandler);
|
||||||
|
},
|
||||||
|
beforeUnmount() {
|
||||||
|
if (this.modalEl && this.beforeHideHandler) {
|
||||||
|
this.modalEl.removeEventListener("beforehide", this.beforeHideHandler);
|
||||||
|
}
|
||||||
|
},
|
||||||
methods: {
|
methods: {
|
||||||
show() {
|
show() {
|
||||||
UIkit.modal(this.$refs.scanModal).show();
|
UIkit.modal(this.$refs.scanModal).show();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue