Close window when opening zone edotir

This commit is contained in:
Tamius Han 2024-12-26 17:54:05 +01:00
parent fab6fb0f5b
commit 35ca030dfb
3 changed files with 24 additions and 11 deletions

View File

@ -1,12 +1,12 @@
<template> <template>
<div <div
class="context-spawn uw-ui-trigger" class="context-spawn debug-1"
style="z-index: 1000" style="z-index: 1000;"
v-if="!triggerZoneEditorVisible"
> >
<div <div
class="spawn-container uw-trigger" class="spawn-container uw-ui-trigger debug-2"
:style="triggerZoneStyles" :style="triggerZoneStyles"
@mouseenter="(ev) => setTriggerZoneActive(true, ev)"
> >
&nbsp; &nbsp;
</div> </div>
@ -167,8 +167,9 @@
</div> </div>
<div <div
class="context-spawn uw-ui-trigger" v-if="triggerZoneEditorVisible"
style="z-index: 1000;" class="context-spawn"
style="z-index: 1000; border: 2px dashed red"
> >
<TriggerZoneEditor <TriggerZoneEditor
class="uw-clickable" class="uw-clickable"
@ -228,6 +229,7 @@ export default {
uwWindowFadeOut: false, uwWindowFadeOut: false,
uwWindowCloseTimeout: undefined, uwWindowCloseTimeout: undefined,
uwWindowVisible: false, uwWindowVisible: false,
triggerZoneEditorVisible: false,
// component properties // component properties
settings: {}, settings: {},
@ -387,6 +389,17 @@ export default {
} }
}); });
this.eventBus.subscribe(
'start-trigger-zone-edit',
{
function: () => {
console.log('Showing trigger zone editor!');
this.triggerZoneEditorVisible = true;
this.uwWindowVisible = false;
}
}
);
this.sendToParentLowLevel('uwui-get-role', null); this.sendToParentLowLevel('uwui-get-role', null);
this.sendToParentLowLevel('uwui-get-theme', null); this.sendToParentLowLevel('uwui-get-theme', null);

View File

@ -55,7 +55,7 @@
<div class="field"> <div class="field">
<div class="label">Edit trigger zone:</div> <div class="label">Edit trigger zone:</div>
<button>Edit</button> <button @click="startTriggerZoneEdit()">Edit</button>
</div> </div>
<div v-if="settings.active.ui.inPlayer.activation === 'trigger-zone'"> <div v-if="settings.active.ui.inPlayer.activation === 'trigger-zone'">
@ -195,8 +195,9 @@ export default {
this.settings.active.ui.inPlayer.triggerZoneDimensions[key] = size; this.settings.active.ui.inPlayer.triggerZoneDimensions[key] = size;
this.settings.saveWithoutReload(); this.settings.saveWithoutReload();
}, },
startTriggerZoneEdit() {
this.eventBus.send('start-trigger-zone-edit');
},
async openOptionsPage() { async openOptionsPage() {
BrowserDetect.runtime.openOptionsPage(); BrowserDetect.runtime.openOptionsPage();
}, },

View File

@ -39,7 +39,6 @@ export default {
], ],
watch: { watch: {
playerDimensions(newVal, oldVal) { playerDimensions(newVal, oldVal) {
console.log('triggerzone -- dimensions changed!', this.playerDimensions, newVal, oldVal);
this.updateTriggerZones(); this.updateTriggerZones();
} }
}, },
@ -54,7 +53,7 @@ export default {
created() { created() {
document.addEventListener("mouseup", this.handleMouseUp); document.addEventListener("mouseup", this.handleMouseUp);
document.addEventListener("mousemove", this.handleMouseMove); document.addEventListener("mousemove", this.handleMouseMove);
updateTriggerZones(); this.updateTriggerZones();
}, },
methods: { methods: {
updateTriggerZones() { updateTriggerZones() {