修复登录后通过菜单开窗可能失败的BUG和拖拽触摸屏开窗失败的BUG
This commit is contained in:
parent
2cd6651e7d
commit
98370a52c5
|
@ -165,7 +165,7 @@
|
||||||
:class="'col-' + ($store.state.landspace ? '3' : '4')"
|
:class="'col-' + ($store.state.landspace ? '3' : '4')"
|
||||||
>
|
>
|
||||||
<div>
|
<div>
|
||||||
<div class="row q-my-md" style="width: 1px; height: 1px"></div>
|
<div class="row q-my-lg" style="width: 1px; height: 1px"></div>
|
||||||
<div class="row q-my-md" style="width: 1px; height: 1px"></div>
|
<div class="row q-my-md" style="width: 1px; height: 1px"></div>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<q-space />
|
<q-space />
|
||||||
|
@ -389,16 +389,32 @@ export default defineComponent({
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onSignalSourceDrop(evt: any) {
|
onSignalSourceDrop(evt: any) {
|
||||||
emit_drop_events(evt, "signal_source");
|
try {
|
||||||
|
emit_drop_events(evt, "signal_source");
|
||||||
|
} catch (e) {
|
||||||
|
console.log(e);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
onPollingDrop(evt: any) {
|
onPollingDrop(evt: any) {
|
||||||
emit_drop_events(evt, "polling");
|
try {
|
||||||
|
emit_drop_events(evt, "polling");
|
||||||
|
} catch (e) {
|
||||||
|
console.log(e);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
onModeDrop(evt: any) {
|
onModeDrop(evt: any) {
|
||||||
emit_drop_events(evt, "mode");
|
try {
|
||||||
|
emit_drop_events(evt, "mode");
|
||||||
|
} catch (e) {
|
||||||
|
console.log(e);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
onPlanDrop(evt: any) {
|
onPlanDrop(evt: any) {
|
||||||
emit_drop_events(evt, "plan");
|
try {
|
||||||
|
emit_drop_events(evt, "plan");
|
||||||
|
} catch (e) {
|
||||||
|
console.log(e);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
volumeUp(evt: MouseEvent) {
|
volumeUp(evt: MouseEvent) {
|
||||||
evt.stopPropagation();
|
evt.stopPropagation();
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
width: wall_width + 'px',
|
width: wall_width + 'px',
|
||||||
height: wall_height + 'px',
|
height: wall_height + 'px',
|
||||||
}"
|
}"
|
||||||
class="wall_content"
|
style="border: 1px solid black"
|
||||||
>
|
>
|
||||||
<div id="windows" ref="dom_windows" style="position: absolute">
|
<div id="windows" ref="dom_windows" style="position: absolute">
|
||||||
<vue3-resize-drag
|
<vue3-resize-drag
|
||||||
|
@ -124,10 +124,6 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
.wall_content {
|
|
||||||
border: 1px solid black;
|
|
||||||
}
|
|
||||||
|
|
||||||
.wall_item {
|
.wall_item {
|
||||||
border: 1px solid gray;
|
border: 1px solid gray;
|
||||||
}
|
}
|
||||||
|
@ -146,7 +142,16 @@
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { defineComponent, Ref, ref, onMounted, computed, watch } from "vue";
|
import {
|
||||||
|
defineComponent,
|
||||||
|
Ref,
|
||||||
|
ref,
|
||||||
|
onMounted,
|
||||||
|
computed,
|
||||||
|
watch,
|
||||||
|
nextTick,
|
||||||
|
onUpdated,
|
||||||
|
} from "vue";
|
||||||
import { useQuasar } from "quasar";
|
import { useQuasar } from "quasar";
|
||||||
import { useI18n } from "vue-i18n";
|
import { useI18n } from "vue-i18n";
|
||||||
import { useStore } from "src/store";
|
import { useStore } from "src/store";
|
||||||
|
@ -198,8 +203,8 @@ export default defineComponent({
|
||||||
|
|
||||||
const file_manage_dialog: Ref<any> = ref(null);
|
const file_manage_dialog: Ref<any> = ref(null);
|
||||||
|
|
||||||
const wall_width = ref(0);
|
const wall_width = ref(1);
|
||||||
const wall_height = ref(0);
|
const wall_height = ref(1);
|
||||||
|
|
||||||
const wall_rows = computed({
|
const wall_rows = computed({
|
||||||
get: () => $store.state.wall_row,
|
get: () => $store.state.wall_row,
|
||||||
|
@ -485,6 +490,13 @@ export default defineComponent({
|
||||||
height = width * 0.56;
|
height = width * 0.56;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (height < 1) {
|
||||||
|
height = 1;
|
||||||
|
}
|
||||||
|
if (width < 1) {
|
||||||
|
width = 1;
|
||||||
|
}
|
||||||
|
|
||||||
wall_height.value = height;
|
wall_height.value = height;
|
||||||
wall_width.value = width;
|
wall_width.value = width;
|
||||||
|
|
||||||
|
@ -610,15 +622,6 @@ export default defineComponent({
|
||||||
const onDropSignalSourceOrPolliong = (evt: _IDropToWall) => {
|
const onDropSignalSourceOrPolliong = (evt: _IDropToWall) => {
|
||||||
if (!plan_running.value) {
|
if (!plan_running.value) {
|
||||||
if (evt && evt.data) {
|
if (evt && evt.data) {
|
||||||
// const x =
|
|
||||||
// evt.pos.x -
|
|
||||||
// (wall.value.parentElement?.offsetLeft ?? 0) -
|
|
||||||
// wall_content.value.offsetLeft;
|
|
||||||
// const y =
|
|
||||||
// evt.pos.y -
|
|
||||||
// (wall.value.parentElement?.offsetTop ?? 0) -
|
|
||||||
// wall_content.value.offsetTop;
|
|
||||||
|
|
||||||
let dom = document.elementFromPoint(
|
let dom = document.elementFromPoint(
|
||||||
evt.pos.x,
|
evt.pos.x,
|
||||||
evt.pos.y
|
evt.pos.y
|
||||||
|
@ -643,10 +646,12 @@ export default defineComponent({
|
||||||
if (dom.classList.contains("wall_item_flag")) {
|
if (dom.classList.contains("wall_item_flag")) {
|
||||||
// 开窗
|
// 开窗
|
||||||
// 不知道为什么有1像素的差别
|
// 不知道为什么有1像素的差别
|
||||||
const x = dom.offsetLeft / wall_content.value.clientWidth;
|
const wall_width = wall_content_client_width.value;
|
||||||
const y = dom.offsetTop / wall_content.value.clientHeight;
|
const wall_height = wall_content_client_height.value;
|
||||||
const width = dom.offsetWidth / wall_content.value.clientWidth;
|
const x = dom.offsetLeft / wall_width;
|
||||||
const height = dom.offsetHeight / wall_content.value.clientHeight;
|
const y = dom.offsetTop / wall_height;
|
||||||
|
const width = dom.offsetWidth / wall_width;
|
||||||
|
const height = dom.offsetHeight / wall_height;
|
||||||
|
|
||||||
switch (evt.type) {
|
switch (evt.type) {
|
||||||
case "polling":
|
case "polling":
|
||||||
|
@ -911,13 +916,6 @@ export default defineComponent({
|
||||||
GlobalData.getInstance().getCurrentClient()?.closeWindow(window_id);
|
GlobalData.getInstance().getCurrentClient()?.closeWindow(window_id);
|
||||||
},
|
},
|
||||||
closeAllWindows() {
|
closeAllWindows() {
|
||||||
// for (const window of $store.state.windows) {
|
|
||||||
// if (window) {
|
|
||||||
// GlobalData.getInstance()
|
|
||||||
// .getCurrentClient()
|
|
||||||
// ?.closeWindow(window.window_id);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
GlobalData.getInstance().getCurrentClient()?.closeWindow(-1);
|
GlobalData.getInstance().getCurrentClient()?.closeWindow(-1);
|
||||||
},
|
},
|
||||||
async repliceWindow(window_id: number) {
|
async repliceWindow(window_id: number) {
|
||||||
|
@ -1005,10 +1003,44 @@ export default defineComponent({
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 异步请求后获取不到 dom 节点数据,所以在异步请求之前先计算出目标窗口的x,y,w,h
|
||||||
|
const target_rect = {
|
||||||
|
x: 0,
|
||||||
|
y: 0,
|
||||||
|
w: 0,
|
||||||
|
h: 0,
|
||||||
|
};
|
||||||
|
|
||||||
|
{
|
||||||
|
const cell_width = 1.0 / $store.state.wall_col;
|
||||||
|
const cell_height = 1.0 / $store.state.wall_row;
|
||||||
|
|
||||||
|
const col = Math.floor(
|
||||||
|
(last_context_menu_pos_x.value -
|
||||||
|
(wall.value.parentElement?.offsetLeft ?? 0) -
|
||||||
|
wall_content.value.offsetLeft) /
|
||||||
|
wall_content.value.offsetWidth /
|
||||||
|
cell_width
|
||||||
|
);
|
||||||
|
const row = Math.floor(
|
||||||
|
(last_context_menu_pos_y.value -
|
||||||
|
(wall.value.parentElement?.offsetTop ?? 0) -
|
||||||
|
wall_content.value.offsetTop) /
|
||||||
|
wall_content.value.offsetHeight /
|
||||||
|
cell_height
|
||||||
|
);
|
||||||
|
|
||||||
|
target_rect.x = col * cell_width;
|
||||||
|
target_rect.y = row * cell_height;
|
||||||
|
target_rect.w = cell_width;
|
||||||
|
target_rect.h = cell_height;
|
||||||
|
}
|
||||||
|
|
||||||
const obj = await file_manage_dialog.value.showDialogAsync(
|
const obj = await file_manage_dialog.value.showDialogAsync(
|
||||||
"select",
|
"select",
|
||||||
".mp4;.avi;.ts;.jpg;.png;"
|
".mp4;.avi;.ts;.jpg;.png;"
|
||||||
);
|
);
|
||||||
|
|
||||||
if (obj) {
|
if (obj) {
|
||||||
interface __I {
|
interface __I {
|
||||||
path: string;
|
path: string;
|
||||||
|
@ -1036,39 +1068,23 @@ export default defineComponent({
|
||||||
const response = await GlobalData.getInstance()
|
const response = await GlobalData.getInstance()
|
||||||
.getCurrentClient()
|
.getCurrentClient()
|
||||||
?.addSignalSource(entity);
|
?.addSignalSource(entity);
|
||||||
|
|
||||||
if (response && response.success) {
|
if (response && response.success) {
|
||||||
const cell_width = 1.0 / $store.state.wall_col;
|
if (
|
||||||
const cell_height = 1.0 / $store.state.wall_row;
|
target_rect &&
|
||||||
console.log(last_context_menu_pos_x);
|
!isNaN(target_rect.x) &&
|
||||||
console.log(last_context_menu_pos_y);
|
!isNaN(target_rect.y) &&
|
||||||
const col = Math.floor(
|
!isNaN(target_rect.w) &&
|
||||||
(last_context_menu_pos_x.value -
|
!isNaN(target_rect.h)
|
||||||
(wall.value.parentElement?.offsetLeft ?? 0) -
|
) {
|
||||||
wall_content.value.offsetLeft) /
|
|
||||||
wall_content.value.offsetWidth /
|
|
||||||
cell_width
|
|
||||||
);
|
|
||||||
const row = Math.floor(
|
|
||||||
(last_context_menu_pos_y.value -
|
|
||||||
(wall.value.parentElement?.offsetTop ?? 0) -
|
|
||||||
wall_content.value.offsetTop) /
|
|
||||||
wall_content.value.offsetHeight /
|
|
||||||
cell_height
|
|
||||||
);
|
|
||||||
|
|
||||||
const x = col * cell_width;
|
|
||||||
const y = row * cell_height;
|
|
||||||
|
|
||||||
if (!isNaN(x) && !isNaN(y)) {
|
|
||||||
const open_window_request =
|
const open_window_request =
|
||||||
new Protocol.OpenWindowRequestEntity(
|
new Protocol.OpenWindowRequestEntity(
|
||||||
response.uuid,
|
response.uuid,
|
||||||
x,
|
target_rect.x,
|
||||||
y,
|
target_rect.y,
|
||||||
cell_width,
|
target_rect.w,
|
||||||
cell_height
|
target_rect.h
|
||||||
);
|
);
|
||||||
|
|
||||||
GlobalData.getInstance()
|
GlobalData.getInstance()
|
||||||
.getCurrentClient()
|
.getCurrentClient()
|
||||||
?.openWindow(open_window_request);
|
?.openWindow(open_window_request);
|
||||||
|
|
|
@ -103,7 +103,9 @@ const initialize_sortablejs = () => {
|
||||||
// 模拟点击,修复拖拽后必须点一下才能切换tab的BUG
|
// 模拟点击,修复拖拽后必须点一下才能切换tab的BUG
|
||||||
document.body.click();
|
document.body.click();
|
||||||
}, 0);
|
}, 0);
|
||||||
} catch {}
|
} catch (e) {
|
||||||
|
console.log(e);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -198,7 +200,7 @@ const draggableComponent = defineComponent({
|
||||||
|
|
||||||
sortableOptions.fallbackOnBody = true;
|
sortableOptions.fallbackOnBody = true;
|
||||||
this._sortable = new Sortable(targetDomElement, sortableOptions);
|
this._sortable = new Sortable(targetDomElement, sortableOptions);
|
||||||
console.log();
|
|
||||||
if (this._sortable["afx_event"]) {
|
if (this._sortable["afx_event"]) {
|
||||||
this._sortable["afx_event"].vue_self = this;
|
this._sortable["afx_event"].vue_self = this;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue