2021-08-05 14:23:45 +08:00
|
|
|
<template>
|
|
|
|
<div
|
|
|
|
ref="wall"
|
2022-05-28 16:22:45 +08:00
|
|
|
class="fit items-center justify-evenly"
|
|
|
|
:class="$store.state.power_state ? 'wall' : ''"
|
2021-08-05 14:23:45 +08:00
|
|
|
@dragenter="onDragEnter"
|
|
|
|
@dragleave="onDragLeave"
|
|
|
|
@dragover="onDragOver"
|
|
|
|
@drop="onDrop"
|
2022-08-04 17:10:52 +08:00
|
|
|
style="background-color: #bce0f0; margin-bottom: 10%"
|
2021-08-05 14:23:45 +08:00
|
|
|
>
|
2022-05-28 16:22:45 +08:00
|
|
|
<div
|
|
|
|
id="windows"
|
|
|
|
style="position: absolute"
|
2022-07-13 20:01:16 +08:00
|
|
|
v-if="$store.state.power_state && show_windows_flag"
|
2022-05-28 16:22:45 +08:00
|
|
|
>
|
2022-02-12 10:16:08 +08:00
|
|
|
<vue3-resize-drag
|
2022-02-15 19:08:08 +08:00
|
|
|
:w="item.width * ($refs.wall?.clientWidth ?? 0)"
|
|
|
|
:h="item.height * ($refs.wall?.clientHeight ?? 0)"
|
2022-02-12 10:16:08 +08:00
|
|
|
:x="
|
2022-02-15 19:08:08 +08:00
|
|
|
($refs.wall?.parentElement?.offsetLeft ?? 0) +
|
|
|
|
($refs.wall?.offsetLeft ?? 0) +
|
|
|
|
item.x * ($refs.wall?.clientWidth ?? 0)
|
2022-02-12 10:16:08 +08:00
|
|
|
"
|
|
|
|
:y="
|
2022-02-15 19:08:08 +08:00
|
|
|
($refs.wall?.parentElement?.offsetTop ?? 0) +
|
|
|
|
($refs.wall?.offsetTop ?? 0) +
|
|
|
|
item.y * ($refs.wall?.clientHeight ?? 0)
|
2022-02-12 10:16:08 +08:00
|
|
|
"
|
|
|
|
:zIndex="
|
|
|
|
$store.state.windows_sort.findIndex((element) => element == item.uuid)
|
|
|
|
"
|
|
|
|
:isActive="item.uuid == $store.state.selected_window"
|
2022-02-12 10:38:40 +08:00
|
|
|
:resizeIconSize="14"
|
2022-02-12 10:16:08 +08:00
|
|
|
:isGuide="true"
|
2022-04-18 17:08:40 +08:00
|
|
|
v-for="(item, index) of windows"
|
2022-02-10 15:51:48 +08:00
|
|
|
:key="index"
|
2022-02-12 10:16:08 +08:00
|
|
|
@resizeEndHandler="resizeWindow(item.window_id, $event)"
|
|
|
|
@moveEndHandler="moveWindow(item.window_id, $event)"
|
2022-02-12 10:38:40 +08:00
|
|
|
style="position: fixed"
|
2022-02-10 15:51:48 +08:00
|
|
|
>
|
2022-02-12 10:16:08 +08:00
|
|
|
<window
|
|
|
|
@close_this_window="closeWindow"
|
|
|
|
@close_other_windows="closeOtherWindows"
|
|
|
|
@close_all_windows="closeAllWindows"
|
2022-03-03 17:52:08 +08:00
|
|
|
@replace_this_window="repliceWindow"
|
2022-02-12 10:16:08 +08:00
|
|
|
@top_window="topWindow"
|
|
|
|
@lower_window="lowerWindow"
|
|
|
|
@dblclick="(evt) => windowDBClick(item.window_id)"
|
|
|
|
@edit_volume="edit_volume"
|
|
|
|
@mute_unmute="mute_unmute"
|
|
|
|
@start_polling="start_polling"
|
|
|
|
@stop_polling="stop_polling"
|
|
|
|
@polling_setting="polling_setting"
|
2022-04-25 16:41:42 +08:00
|
|
|
@edit_rect="editRect"
|
2022-02-12 10:16:08 +08:00
|
|
|
:ref="'window_' + item.window_id"
|
|
|
|
:id="'window_' + item.window_id"
|
|
|
|
:uuid="item.uuid"
|
|
|
|
:disable="plan_running"
|
|
|
|
:mouse_area_flag="area_open_window_flag"
|
|
|
|
:signal_source_table_uuid="item.signal_source_table_uuid"
|
|
|
|
:window="item"
|
2022-02-12 12:23:36 +08:00
|
|
|
:plan_running="plan_running"
|
2022-04-15 15:39:10 +08:00
|
|
|
:show_pollong_setting_context_menu="true"
|
2022-02-12 12:23:36 +08:00
|
|
|
class="window fit"
|
2022-02-12 10:16:08 +08:00
|
|
|
>
|
|
|
|
</window>
|
|
|
|
</vue3-resize-drag>
|
2021-08-05 17:26:27 +08:00
|
|
|
</div>
|
2022-05-28 16:22:45 +08:00
|
|
|
<div
|
|
|
|
ref="wall_grids"
|
|
|
|
@click="onWallGridsClick"
|
|
|
|
v-if="$store.state.power_state"
|
|
|
|
>
|
2021-08-05 17:26:27 +08:00
|
|
|
<div
|
2022-04-18 17:08:40 +08:00
|
|
|
v-for="row of wall_rows"
|
2021-08-05 17:26:27 +08:00
|
|
|
:key="row"
|
|
|
|
class="row"
|
2021-08-05 14:23:45 +08:00
|
|
|
:style="{
|
|
|
|
height: item_height + 'px',
|
|
|
|
}"
|
|
|
|
>
|
2021-08-05 17:26:27 +08:00
|
|
|
<div
|
2022-03-10 16:23:26 +08:00
|
|
|
:ref="'item' + (row - 1) * wall_cols + col"
|
2022-04-18 17:08:40 +08:00
|
|
|
v-for="col of wall_cols"
|
2021-08-05 17:26:27 +08:00
|
|
|
:key="col"
|
2021-08-09 10:59:16 +08:00
|
|
|
class="col wall_item wall_item_flag"
|
2021-08-05 17:26:27 +08:00
|
|
|
:style="{
|
|
|
|
width: item_witdh + 'px',
|
|
|
|
height: item_height + 'px',
|
|
|
|
}"
|
2022-04-25 16:41:42 +08:00
|
|
|
:a_row="row"
|
|
|
|
:a_col="col"
|
2021-08-05 17:26:27 +08:00
|
|
|
>
|
2022-03-03 17:52:08 +08:00
|
|
|
<q-popup-proxy
|
|
|
|
context-menu
|
|
|
|
@show="
|
|
|
|
{
|
|
|
|
last_context_menu_pos_x = $event.layerX;
|
|
|
|
last_context_menu_pos_y = $event.layerY;
|
|
|
|
}
|
|
|
|
"
|
|
|
|
>
|
2021-08-05 17:26:27 +08:00
|
|
|
<q-list>
|
2022-03-03 17:52:08 +08:00
|
|
|
<q-item
|
2022-05-25 18:21:13 +08:00
|
|
|
:disable="plan_running || !$store.state.power_state"
|
2022-03-03 17:52:08 +08:00
|
|
|
clickable
|
|
|
|
v-close-popup
|
|
|
|
@click="openWindowByLocalFile($event)"
|
|
|
|
>
|
|
|
|
<q-item-section avatar>
|
|
|
|
<q-icon name="open_in_browser" />
|
|
|
|
</q-item-section>
|
|
|
|
<q-item-section> {{ $t("open window") }} </q-item-section>
|
|
|
|
</q-item>
|
2021-12-20 10:34:56 +08:00
|
|
|
<q-item
|
2022-05-25 18:21:13 +08:00
|
|
|
:disable="plan_running || !$store.state.power_state"
|
2021-12-20 10:34:56 +08:00
|
|
|
clickable
|
|
|
|
v-close-popup
|
|
|
|
@click="closeAllWindows"
|
|
|
|
>
|
2021-08-05 17:26:27 +08:00
|
|
|
<q-item-section avatar>
|
|
|
|
<q-icon name="close" color="red" />
|
|
|
|
</q-item-section>
|
2022-07-13 15:50:35 +08:00
|
|
|
<q-item-section> {{ $t("close all windows") }} </q-item-section>
|
2021-08-05 17:26:27 +08:00
|
|
|
</q-item>
|
|
|
|
</q-list>
|
|
|
|
</q-popup-proxy>
|
|
|
|
</div>
|
2021-08-05 14:23:45 +08:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
2022-01-25 11:34:07 +08:00
|
|
|
<div
|
|
|
|
class="mouse_area_mask"
|
|
|
|
v-show="area_open_window_flag"
|
|
|
|
style="position: fixed; pointer-events: none; z-index: 999"
|
|
|
|
:style="{
|
|
|
|
left:
|
|
|
|
Math.min(area_open_window_rect.start_x, area_open_window_rect.end_x) +
|
|
|
|
'px',
|
|
|
|
top:
|
|
|
|
Math.min(area_open_window_rect.start_y, area_open_window_rect.end_y) +
|
|
|
|
'px',
|
|
|
|
width:
|
|
|
|
Math.abs(area_open_window_rect.end_x - area_open_window_rect.start_x) +
|
|
|
|
'px',
|
|
|
|
height:
|
|
|
|
Math.abs(area_open_window_rect.end_y - area_open_window_rect.start_y) +
|
|
|
|
'px',
|
|
|
|
}"
|
|
|
|
></div>
|
2021-12-22 19:44:02 +08:00
|
|
|
<edit-volume-dialog ref="edit_volume_dialog" />
|
2022-01-19 19:28:03 +08:00
|
|
|
<polling-setting-dialog ref="polling_setting_dialog" />
|
2022-03-03 17:52:08 +08:00
|
|
|
<file-manage-dialog ref="file_manage_dialog" />
|
2022-04-25 16:41:42 +08:00
|
|
|
<window-rect-edit-dialog ref="window_rect_edit_dialog" />
|
2021-08-05 14:23:45 +08:00
|
|
|
</template>
|
|
|
|
|
|
|
|
<style scoped>
|
|
|
|
.wall {
|
|
|
|
border: 1px solid black;
|
|
|
|
}
|
|
|
|
|
|
|
|
.wall_item {
|
2021-08-06 10:54:03 +08:00
|
|
|
border: 1px solid gray;
|
2021-08-05 14:23:45 +08:00
|
|
|
}
|
2021-08-05 17:26:27 +08:00
|
|
|
|
|
|
|
.window {
|
|
|
|
position: absolute;
|
|
|
|
}
|
2021-08-09 10:59:16 +08:00
|
|
|
|
|
|
|
.wall_item_flag {
|
|
|
|
}
|
2022-01-25 11:34:07 +08:00
|
|
|
|
|
|
|
.mouse_area_mask {
|
|
|
|
background: #aacceec2;
|
|
|
|
border: 1px solid #0069bee7;
|
|
|
|
}
|
2021-08-05 14:23:45 +08:00
|
|
|
</style>
|
|
|
|
|
|
|
|
<script lang="ts">
|
|
|
|
import GlobalData from "src/common/GlobalData";
|
2022-07-13 20:01:16 +08:00
|
|
|
import { defineComponent, ref, Ref, computed, onMounted, nextTick } from "vue";
|
2021-08-10 11:22:39 +08:00
|
|
|
const elementResizeDetectorMaker = require("element-resize-detector");
|
2021-08-05 14:23:45 +08:00
|
|
|
import { Protocol } from "src/entities/WSProtocol";
|
2021-08-06 10:54:03 +08:00
|
|
|
import Window from "src/components/Window.vue";
|
2022-04-25 16:41:42 +08:00
|
|
|
import WindowRectEditDialog from "src/components/WindowRectEditDialog.vue";
|
2021-08-05 14:23:45 +08:00
|
|
|
|
|
|
|
import { useI18n } from "vue-i18n";
|
2022-07-25 16:31:23 +08:00
|
|
|
import { NullSignalSource, useStore } from "src/store";
|
2021-08-06 10:54:03 +08:00
|
|
|
import EventBus, { EventNamesDefine } from "src/common/EventBus";
|
2021-12-23 09:28:21 +08:00
|
|
|
import { WindowOpenNotifyEntity } from "src/entities/MultimediaWindowEntity";
|
2021-08-09 10:59:16 +08:00
|
|
|
import WindowOtherStateChangeNotifyEntity from "src/entities/WindowOtherStateChangeNotifyEntity";
|
2021-08-13 16:50:03 +08:00
|
|
|
import { useQuasar } from "quasar";
|
2021-08-25 17:30:02 +08:00
|
|
|
import { NotifyMessage } from "src/common/ClientConnection";
|
2021-08-05 14:23:45 +08:00
|
|
|
|
2021-12-22 19:44:02 +08:00
|
|
|
import EditVolumeDialog from "src/components/EditVolumeDialog.vue";
|
2022-01-19 19:28:03 +08:00
|
|
|
import PollingSettingDialog from "src/components/PollingSettingDialog.vue";
|
2021-12-22 19:44:02 +08:00
|
|
|
|
2022-02-12 10:16:08 +08:00
|
|
|
import vue3ResizeDrag from "../third_lib/vue3-resize-drag/components/vue3-resize-drag/index.vue";
|
|
|
|
|
2022-03-03 17:52:08 +08:00
|
|
|
import FileManageDialog from "src/components/FileManageDialog.vue";
|
|
|
|
import FileEntity from "src/entities/FileEntity";
|
|
|
|
import { SignalSourceEntity } from "src/entities/SignalSourceEntity";
|
2022-06-20 15:45:31 +08:00
|
|
|
import FileSuffixHelper from "src/common/FileSuffixHelper";
|
2022-08-02 19:22:32 +08:00
|
|
|
import { SpecialVideoHelper } from "src/common/SpecialVideoHelper";
|
2022-03-03 17:52:08 +08:00
|
|
|
|
2022-01-25 11:34:07 +08:00
|
|
|
class Rect {
|
|
|
|
start_x = 0;
|
|
|
|
start_y = 0;
|
|
|
|
end_x = 0;
|
|
|
|
end_y = 0;
|
|
|
|
|
|
|
|
reset() {
|
|
|
|
this.start_x = 0;
|
|
|
|
this.start_y = 0;
|
|
|
|
this.end_x = 0;
|
|
|
|
this.end_y = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-08-05 14:23:45 +08:00
|
|
|
export default defineComponent({
|
|
|
|
name: "PageWall",
|
|
|
|
|
2022-02-12 10:16:08 +08:00
|
|
|
components: {
|
|
|
|
vue3ResizeDrag,
|
|
|
|
Window,
|
|
|
|
EditVolumeDialog,
|
|
|
|
PollingSettingDialog,
|
2022-03-03 17:52:08 +08:00
|
|
|
FileManageDialog,
|
2022-04-25 16:41:42 +08:00
|
|
|
WindowRectEditDialog,
|
2022-02-12 10:16:08 +08:00
|
|
|
},
|
2021-08-05 14:23:45 +08:00
|
|
|
setup() {
|
2021-08-13 16:50:03 +08:00
|
|
|
const $q = useQuasar();
|
2021-08-05 14:23:45 +08:00
|
|
|
const $store = useStore();
|
|
|
|
const $t = useI18n();
|
|
|
|
|
2021-12-22 19:44:02 +08:00
|
|
|
const edit_volume_dialog: Ref<any> = ref(null);
|
2022-01-19 19:28:03 +08:00
|
|
|
const polling_setting_dialog: Ref<any> = ref(null);
|
2022-03-03 17:52:08 +08:00
|
|
|
const file_manage_dialog: Ref<any> = ref(null);
|
2022-04-25 16:41:42 +08:00
|
|
|
const window_rect_edit_dialog: Ref<any> = ref(null);
|
2022-03-03 17:52:08 +08:00
|
|
|
|
2022-07-13 20:01:16 +08:00
|
|
|
const show_windows_flag = ref(true); // 用于刷新 window 坐标
|
|
|
|
const refresh_windows_pos = () => {
|
|
|
|
// 浏览器窗口大小调整时, 重新显示隐藏虚拟窗口来刷新虚拟窗口坐标
|
|
|
|
show_windows_flag.value = false;
|
|
|
|
setTimeout(() => {
|
|
|
|
nextTick(() => {
|
|
|
|
show_windows_flag.value = true;
|
|
|
|
});
|
|
|
|
}, 100);
|
|
|
|
};
|
|
|
|
|
|
|
|
EventBus.getInstance().on(
|
|
|
|
EventNamesDefine.WindowResize,
|
|
|
|
refresh_windows_pos
|
|
|
|
);
|
|
|
|
|
2022-03-03 17:52:08 +08:00
|
|
|
const last_context_menu_pos_x = ref(0);
|
|
|
|
const last_context_menu_pos_y = ref(0);
|
2021-12-22 19:44:02 +08:00
|
|
|
|
2022-02-12 12:23:36 +08:00
|
|
|
const plan_running = computed(
|
|
|
|
() => $store.state.current_running_plan.trim() != ""
|
|
|
|
);
|
2021-12-20 10:34:56 +08:00
|
|
|
|
2021-08-05 17:26:27 +08:00
|
|
|
const windows = computed({
|
|
|
|
get: () => $store.state.windows,
|
|
|
|
set: (val) => $store.commit("setWindows", val),
|
|
|
|
});
|
|
|
|
|
2021-08-05 14:23:45 +08:00
|
|
|
const wall_rows = computed({
|
|
|
|
get: () => $store.state.wall_row,
|
|
|
|
set: (val) => $store.commit("setWallRow", val),
|
|
|
|
});
|
|
|
|
|
|
|
|
const wall_cols = computed({
|
|
|
|
get: () => $store.state.wall_col,
|
|
|
|
set: (val) => $store.commit("setWallCol", val),
|
|
|
|
});
|
|
|
|
|
|
|
|
const wall: Ref<HTMLElement | null> = ref(null);
|
|
|
|
|
2022-01-25 11:34:07 +08:00
|
|
|
const area_open_window_flag = ref(false);
|
|
|
|
const area_open_window_rect = ref(new Rect());
|
|
|
|
|
2021-08-09 15:05:14 +08:00
|
|
|
let item_witdh = ref(0);
|
|
|
|
const item_height = ref(0);
|
2021-08-05 14:23:45 +08:00
|
|
|
|
2021-08-09 15:05:14 +08:00
|
|
|
const calcWallItemWH = () => {
|
|
|
|
item_witdh.value =
|
|
|
|
wall?.value?.parentElement?.offsetWidth ?? 0 / wall_cols.value;
|
|
|
|
if (wall.value && wall.value.parentElement) {
|
2022-08-02 16:00:19 +08:00
|
|
|
if ($store.state.isSpecialVideo()) {
|
2022-08-02 19:22:32 +08:00
|
|
|
const screen_info = SpecialVideoHelper.getScreenInfo(
|
|
|
|
wall_cols.value,
|
|
|
|
wall_rows.value
|
2022-08-02 16:00:19 +08:00
|
|
|
);
|
2022-08-02 19:22:32 +08:00
|
|
|
|
|
|
|
const wv_scaler = screen_info.unit_width / screen_info.unit_height;
|
2022-08-02 16:00:19 +08:00
|
|
|
item_height.value =
|
2022-08-02 19:22:32 +08:00
|
|
|
wall.value.parentElement.offsetWidth /
|
|
|
|
wv_scaler /
|
|
|
|
screen_info.desktop_col;
|
2022-08-10 11:14:30 +08:00
|
|
|
|
|
|
|
if (screen_info.screen_rows > screen_info.screen_cols) {
|
|
|
|
item_height.value = item_height.value * 0.7;
|
|
|
|
}
|
2022-08-02 16:00:19 +08:00
|
|
|
} else {
|
|
|
|
const wv_scaler =
|
|
|
|
/*$store.state.device_screen_width / $store.state.device_screen_height*/ 1920 /
|
|
|
|
1080;
|
|
|
|
item_height.value =
|
|
|
|
wall.value.parentElement.offsetWidth / wv_scaler / wall_rows.value;
|
|
|
|
}
|
2022-08-04 17:10:52 +08:00
|
|
|
if (wall_rows.value > wall_cols.value) {
|
|
|
|
item_height.value *= 0.85;
|
|
|
|
}
|
2021-08-09 15:05:14 +08:00
|
|
|
} else {
|
|
|
|
item_height.value = 0;
|
|
|
|
}
|
2022-02-09 20:12:04 +08:00
|
|
|
|
|
|
|
item_witdh.value =
|
|
|
|
Math.ceil(item_witdh.value + wall_cols.value) & ~wall_cols.value;
|
|
|
|
item_height.value =
|
|
|
|
Math.ceil(item_height.value + wall_rows.value) & ~wall_rows.value;
|
2021-08-09 15:05:14 +08:00
|
|
|
};
|
|
|
|
|
2022-01-25 11:34:07 +08:00
|
|
|
const wallMouseDown = (evt: MouseEvent) => {
|
2022-01-25 19:41:28 +08:00
|
|
|
if (plan_running.value) {
|
|
|
|
return;
|
|
|
|
}
|
2022-03-11 16:46:46 +08:00
|
|
|
if ((evt.ctrlKey || evt.shiftKey || evt.altKey) && wall.value) {
|
2022-01-25 11:34:07 +08:00
|
|
|
let left =
|
|
|
|
wall.value.offsetLeft + (wall.value.parentElement?.offsetLeft ?? 0);
|
|
|
|
let top =
|
|
|
|
wall.value.offsetTop + (wall.value.parentElement?.offsetTop ?? 0);
|
|
|
|
|
|
|
|
if (
|
|
|
|
left <= evt.clientX &&
|
|
|
|
top <= evt.clientY &&
|
|
|
|
left + wall.value.offsetWidth >= evt.clientX &&
|
|
|
|
top + wall.value.offsetHeight >= evt.clientY
|
|
|
|
) {
|
|
|
|
area_open_window_rect.value.start_x = evt.clientX;
|
|
|
|
area_open_window_rect.value.start_y = evt.clientY;
|
|
|
|
area_open_window_rect.value.end_x = evt.clientX;
|
|
|
|
area_open_window_rect.value.end_y = evt.clientY;
|
|
|
|
area_open_window_flag.value = true;
|
|
|
|
evt.stopPropagation();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
const wallMouseUp = (evt: MouseEvent) => {
|
|
|
|
if (area_open_window_flag.value && wall.value) {
|
|
|
|
evt.stopPropagation();
|
2022-02-10 09:51:59 +08:00
|
|
|
// 大小为0 不开窗
|
|
|
|
if (
|
|
|
|
area_open_window_rect.value.start_x !=
|
|
|
|
area_open_window_rect.value.end_x &&
|
|
|
|
area_open_window_rect.value.start_y !=
|
2022-01-25 11:34:07 +08:00
|
|
|
area_open_window_rect.value.end_y
|
2022-02-10 09:51:59 +08:00
|
|
|
) {
|
|
|
|
// 开窗
|
|
|
|
let left =
|
|
|
|
wall.value.offsetLeft + (wall.value.parentElement?.offsetLeft ?? 0);
|
|
|
|
let top =
|
|
|
|
wall.value.offsetTop + (wall.value.parentElement?.offsetTop ?? 0);
|
|
|
|
let start_x =
|
|
|
|
Math.min(
|
|
|
|
area_open_window_rect.value.start_x,
|
|
|
|
area_open_window_rect.value.end_x
|
|
|
|
) - left;
|
|
|
|
let start_y =
|
|
|
|
Math.min(
|
|
|
|
area_open_window_rect.value.start_y,
|
|
|
|
area_open_window_rect.value.end_y
|
|
|
|
) - top;
|
|
|
|
let end_x = Math.abs(
|
|
|
|
area_open_window_rect.value.end_x -
|
|
|
|
area_open_window_rect.value.start_x
|
2022-01-25 11:34:07 +08:00
|
|
|
);
|
2022-02-10 09:51:59 +08:00
|
|
|
let end_y = Math.abs(
|
|
|
|
area_open_window_rect.value.end_y -
|
|
|
|
area_open_window_rect.value.start_y
|
|
|
|
);
|
|
|
|
|
2022-07-25 16:31:23 +08:00
|
|
|
if ($store.state.current_left_tab == "signal_source") {
|
|
|
|
if ($store.state.selected_signal_source != NullSignalSource) {
|
|
|
|
GlobalData.getInstance()
|
|
|
|
.getCurrentClient()
|
|
|
|
?.openWindow(
|
|
|
|
new Protocol.OpenWindowRequestEntity(
|
|
|
|
$store.state.selected_signal_source,
|
|
|
|
start_x / wall.value.offsetWidth,
|
|
|
|
start_y / wall.value.offsetHeight,
|
|
|
|
end_x / wall.value.offsetWidth,
|
|
|
|
end_y / wall.value.offsetHeight
|
|
|
|
)
|
|
|
|
);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
if ($store.state.selected_polling != NullSignalSource) {
|
|
|
|
GlobalData.getInstance()
|
|
|
|
.getCurrentClient()
|
|
|
|
?.openPolling(
|
|
|
|
new Protocol.OpenPollingRequestEntity(
|
|
|
|
$store.state.selected_polling,
|
|
|
|
start_x / wall.value.offsetWidth,
|
|
|
|
start_y / wall.value.offsetHeight,
|
|
|
|
end_x / wall.value.offsetWidth,
|
|
|
|
end_y / wall.value.offsetHeight
|
|
|
|
)
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
2022-02-10 09:51:59 +08:00
|
|
|
}
|
2022-01-25 11:34:07 +08:00
|
|
|
}
|
|
|
|
area_open_window_flag.value = false;
|
|
|
|
area_open_window_rect.value.reset();
|
|
|
|
};
|
|
|
|
|
|
|
|
const wallMouseMove = (evt: MouseEvent) => {
|
|
|
|
if (area_open_window_flag.value) {
|
|
|
|
evt.stopPropagation();
|
|
|
|
if (wall.value) {
|
|
|
|
let left =
|
|
|
|
wall.value.offsetLeft + (wall.value.parentElement?.offsetLeft ?? 0);
|
|
|
|
let top =
|
|
|
|
wall.value.offsetTop + (wall.value.parentElement?.offsetTop ?? 0);
|
|
|
|
let right = left + wall.value.offsetWidth;
|
|
|
|
let bottom = top + wall.value.offsetHeight;
|
|
|
|
if (evt.clientX < left) {
|
|
|
|
area_open_window_rect.value.end_x = left;
|
|
|
|
} else if (evt.clientX > right) {
|
|
|
|
area_open_window_rect.value.end_x = right;
|
|
|
|
} else {
|
|
|
|
area_open_window_rect.value.end_x = evt.clientX;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (evt.clientY < top) {
|
|
|
|
area_open_window_rect.value.end_y = top;
|
|
|
|
} else if (evt.clientY > bottom) {
|
|
|
|
area_open_window_rect.value.end_y = bottom;
|
|
|
|
} else {
|
|
|
|
area_open_window_rect.value.end_y = evt.clientY;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
EventBus.getInstance().on(EventNamesDefine.WindowMouseDown, wallMouseDown);
|
|
|
|
EventBus.getInstance().on(EventNamesDefine.WindowMouseMove, wallMouseMove);
|
|
|
|
EventBus.getInstance().on(EventNamesDefine.WindowMouseUp, wallMouseUp);
|
|
|
|
|
2021-08-27 17:15:31 +08:00
|
|
|
EventBus.getInstance().on(
|
|
|
|
EventNamesDefine.DocumentBodyClick,
|
|
|
|
(evt: PointerEvent) => {
|
|
|
|
if (wall.value) {
|
|
|
|
let flag = false;
|
|
|
|
{
|
|
|
|
let item: HTMLElement | null = evt.srcElement as HTMLElement;
|
|
|
|
while (item) {
|
|
|
|
if (item == wall.value) {
|
|
|
|
flag = true;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
item = item.parentElement;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (!flag) {
|
2022-02-12 10:16:08 +08:00
|
|
|
$store.commit("setSelectedWindow", "");
|
2021-08-27 17:15:31 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
);
|
|
|
|
|
2022-02-12 10:16:08 +08:00
|
|
|
const __temp__size_a__ = 0.00000001;
|
|
|
|
|
2021-08-06 17:24:41 +08:00
|
|
|
EventBus.getInstance().on(
|
2021-08-12 08:28:52 +08:00
|
|
|
EventNamesDefine.NotifyMessage,
|
2021-08-26 11:19:31 +08:00
|
|
|
(notify: NotifyMessage) => {
|
2021-08-06 17:24:41 +08:00
|
|
|
try {
|
2021-08-26 11:19:31 +08:00
|
|
|
switch (notify.packet.command) {
|
2021-08-12 08:28:52 +08:00
|
|
|
case Protocol.Commands.kCloseWindow:
|
|
|
|
{
|
2021-08-26 11:19:31 +08:00
|
|
|
const temp = JSON.parse(notify.data);
|
2021-08-12 08:28:52 +08:00
|
|
|
if (temp && temp.window_id) {
|
2022-04-22 09:54:14 +08:00
|
|
|
if (temp.window_id << 0 == -1) {
|
|
|
|
$store.commit("cleanWindows", {
|
|
|
|
window_id: temp.window_id,
|
|
|
|
});
|
|
|
|
} else {
|
|
|
|
$store.commit("removeWindow", {
|
|
|
|
window_id: temp.window_id,
|
|
|
|
});
|
|
|
|
}
|
2021-08-06 17:24:41 +08:00
|
|
|
}
|
2021-08-12 08:28:52 +08:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case Protocol.Commands.kMoveWindow:
|
|
|
|
{
|
2021-08-26 11:19:31 +08:00
|
|
|
const temp = JSON.parse(notify.data);
|
2021-08-12 08:28:52 +08:00
|
|
|
if (temp && temp.window_id) {
|
|
|
|
const window = $store.state.windows.find(
|
|
|
|
(item) => item.window_id == temp.window_id
|
|
|
|
);
|
|
|
|
if (window) {
|
2022-02-12 10:16:08 +08:00
|
|
|
// 先设置一个坐标让数据变动,然后再设置新数据,保证坐标正常刷新
|
2022-02-12 10:38:40 +08:00
|
|
|
$store.commit("setWindowPropertys", [
|
|
|
|
{
|
|
|
|
window,
|
|
|
|
property_name: "x",
|
|
|
|
value: (temp.x ?? 0) + __temp__size_a__,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
window,
|
|
|
|
property_name: "y",
|
|
|
|
value: (temp.y ?? 0) + __temp__size_a__,
|
|
|
|
},
|
|
|
|
]);
|
2022-02-12 10:16:08 +08:00
|
|
|
|
|
|
|
setTimeout(() => {
|
|
|
|
$store.commit("setWindowPropertys", [
|
|
|
|
{
|
|
|
|
window,
|
|
|
|
property_name: "x",
|
|
|
|
value: temp.x ?? 0,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
window,
|
|
|
|
property_name: "y",
|
|
|
|
value: temp.y ?? 0,
|
|
|
|
},
|
|
|
|
]);
|
|
|
|
}, 0);
|
2021-08-06 17:24:41 +08:00
|
|
|
}
|
|
|
|
}
|
2021-08-12 08:28:52 +08:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case Protocol.Commands.kResizeWindow:
|
|
|
|
{
|
2021-08-26 11:19:31 +08:00
|
|
|
const temp = JSON.parse(notify.data);
|
2021-08-12 08:28:52 +08:00
|
|
|
if (temp && temp.window_id) {
|
|
|
|
const window = $store.state.windows.find(
|
|
|
|
(item) => item.window_id == temp.window_id
|
|
|
|
);
|
|
|
|
if (window) {
|
2022-02-12 10:38:40 +08:00
|
|
|
$store.commit("setWindowPropertys", [
|
|
|
|
{
|
|
|
|
window,
|
|
|
|
property_name: "width",
|
|
|
|
value: (temp.width ?? 0) + __temp__size_a__,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
window,
|
|
|
|
property_name: "height",
|
|
|
|
value: (temp.width ?? 0) + __temp__size_a__,
|
|
|
|
},
|
|
|
|
]);
|
2022-02-12 10:16:08 +08:00
|
|
|
|
|
|
|
setTimeout(() => {
|
|
|
|
$store.commit("setWindowPropertys", [
|
|
|
|
{
|
|
|
|
window,
|
|
|
|
property_name: "width",
|
|
|
|
value: temp.width ?? 0,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
window,
|
|
|
|
property_name: "height",
|
|
|
|
value: temp.height ?? 0,
|
|
|
|
},
|
|
|
|
]);
|
|
|
|
}, 0);
|
2021-08-06 17:24:41 +08:00
|
|
|
}
|
|
|
|
}
|
2021-08-12 08:28:52 +08:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case Protocol.Commands.kOpenWindow:
|
|
|
|
{
|
2021-08-26 11:19:31 +08:00
|
|
|
const temp = JSON.parse(notify.data) as WindowOpenNotifyEntity;
|
2021-08-12 08:28:52 +08:00
|
|
|
if (temp) {
|
|
|
|
$store.commit("pushWindow", temp);
|
2021-08-06 17:24:41 +08:00
|
|
|
}
|
2021-08-12 08:28:52 +08:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case Protocol.Commands.kWindowOtherStateChanged:
|
|
|
|
{
|
|
|
|
const temp = JSON.parse(
|
2021-08-26 11:19:31 +08:00
|
|
|
notify.data
|
2021-08-12 08:28:52 +08:00
|
|
|
) as WindowOtherStateChangeNotifyEntity;
|
|
|
|
if (temp && temp.window_id) {
|
|
|
|
const window = $store.state.windows.find(
|
|
|
|
(item) => item.window_id == temp.window_id
|
|
|
|
);
|
|
|
|
if (window) {
|
2021-12-23 09:28:21 +08:00
|
|
|
$store.commit("setWindowPropertys", [
|
|
|
|
{
|
|
|
|
window,
|
2022-04-08 11:34:55 +08:00
|
|
|
property_name: "paused",
|
|
|
|
value: temp.paused,
|
2021-12-23 09:28:21 +08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
window,
|
|
|
|
property_name: "muted",
|
|
|
|
value: temp.muted,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
window,
|
|
|
|
property_name: "volume",
|
|
|
|
value: temp.volume,
|
|
|
|
},
|
2022-01-19 19:28:03 +08:00
|
|
|
{
|
|
|
|
window,
|
|
|
|
property_name: "volume",
|
|
|
|
value: temp.volume,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
window,
|
|
|
|
property_name: "polling",
|
|
|
|
value: temp.polling,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
window,
|
|
|
|
property_name: "polling_title",
|
|
|
|
value: temp.title,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
window,
|
|
|
|
property_name: "polling_window_type",
|
|
|
|
value: temp.window_type,
|
|
|
|
},
|
2021-12-23 09:28:21 +08:00
|
|
|
]);
|
2021-08-09 10:59:16 +08:00
|
|
|
}
|
|
|
|
}
|
2021-08-12 08:28:52 +08:00
|
|
|
}
|
|
|
|
break;
|
2022-02-10 17:16:27 +08:00
|
|
|
case Protocol.Commands.kTopWindow:
|
2022-02-10 15:51:48 +08:00
|
|
|
{
|
|
|
|
const temp = JSON.parse(
|
|
|
|
notify.data
|
2022-02-10 17:16:27 +08:00
|
|
|
) as Protocol.TopWindowNotifyEntity;
|
2022-02-10 15:51:48 +08:00
|
|
|
if (temp) {
|
|
|
|
for (const window of $store.state.windows) {
|
|
|
|
if (window && window.window_id != temp.new_window_id) {
|
|
|
|
$store.commit("setWindowProperty", {
|
|
|
|
window,
|
|
|
|
property_name: "focus",
|
|
|
|
value: false,
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
const window = $store.state.windows.find(
|
|
|
|
(item) => item.window_id == temp.new_window_id
|
|
|
|
);
|
|
|
|
$store.commit("setWindowProperty", {
|
|
|
|
window,
|
|
|
|
property_name: "focus",
|
|
|
|
value: true,
|
|
|
|
});
|
|
|
|
$store.commit("topWindow", temp.new_window_id);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case Protocol.Commands.kLowerWindow:
|
|
|
|
{
|
|
|
|
const temp = JSON.parse(
|
|
|
|
notify.data
|
|
|
|
) as Protocol.LowerWindowNotifyEntity;
|
|
|
|
if (temp) {
|
|
|
|
$store.commit("lowerWindow", temp.window_id);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
2021-08-06 17:24:41 +08:00
|
|
|
}
|
|
|
|
} catch {}
|
|
|
|
}
|
|
|
|
);
|
|
|
|
|
2021-08-10 11:22:39 +08:00
|
|
|
onMounted(() => {
|
|
|
|
if (wall.value) {
|
|
|
|
elementResizeDetectorMaker().listenTo(
|
|
|
|
wall.value,
|
|
|
|
(element: HTMLElement) => {
|
|
|
|
if (element) {
|
|
|
|
calcWallItemWH();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
);
|
|
|
|
}
|
2021-08-05 17:26:27 +08:00
|
|
|
});
|
|
|
|
|
2022-04-15 15:39:10 +08:00
|
|
|
interface __Rect {
|
|
|
|
width: number;
|
|
|
|
height: number;
|
|
|
|
x: number;
|
|
|
|
y: number;
|
|
|
|
left: number;
|
|
|
|
top: number;
|
|
|
|
}
|
|
|
|
|
|
|
|
const moveWindow = (window_id: number, rect: __Rect) => {
|
|
|
|
rect.x = rect.x ?? 0;
|
|
|
|
rect.y = rect.y ?? 0;
|
2022-02-12 10:16:08 +08:00
|
|
|
if (wall.value) {
|
|
|
|
const x =
|
2022-04-15 15:39:10 +08:00
|
|
|
rect.left -
|
2022-02-12 10:16:08 +08:00
|
|
|
(wall.value.parentElement?.offsetLeft ?? 0) -
|
|
|
|
wall.value.offsetLeft;
|
|
|
|
const y =
|
2022-04-15 15:39:10 +08:00
|
|
|
rect.top -
|
2022-02-12 10:16:08 +08:00
|
|
|
(wall.value.parentElement?.offsetTop ?? 0) -
|
|
|
|
wall.value.offsetTop;
|
|
|
|
GlobalData.getInstance()
|
|
|
|
.getCurrentClient()
|
|
|
|
?.moveWindow(
|
|
|
|
window_id,
|
|
|
|
x / wall.value.clientWidth,
|
|
|
|
y / wall.value.clientHeight
|
|
|
|
);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2022-04-15 15:39:10 +08:00
|
|
|
const resizeWindow = (window_id: number, rect: __Rect) => {
|
|
|
|
rect.width = rect.width ?? 0;
|
|
|
|
rect.height = rect.height ?? 0;
|
|
|
|
rect.left = rect.left ?? 0;
|
|
|
|
rect.top = rect.top ?? 0;
|
2022-02-12 10:16:08 +08:00
|
|
|
if (wall.value) {
|
|
|
|
const x =
|
2022-04-15 15:39:10 +08:00
|
|
|
rect.left -
|
2022-02-12 10:16:08 +08:00
|
|
|
(wall.value.parentElement?.offsetLeft ?? 0) -
|
|
|
|
wall.value.offsetLeft;
|
|
|
|
const y =
|
2022-04-15 15:39:10 +08:00
|
|
|
rect.top -
|
2022-02-12 10:16:08 +08:00
|
|
|
(wall.value.parentElement?.offsetTop ?? 0) -
|
|
|
|
wall.value.offsetTop;
|
|
|
|
GlobalData.getInstance()
|
|
|
|
.getCurrentClient()
|
|
|
|
?.setWindowGeometry(
|
|
|
|
window_id,
|
|
|
|
x / wall.value.clientWidth,
|
|
|
|
y / wall.value.clientHeight,
|
2022-04-15 15:39:10 +08:00
|
|
|
rect.width / wall.value.clientWidth,
|
|
|
|
rect.height / wall.value.clientHeight
|
2022-02-12 10:16:08 +08:00
|
|
|
);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2021-08-05 14:23:45 +08:00
|
|
|
return {
|
2021-08-05 17:26:27 +08:00
|
|
|
windows,
|
2021-08-05 14:23:45 +08:00
|
|
|
wall,
|
2022-04-25 16:41:42 +08:00
|
|
|
window_rect_edit_dialog,
|
2021-08-05 14:23:45 +08:00
|
|
|
wall_rows,
|
|
|
|
wall_cols,
|
|
|
|
item_witdh,
|
|
|
|
item_height,
|
2022-07-13 20:01:16 +08:00
|
|
|
show_windows_flag,
|
2021-12-20 10:34:56 +08:00
|
|
|
plan_running,
|
2021-12-22 19:44:02 +08:00
|
|
|
edit_volume_dialog,
|
2022-01-19 19:28:03 +08:00
|
|
|
polling_setting_dialog,
|
2022-03-03 17:52:08 +08:00
|
|
|
file_manage_dialog,
|
2022-01-25 11:34:07 +08:00
|
|
|
area_open_window_rect,
|
|
|
|
area_open_window_flag,
|
2022-03-03 17:52:08 +08:00
|
|
|
last_context_menu_pos_x,
|
|
|
|
last_context_menu_pos_y,
|
|
|
|
loga(a: any) {
|
|
|
|
console.log(a);
|
|
|
|
},
|
2022-04-28 15:48:10 +08:00
|
|
|
async onDrop(e: DragEvent) {
|
2021-08-05 14:23:45 +08:00
|
|
|
e.preventDefault();
|
|
|
|
let target = e.target as any;
|
2022-04-28 15:48:10 +08:00
|
|
|
|
|
|
|
// 有可能是窗口的子节点收到了拖拽信息,需要找到真正的窗口节点来判断
|
|
|
|
const find_parent_dom = (dom: HTMLElement, classess: string[]) => {
|
|
|
|
let parent: HTMLElement | null = dom;
|
|
|
|
while (parent) {
|
|
|
|
if (parent) {
|
|
|
|
for (const clazz of classess) {
|
|
|
|
if (clazz) {
|
|
|
|
if (parent.classList.contains(clazz)) {
|
|
|
|
return parent;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
parent = parent.parentElement;
|
|
|
|
} else {
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return parent;
|
|
|
|
};
|
|
|
|
|
|
|
|
if (target) {
|
|
|
|
const temp = find_parent_dom(target, [
|
|
|
|
"wall_item_flag",
|
|
|
|
"window_flag",
|
|
|
|
]);
|
|
|
|
if (temp) {
|
|
|
|
target = temp;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-08-05 14:23:45 +08:00
|
|
|
if (target) {
|
|
|
|
target.classList.remove("drag-enter");
|
|
|
|
}
|
|
|
|
|
2022-04-22 14:45:44 +08:00
|
|
|
if (plan_running.value) {
|
|
|
|
$q.notify({
|
|
|
|
type: "warning",
|
|
|
|
message: $t.t("plan running! can't open window!"),
|
|
|
|
position: "top",
|
|
|
|
timeout: 1500,
|
|
|
|
});
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2022-02-24 20:11:20 +08:00
|
|
|
const type = e.dataTransfer?.getData("type");
|
|
|
|
const uuid = e.dataTransfer?.getData("uuid");
|
|
|
|
if (uuid && uuid.length > 0 && type && type.length > 0) {
|
|
|
|
const signal_sources = GlobalData.getInstance().signal_source.filter(
|
2021-08-05 14:23:45 +08:00
|
|
|
(item) => (item as any)?.uuid == uuid
|
|
|
|
);
|
|
|
|
|
2022-02-25 16:30:12 +08:00
|
|
|
{
|
2022-04-28 15:48:10 +08:00
|
|
|
const dom_element: HTMLElement | null = target as HTMLElement;
|
2022-04-25 16:41:42 +08:00
|
|
|
if (wall.value && dom_element) {
|
2022-04-28 15:48:10 +08:00
|
|
|
let x = 0;
|
|
|
|
let y = 0;
|
|
|
|
let width = 0;
|
|
|
|
let height = 0;
|
|
|
|
let muted = true;
|
|
|
|
let paused = false;
|
|
|
|
let play_speed = 1;
|
|
|
|
let find_flag = false;
|
|
|
|
let find_window = 0;
|
|
|
|
|
2022-04-25 16:41:42 +08:00
|
|
|
if (dom_element.classList.contains("wall_item_flag")) {
|
2022-02-25 16:30:12 +08:00
|
|
|
// 开窗
|
2022-04-25 16:41:42 +08:00
|
|
|
const cell_width = 1 / $store.state.wall_col;
|
|
|
|
const cell_height = 1 / $store.state.wall_row;
|
|
|
|
|
|
|
|
let col = 0;
|
|
|
|
let row = 0;
|
|
|
|
|
|
|
|
try {
|
|
|
|
col = parseInt(dom_element.getAttribute("a_col") ?? "1") - 1;
|
|
|
|
row = parseInt(dom_element.getAttribute("a_row") ?? "1") - 1;
|
|
|
|
if (isNaN(row)) {
|
|
|
|
row = 0;
|
|
|
|
}
|
|
|
|
if (isNaN(col)) {
|
|
|
|
col = 0;
|
|
|
|
}
|
|
|
|
} catch {}
|
|
|
|
|
2022-04-28 15:48:10 +08:00
|
|
|
x = col * cell_width;
|
|
|
|
y = row * cell_height;
|
|
|
|
width = cell_width;
|
|
|
|
height = cell_height;
|
|
|
|
} else if (dom_element.classList.contains("window_flag")) {
|
|
|
|
// 拖拽信号源替换窗口 后面还有一处替换窗口
|
|
|
|
const rep_uuid = dom_element.getAttribute("uuid");
|
|
|
|
if (rep_uuid) {
|
|
|
|
let window = $store.state.windows.find(
|
|
|
|
(item) => item.uuid == rep_uuid
|
|
|
|
);
|
|
|
|
if (window) {
|
|
|
|
x = window.x;
|
|
|
|
y = window.y;
|
|
|
|
width = window.width;
|
|
|
|
height = window.height;
|
|
|
|
muted = window.muted;
|
|
|
|
paused = window.paused;
|
|
|
|
play_speed = window.play_speed;
|
|
|
|
find_window = window.window_id;
|
|
|
|
find_flag = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (e.altKey) {
|
|
|
|
if (window_rect_edit_dialog.value) {
|
|
|
|
try {
|
2022-08-02 19:22:32 +08:00
|
|
|
let screen_width = $store.state.device_screen_width;
|
|
|
|
let screen_height = $store.state.device_screen_height;
|
|
|
|
if ($store.state.isSpecialVideo()) {
|
|
|
|
const screen_info = SpecialVideoHelper.getScreenInfo(
|
|
|
|
$store.state.wall_col,
|
|
|
|
$store.state.wall_row
|
|
|
|
);
|
|
|
|
screen_width = screen_info.screen_width;
|
|
|
|
screen_height = screen_info.screen_height;
|
|
|
|
}
|
2022-04-28 15:48:10 +08:00
|
|
|
const result =
|
|
|
|
await window_rect_edit_dialog.value.showDialogAsync(
|
2022-08-02 19:22:32 +08:00
|
|
|
x * screen_width,
|
|
|
|
y * screen_height,
|
|
|
|
width * screen_width,
|
|
|
|
height * screen_height
|
2022-04-28 15:48:10 +08:00
|
|
|
);
|
|
|
|
if (result) {
|
2022-08-02 19:22:32 +08:00
|
|
|
x = result.x / screen_width;
|
|
|
|
y = result.y / screen_height;
|
|
|
|
width = result.width / screen_width;
|
|
|
|
height = result.height / screen_height;
|
2022-04-28 15:48:10 +08:00
|
|
|
} else {
|
|
|
|
// 点击了取消按钮
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
} catch {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
setTimeout(() => {
|
|
|
|
if (!window) {
|
|
|
|
return;
|
|
|
|
}
|
2022-02-25 16:30:12 +08:00
|
|
|
switch (type) {
|
|
|
|
case "polling":
|
2022-04-28 15:48:10 +08:00
|
|
|
{
|
2022-07-27 19:29:05 +08:00
|
|
|
if (find_flag) {
|
|
|
|
GlobalData.getInstance()
|
|
|
|
.getCurrentClient()
|
|
|
|
?.replaceWindow2(find_window, uuid, true);
|
|
|
|
} else {
|
|
|
|
const open_polling_request =
|
|
|
|
new Protocol.OpenPollingRequestEntity(
|
|
|
|
uuid,
|
|
|
|
x,
|
|
|
|
y,
|
|
|
|
width,
|
|
|
|
height
|
|
|
|
);
|
|
|
|
open_polling_request.muted = muted;
|
|
|
|
open_polling_request.paused = paused;
|
|
|
|
open_polling_request.play_speed = play_speed;
|
|
|
|
GlobalData.getInstance()
|
|
|
|
.getCurrentClient()
|
|
|
|
?.openPolling(open_polling_request);
|
|
|
|
}
|
2022-02-25 16:30:12 +08:00
|
|
|
}
|
2022-04-28 15:48:10 +08:00
|
|
|
|
2022-02-25 16:30:12 +08:00
|
|
|
break;
|
2022-04-28 15:48:10 +08:00
|
|
|
case "signal_source":
|
|
|
|
{
|
|
|
|
if (signal_sources.length) {
|
|
|
|
const signal_source = signal_sources[0];
|
|
|
|
if (signal_source) {
|
2022-07-27 19:29:05 +08:00
|
|
|
if (find_flag) {
|
|
|
|
GlobalData.getInstance()
|
|
|
|
.getCurrentClient()
|
|
|
|
?.replaceWindow2(find_window, uuid);
|
|
|
|
} else {
|
|
|
|
const open_window_request =
|
|
|
|
new Protocol.OpenWindowRequestEntity(
|
|
|
|
uuid,
|
|
|
|
x,
|
|
|
|
y,
|
|
|
|
width,
|
|
|
|
height
|
|
|
|
);
|
|
|
|
open_window_request.muted = muted;
|
|
|
|
open_window_request.paused = paused;
|
|
|
|
open_window_request.play_speed = play_speed;
|
|
|
|
GlobalData.getInstance()
|
|
|
|
.getCurrentClient()
|
|
|
|
?.openWindow(open_window_request);
|
|
|
|
}
|
2022-04-08 14:10:46 +08:00
|
|
|
}
|
2022-04-28 15:48:10 +08:00
|
|
|
}
|
2021-08-09 10:59:16 +08:00
|
|
|
}
|
2022-04-28 15:48:10 +08:00
|
|
|
|
|
|
|
break;
|
2021-08-09 10:59:16 +08:00
|
|
|
}
|
2022-04-28 15:48:10 +08:00
|
|
|
}, 50);
|
2021-08-07 11:04:39 +08:00
|
|
|
}
|
2021-08-05 14:23:45 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
onDragEnter(e: DragEvent) {
|
2021-12-20 10:34:56 +08:00
|
|
|
e.stopPropagation();
|
2021-08-09 10:59:16 +08:00
|
|
|
let target: HTMLElement | null = e.target as HTMLElement;
|
2021-08-05 14:23:45 +08:00
|
|
|
if (target && target.draggable !== true) {
|
2021-08-09 10:59:16 +08:00
|
|
|
while (
|
|
|
|
target &&
|
|
|
|
!target.classList.contains("window_flag") &&
|
|
|
|
!target.classList.contains("wall_item_flag")
|
|
|
|
) {
|
|
|
|
target = target.parentElement;
|
|
|
|
}
|
|
|
|
|
|
|
|
target?.classList.add("drag-enter");
|
2021-08-05 14:23:45 +08:00
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
onDragLeave(e: DragEvent) {
|
2021-08-09 10:59:16 +08:00
|
|
|
let target: HTMLElement = e.target as HTMLElement;
|
|
|
|
target?.classList.remove("drag-enter");
|
2021-08-05 14:23:45 +08:00
|
|
|
},
|
|
|
|
|
|
|
|
onDragOver(e: DragEvent) {
|
2022-05-25 18:21:13 +08:00
|
|
|
if (!plan_running.value && $store.state.power_state) {
|
2021-12-20 10:34:56 +08:00
|
|
|
e.preventDefault();
|
|
|
|
}
|
2021-08-05 14:23:45 +08:00
|
|
|
},
|
2021-08-06 10:54:03 +08:00
|
|
|
|
|
|
|
onWallGridsClick(e: MouseEvent) {
|
2022-02-10 19:39:15 +08:00
|
|
|
e.stopPropagation();
|
2022-01-18 16:48:33 +08:00
|
|
|
$store.commit("setSelectedWindow", "");
|
2021-08-06 10:54:03 +08:00
|
|
|
},
|
2022-02-12 10:16:08 +08:00
|
|
|
moveWindow,
|
|
|
|
resizeWindow,
|
2021-08-06 17:24:41 +08:00
|
|
|
closeAllWindows() {
|
2022-03-21 17:33:25 +08:00
|
|
|
GlobalData.getInstance().getCurrentClient()?.closeWindow(-1);
|
2021-08-06 17:24:41 +08:00
|
|
|
},
|
2022-02-10 17:16:27 +08:00
|
|
|
topWindow(window_id: number) {
|
2021-08-09 10:59:16 +08:00
|
|
|
GlobalData.getInstance().getCurrentClient()?.focusIn(window_id);
|
|
|
|
},
|
2022-02-10 17:16:27 +08:00
|
|
|
lowerWindow(window_id: number) {
|
|
|
|
GlobalData.getInstance().getCurrentClient()?.lowerWindow(window_id);
|
|
|
|
},
|
2021-08-06 17:24:41 +08:00
|
|
|
closeOtherWindows(window_id: number) {
|
|
|
|
for (const window of $store.state.windows) {
|
|
|
|
if (window && window.window_id != window_id) {
|
|
|
|
GlobalData.getInstance()
|
|
|
|
.getCurrentClient()
|
|
|
|
?.closeWindow(window.window_id);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
2021-08-27 17:15:31 +08:00
|
|
|
windowDBClick(window_id: number) {
|
2021-12-22 19:44:02 +08:00
|
|
|
if (plan_running.value) {
|
|
|
|
return;
|
|
|
|
}
|
2021-08-27 17:15:31 +08:00
|
|
|
GlobalData.getInstance().getCurrentClient()?.windowFitGrid(window_id);
|
|
|
|
},
|
2021-08-06 17:24:41 +08:00
|
|
|
closeWindow(window_id: number) {
|
|
|
|
GlobalData.getInstance().getCurrentClient()?.closeWindow(window_id);
|
|
|
|
},
|
2021-12-22 19:44:02 +08:00
|
|
|
edit_volume(window_id: number) {
|
|
|
|
const window = windows.value.find(
|
|
|
|
(element) => element && element.window_id == window_id
|
|
|
|
);
|
|
|
|
if (window) {
|
|
|
|
edit_volume_dialog.value?.showDialog(window_id, window.volume);
|
|
|
|
}
|
|
|
|
},
|
|
|
|
mute_unmute(window_id: number) {
|
|
|
|
const window = windows.value.find(
|
|
|
|
(element) => element && element.window_id == window_id
|
|
|
|
);
|
|
|
|
if (window) {
|
2021-12-23 09:28:21 +08:00
|
|
|
if (window.muted) {
|
|
|
|
GlobalData.getInstance()
|
|
|
|
.getCurrentClient()
|
|
|
|
?.unmuteWindow(window_id);
|
|
|
|
} else {
|
|
|
|
GlobalData.getInstance().getCurrentClient()?.muteWindow(window_id);
|
|
|
|
}
|
2021-12-22 19:44:02 +08:00
|
|
|
}
|
|
|
|
},
|
2022-01-19 19:28:03 +08:00
|
|
|
start_polling(window_id: number) {
|
|
|
|
const window = windows.value.find(
|
|
|
|
(element) => element && element.window_id == window_id
|
|
|
|
);
|
|
|
|
if (window) {
|
|
|
|
GlobalData.getInstance().getCurrentClient()?.startPolling(window_id);
|
|
|
|
}
|
|
|
|
},
|
|
|
|
stop_polling(window_id: number) {
|
|
|
|
const window = windows.value.find(
|
|
|
|
(element) => element && element.window_id == window_id
|
|
|
|
);
|
|
|
|
if (window) {
|
|
|
|
GlobalData.getInstance().getCurrentClient()?.stopPolling(window_id);
|
|
|
|
}
|
|
|
|
},
|
2022-04-25 16:41:42 +08:00
|
|
|
async editRect(window_id: number) {
|
|
|
|
if (window_rect_edit_dialog.value) {
|
2022-08-05 11:33:01 +08:00
|
|
|
window_rect_edit_dialog.value.showDialog(window_id);
|
2022-04-25 16:41:42 +08:00
|
|
|
}
|
|
|
|
},
|
2022-01-19 19:28:03 +08:00
|
|
|
async polling_setting(window_id: number) {
|
|
|
|
const window = windows.value.find(
|
|
|
|
(element) => element && element.window_id == window_id
|
|
|
|
);
|
|
|
|
if (window) {
|
|
|
|
if (window.polling) {
|
|
|
|
$q.notify({
|
|
|
|
color: "positive",
|
|
|
|
icon: "done",
|
|
|
|
message: $t.t("please stop polling first") + "!",
|
|
|
|
position: "top",
|
|
|
|
timeout: 1500,
|
|
|
|
});
|
|
|
|
return;
|
|
|
|
}
|
2022-06-22 15:48:08 +08:00
|
|
|
const polling = GlobalData.getInstance().pollings.find(
|
2022-02-24 20:11:20 +08:00
|
|
|
(element) => element && element.uuid == window.polling_uuid
|
|
|
|
);
|
2022-02-26 13:39:39 +08:00
|
|
|
const signal_source = GlobalData.getInstance().signal_source.find(
|
|
|
|
(element) =>
|
|
|
|
element && element.uuid == window.signal_source_table_uuid
|
|
|
|
);
|
|
|
|
const result = await polling_setting_dialog.value.showDialogAsync(
|
|
|
|
polling ? polling.name : signal_source ? signal_source.name : null,
|
2022-02-24 20:11:20 +08:00
|
|
|
polling ? polling.polling_signal_sources : []
|
2022-01-19 19:28:03 +08:00
|
|
|
);
|
2022-02-26 13:39:39 +08:00
|
|
|
if (result) {
|
|
|
|
const { name, datas } = result;
|
|
|
|
if (name && datas) {
|
|
|
|
try {
|
|
|
|
const resposne = await GlobalData.getInstance()
|
|
|
|
.getCurrentClient()
|
2022-03-03 16:36:47 +08:00
|
|
|
?.setWindowPollingData(window_id, name, datas);
|
2022-06-22 17:51:20 +08:00
|
|
|
if (resposne && resposne.success) {
|
|
|
|
$q.notify({
|
|
|
|
color: "positive",
|
|
|
|
icon: "done",
|
|
|
|
message: $t.t("set polling data") + $t.t("success") + "!",
|
|
|
|
position: "top",
|
|
|
|
timeout: 1500,
|
|
|
|
});
|
|
|
|
} else {
|
|
|
|
$q.notify({
|
|
|
|
color: "negative",
|
|
|
|
icon: "warning",
|
|
|
|
message: $t.t("set polling data") + $t.t("failed") + "!",
|
|
|
|
position: "top",
|
|
|
|
timeout: 1500,
|
|
|
|
});
|
2022-01-19 19:28:03 +08:00
|
|
|
}
|
2022-02-26 13:39:39 +08:00
|
|
|
} catch (e) {
|
|
|
|
console.log(e);
|
2022-01-19 19:28:03 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
2022-03-03 17:52:08 +08:00
|
|
|
async openWindowByLocalFile(event: MouseEvent) {
|
|
|
|
if (!wall.value) {
|
|
|
|
return;
|
|
|
|
}
|
2022-04-08 14:10:46 +08:00
|
|
|
|
2022-03-03 17:52:08 +08:00
|
|
|
const obj = await file_manage_dialog.value.showDialogAsync(
|
|
|
|
"select",
|
2022-06-21 15:23:40 +08:00
|
|
|
false,
|
|
|
|
true,
|
|
|
|
true
|
2022-03-03 17:52:08 +08:00
|
|
|
);
|
|
|
|
if (obj) {
|
|
|
|
interface __I {
|
|
|
|
path: string;
|
|
|
|
file: FileEntity;
|
|
|
|
}
|
|
|
|
let { path, file }: __I = obj;
|
|
|
|
if (path && file) {
|
|
|
|
const full_path = (path + "/" + file.name).replace(/\\/g, "/");
|
|
|
|
const entity: SignalSourceEntity = new SignalSourceEntity();
|
|
|
|
if (
|
|
|
|
file.name.endsWith("mp4") ||
|
|
|
|
file.name.endsWith("avi") ||
|
2022-05-28 15:43:47 +08:00
|
|
|
file.name.endsWith("ts") ||
|
|
|
|
file.name.endsWith("webm") ||
|
|
|
|
file.name.endsWith("flv") ||
|
2022-05-29 09:40:14 +08:00
|
|
|
file.name.endsWith("mkv")
|
2022-03-03 17:52:08 +08:00
|
|
|
) {
|
|
|
|
entity.window_type = "EwindowType::Multimedia";
|
|
|
|
entity.media_url = JSON.stringify([full_path]);
|
|
|
|
} else {
|
|
|
|
entity.window_type = "EwindowType::Image";
|
|
|
|
entity.media_url = full_path;
|
|
|
|
}
|
|
|
|
entity.name = file.name;
|
|
|
|
entity.local_file_flag = true;
|
|
|
|
entity.group_uuid = "";
|
|
|
|
try {
|
|
|
|
const response = await GlobalData.getInstance()
|
|
|
|
.getCurrentClient()
|
|
|
|
?.addSignalSource(entity);
|
|
|
|
if (response && response.success) {
|
|
|
|
const cell_width = 1.0 / $store.state.wall_col;
|
|
|
|
const cell_height = 1.0 / $store.state.wall_row;
|
|
|
|
|
2022-04-08 14:10:46 +08:00
|
|
|
const col = Math.floor(
|
|
|
|
last_context_menu_pos_x.value /
|
|
|
|
wall.value.offsetWidth /
|
|
|
|
cell_width
|
|
|
|
);
|
|
|
|
const row = Math.floor(
|
|
|
|
last_context_menu_pos_y.value /
|
|
|
|
wall.value.offsetHeight /
|
|
|
|
cell_height
|
|
|
|
);
|
|
|
|
|
|
|
|
const x = col * cell_width;
|
|
|
|
const y = row * cell_height;
|
2022-03-03 17:52:08 +08:00
|
|
|
|
|
|
|
if (!isNaN(x) && !isNaN(y)) {
|
|
|
|
const open_window_request =
|
|
|
|
new Protocol.OpenWindowRequestEntity(
|
|
|
|
response.uuid,
|
|
|
|
x,
|
|
|
|
y,
|
|
|
|
cell_width,
|
|
|
|
cell_height
|
|
|
|
);
|
|
|
|
|
|
|
|
GlobalData.getInstance()
|
|
|
|
.getCurrentClient()
|
|
|
|
?.openWindow(open_window_request);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} catch {}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
async repliceWindow(window_id: number) {
|
2022-04-08 11:34:55 +08:00
|
|
|
// 选择信号源替换窗口,上面还有一处拖拽信号源替换
|
2022-03-03 17:52:08 +08:00
|
|
|
if (!wall.value) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
const old_window = $store.state.windows.find(
|
|
|
|
(element) => element && element.window_id == window_id
|
|
|
|
);
|
|
|
|
if (old_window) {
|
|
|
|
const old_signal_source = GlobalData.getInstance().signal_source.find(
|
|
|
|
(element) =>
|
|
|
|
element && element.uuid == old_window.signal_source_table_uuid
|
|
|
|
);
|
|
|
|
if (old_signal_source) {
|
|
|
|
const obj = await file_manage_dialog.value.showDialogAsync(
|
|
|
|
"select",
|
2022-06-21 15:23:40 +08:00
|
|
|
false,
|
|
|
|
true,
|
|
|
|
true
|
2022-03-03 17:52:08 +08:00
|
|
|
);
|
|
|
|
if (obj) {
|
|
|
|
interface __I {
|
|
|
|
path: string;
|
|
|
|
file: FileEntity;
|
|
|
|
}
|
|
|
|
let { path, file }: __I = obj;
|
|
|
|
if (path && file) {
|
|
|
|
const full_path = (path + "/" + file.name).replace(/\\/g, "/");
|
|
|
|
const entity: SignalSourceEntity = new SignalSourceEntity();
|
2022-06-20 15:45:31 +08:00
|
|
|
if (FileSuffixHelper.isVideoPath(file.name)) {
|
2022-03-03 17:52:08 +08:00
|
|
|
entity.window_type = "EwindowType::Multimedia";
|
|
|
|
entity.media_url = JSON.stringify([full_path]);
|
2022-06-20 15:45:31 +08:00
|
|
|
} else if (FileSuffixHelper.isImagePath(file.name)) {
|
2022-03-03 17:52:08 +08:00
|
|
|
entity.window_type = "EwindowType::Image";
|
|
|
|
entity.media_url = full_path;
|
2022-06-20 15:45:31 +08:00
|
|
|
} else {
|
|
|
|
return;
|
2022-03-03 17:52:08 +08:00
|
|
|
}
|
|
|
|
entity.name = file.name;
|
|
|
|
entity.local_file_flag = true;
|
|
|
|
entity.group_uuid = "";
|
|
|
|
try {
|
|
|
|
const response = await GlobalData.getInstance()
|
|
|
|
.getCurrentClient()
|
|
|
|
?.addSignalSource(entity);
|
|
|
|
if (response && response.success) {
|
2022-04-08 14:10:46 +08:00
|
|
|
GlobalData.getInstance()
|
|
|
|
.getCurrentClient()
|
2022-07-27 19:29:05 +08:00
|
|
|
?.replaceWindow2(old_window.window_id, response.uuid);
|
2022-03-03 17:52:08 +08:00
|
|
|
}
|
|
|
|
} catch {}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
2021-08-05 14:23:45 +08:00
|
|
|
};
|
|
|
|
},
|
|
|
|
});
|
|
|
|
</script>
|