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

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() const response = await GlobalData.getInstance()
.getCurrentClient() .getCurrentClient()
?.CreateDirectoryFileManager(path.value, data); ?.CreateDirectoryFileManager(path.value, data);
console.log(response);
if (response && response.success) { if (response && response.success) {
refresh_file_list(); refresh_file_list();
$q.notify({ $q.notify({

View File

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