魔墙状态主页面右键开窗适应大小

This commit is contained in:
miao 2023-02-23 11:13:01 +08:00
parent 3b84db438f
commit 1b93f2f92a
2 changed files with 91 additions and 90 deletions

View File

@ -919,7 +919,6 @@ export default defineComponent({
const response = await GlobalData.getInstance()
.getCurrentClient()
?.CreateDirectoryFileManager(path.value, data);
console.log(response);
if (response && response.success) {
refresh_file_list();
$q.notify({

View File

@ -93,42 +93,42 @@
style="text-align: center"
>
{{ item.id + 1 }}
</vue3-resize-drag>
<q-popup-proxy
context-menu
@show="
{
last_context_menu_pos_x = $event.layerX;
last_context_menu_pos_y = $event.layerY;
}
"
>
<q-list>
<q-item
:disable="plan_running || !$store.state.power_state"
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>
<q-item
:disable="plan_running || !$store.state.power_state"
clickable
v-close-popup
@click="closeAllWindows"
>
<q-item-section avatar>
<q-icon name="close" color="red" />
</q-item-section>
<q-item-section> {{ $t("close all windows") }} </q-item-section>
</q-item>
</q-list>
</q-popup-proxy>
<q-popup-proxy
context-menu
@show="
{
last_context_menu_pos_x = $event.layerX;
last_context_menu_pos_y = $event.layerY;
}
"
>
<q-list>
<q-item
:disable="plan_running || !$store.state.power_state"
clickable
v-close-popup
@click="openWindowByLocalFile(index, $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>
<q-item
:disable="plan_running || !$store.state.power_state"
clickable
v-close-popup
@click="closeAllWindows"
>
<q-item-section avatar>
<q-icon name="close" color="red" />
</q-item-section>
<q-item-section> {{ $t("close all windows") }} </q-item-section>
</q-item>
</q-list>
</q-popup-proxy>
</vue3-resize-drag>
</div>
</div>
<div
@ -174,7 +174,7 @@
:disable="plan_running || !$store.state.power_state"
clickable
v-close-popup
@click="openWindowByLocalFile($event)"
@click="openWindowByLocalFile(-1, $event)"
>
<q-item-section avatar>
<q-icon name="open_in_browser" />
@ -378,14 +378,15 @@ export default defineComponent({
const area_open_window_rect = ref(new Rect());
let item_witdh = ref(0);
const item_height = ref(0);
const radians = () => {
const radians = (index:number) => {
const test_monitor_list: any = clacMonitor();
if (test_monitor_list) {
const item = test_monitor_list[current_index.value];
const item = test_monitor_list[index];
return /*a*/ (item.angle * Math.PI) / 180;
}
};
const calculateCoordinates = (
index:number,
px: number,
py: number,
cx: number,
@ -393,13 +394,13 @@ export default defineComponent({
) => {
const x =
cx +
(px - cx) * Math.cos(Number(radians())) -
(py - cy) * Math.sin(Number(radians()));
(px - cx) * Math.cos(Number(radians(index))) -
(py - cy) * Math.sin(Number(radians(index)));
const y =
cy +
(px - cx) * Math.sin(Number(radians())) +
(py - cy) * Math.cos(Number(radians()));
(px - cx) * Math.sin(Number(radians(index))) +
(py - cy) * Math.cos(Number(radians(index)));
return { x, y };
};
@ -423,34 +424,38 @@ export default defineComponent({
});
return test_monitor_list;
};
const four_point = () => {
const four_point = (index:number) => {
const test_monitor_list: any = clacMonitor();
if (test_monitor_list) {
const item = test_monitor_list[current_index.value];
const item = test_monitor_list[index];
item.centerx = parseInt(item.centerx.toString());
item.centery = parseInt(item.centery.toString());
const x2: number = item.currentx + item.w;
const y2: number = item.currenty + item.h;
if (item.angle != 0) {
const point_left_top = calculateCoordinates(
index,
item.currentx,
item.currenty,
item.centerx,
item.centery
);
const point_left_bootom = calculateCoordinates(
index,
item.currentx,
y2,
item.centerx,
item.centery
);
const point_right_top = calculateCoordinates(
index,
x2,
item.currenty,
item.centerx,
item.centery
);
const point_right_bottom = calculateCoordinates(
index,
x2,
y2,
item.centerx,
@ -467,9 +472,9 @@ export default defineComponent({
}
}
};
const select_x = () => {
const point_list = four_point();
const item = $store.state.show_monitor_list[current_index.value];
const select_x = (index:number) => {
const point_list = four_point(index);
const item = $store.state.show_monitor_list[index];
if (item.angle != 0) {
if (point_list) {
let minx = 100000;
@ -484,8 +489,8 @@ export default defineComponent({
if (wall.value) return item.currentx * wall.value?.clientWidth;
}
};
const select_y = () => {
const point_list = four_point();
const select_y = (index:number) => {
const point_list = four_point(index);
let miny = 100000;
if (point_list) {
point_list.forEach((element) => {
@ -494,15 +499,15 @@ export default defineComponent({
}
});
}
const item = $store.state.show_monitor_list[current_index.value];
const item = $store.state.show_monitor_list[index];
if (item.angle != 0) {
return miny;
} else {
if (wall.value) return item.currenty * wall.value?.clientHeight;
}
};
const select_height = () => {
const point_list = four_point();
const select_height = (index:number) => {
const point_list = four_point(index);
let maxy = 0;
let miny = 100000;
if (point_list) {
@ -515,7 +520,7 @@ export default defineComponent({
}
});
}
const item = $store.state.show_monitor_list[current_index.value];
const item = $store.state.show_monitor_list[index];
if (item.angle != 0) {
return maxy - miny;
} else {
@ -523,8 +528,8 @@ export default defineComponent({
}
};
const select_width = () => {
const point_list = four_point();
const select_width = (index:number) => {
const point_list = four_point(index);
let maxx = 0;
let minx = 100000;
if (point_list) {
@ -537,7 +542,7 @@ export default defineComponent({
}
});
}
const item = $store.state.show_monitor_list[current_index.value];
const item = $store.state.show_monitor_list[index];
if (item.angle != 0) {
return maxx - minx;
} else {
@ -1234,25 +1239,18 @@ export default defineComponent({
.getCurrentClient()
?.replaceWindow2(find_window, uuid, true);
} else {
if (
$store.state.custom_defines.function_magic_wall
) {
const item =
$store.state.show_monitor_list[
current_index.value
];
if (wall.value) {
x = Number(select_x()) / wall.value.clientWidth;
y =
Number(select_y()) / wall.value.clientHeight;
width =
Number(select_width()) /
wall.value.clientWidth;
height =
Number(select_height()) /
wall.value.clientHeight;
}
}
if ($store.state.custom_defines.function_magic_wall) {
const item =
$store.state.show_monitor_list[current_index.value];
if (wall.value) {
x = Number(select_x(current_index.value)) / wall.value.clientWidth;
y = Number(select_y(current_index.value)) / wall.value.clientHeight;
width =
Number(select_width(current_index.value)) / wall.value.clientWidth;
height =
Number(select_height(current_index.value)) / wall.value.clientHeight;
}
}
const open_polling_request =
new Protocol.OpenPollingRequestEntity(
uuid,
@ -1284,19 +1282,15 @@ export default defineComponent({
if (
$store.state.custom_defines.function_magic_wall
) {
const item =
$store.state.show_monitor_list[
current_index.value
];
if (wall.value) {
x = Number(select_x()) / wall.value.clientWidth;
x = Number(select_x(current_index.value)) / wall.value.clientWidth;
y =
Number(select_y()) / wall.value.clientHeight;
Number(select_y(current_index.value)) / wall.value.clientHeight;
width =
Number(select_width()) /
Number(select_width(current_index.value)) /
wall.value.clientWidth;
height =
Number(select_height()) /
Number(select_height(current_index.value)) /
wall.value.clientHeight;
}
}
@ -1495,7 +1489,7 @@ export default defineComponent({
}
}
},
async openWindowByLocalFile(event: MouseEvent) {
async openWindowByLocalFile(index: number, event: MouseEvent) {
if (!wall.value) {
return;
}
@ -1535,8 +1529,8 @@ export default defineComponent({
.getCurrentClient()
?.addSignalSource(signal_source);
if (wall.value && response && response.success) {
const cell_width = 1.0 / $store.state.wall_col;
const cell_height = 1.0 / $store.state.wall_row;
let cell_width = 1.0 / $store.state.wall_col;
let cell_height = 1.0 / $store.state.wall_row;
const col = Math.floor(
last_context_menu_pos_x.value /
@ -1549,9 +1543,17 @@ export default defineComponent({
cell_height
);
const x = col * cell_width;
const y = row * cell_height;
let x = col * cell_width;
let y = row * cell_height;
if ($store.state.custom_defines.function_magic_wall&&index!=-1) {
if (wall.value) {
x = Number(select_x(index)) / wall.value.clientWidth;
y = Number(select_y(index)) / wall.value.clientHeight;
cell_width = Number(select_width(index)) / wall.value.clientWidth;
cell_height =
Number(select_height(index)) / wall.value.clientHeight;
}
}
if (!isNaN(x) && !isNaN(y)) {
const open_window_request =
new Protocol.OpenWindowRequestEntity(