Prevent scan modal closing on fullscreen close, and pin filter to fixed reference
This commit is contained in:
parent
11d8c6d604
commit
1090e693d4
2 changed files with 19 additions and 5 deletions
|
|
@ -30,6 +30,8 @@ export default {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
|
emits: ["entering-fullscreen"],
|
||||||
|
|
||||||
data: function () {
|
data: function () {
|
||||||
return {
|
return {
|
||||||
osdViewer: null,
|
osdViewer: null,
|
||||||
|
|
@ -111,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})
|
||||||
|
|
@ -122,12 +124,12 @@ export default {
|
||||||
},
|
},
|
||||||
openFullscreen() {
|
openFullscreen() {
|
||||||
if (this.osdViewer) {
|
if (this.osdViewer) {
|
||||||
|
// 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
|
// Wait a bit for DOM to resize
|
||||||
setTimeout(() => {
|
this.$nextTick(() => {
|
||||||
this.osdViewer.setFullScreen(true);
|
this.osdViewer.setFullScreen(true);
|
||||||
this.updateFilter();
|
});
|
||||||
this.osdViewer.forceRedraw();
|
|
||||||
}, 500);
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -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,7 @@ export default {
|
||||||
brightness: 1,
|
brightness: 1,
|
||||||
contrast: 1,
|
contrast: 1,
|
||||||
saturation: 1,
|
saturation: 1,
|
||||||
|
enteringFullscreen: false,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
|
|
@ -86,6 +88,16 @@ export default {
|
||||||
return null;
|
return null;
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
mounted() {
|
||||||
|
const modalEl = this.$refs.scanModal;
|
||||||
|
|
||||||
|
modalEl.addEventListener("beforehide", (event) => {
|
||||||
|
if (this.enteringFullscreen) {
|
||||||
|
event.preventDefault();
|
||||||
|
this.enteringFullscreen = false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
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