修复右键开窗时坐标计算失败的BUG

This commit is contained in:
fangxiang 2022-04-08 14:10:46 +08:00
parent 191793fbf3
commit f12879faa8
1 changed files with 80 additions and 101 deletions

View File

@ -771,55 +771,58 @@ export default defineComponent({
open_window_request.paused = window.paused;
open_window_request.play_speed = window.play_speed;
console.log(window);
setTimeout(() => {
if (!window) {
return;
}
switch (type) {
case "polling":
{
const open_polling_request =
new Protocol.OpenPollingRequestEntity(
uuid,
x,
y,
width,
height
);
open_polling_request.muted = window.muted;
open_polling_request.volume = window.volume;
open_polling_request.paused = window.paused;
open_polling_request.play_speed =
window.play_speed;
GlobalData.getInstance()
.getCurrentClient()
?.openPolling(open_polling_request);
}
//setTimeout(() => {
switch (type) {
case "polling":
{
const open_polling_request =
new Protocol.OpenPollingRequestEntity(
uuid,
x,
y,
width,
height
);
open_polling_request.muted = window.muted;
open_polling_request.volume = window.volume;
open_polling_request.paused = window.paused;
open_polling_request.play_speed = window.play_speed;
GlobalData.getInstance()
.getCurrentClient()
?.openPolling(open_polling_request);
}
break;
case "signal_source":
{
const open_window_request =
new Protocol.OpenWindowRequestEntity(
uuid,
x,
y,
width,
height
);
open_window_request.muted = window.muted;
open_window_request.volume = window.volume;
open_window_request.paused = window.paused;
open_window_request.play_speed = window.play_speed;
if (signal_sources.length) {
const signal_source = signal_sources[0];
if (signal_source) {
client?.openWindow(open_window_request);
break;
case "signal_source":
{
const open_window_request =
new Protocol.OpenWindowRequestEntity(
uuid,
x,
y,
width,
height
);
open_window_request.muted = window.muted;
open_window_request.volume = window.volume;
open_window_request.paused = window.paused;
open_window_request.play_speed =
window.play_speed;
if (signal_sources.length) {
const signal_source = signal_sources[0];
if (signal_source) {
client?.openWindow(open_window_request);
}
}
}
}
break;
}
//}, 100);
break;
}
}, 50);
}
}
}
@ -997,6 +1000,7 @@ export default defineComponent({
if (!wall.value) {
return;
}
const obj = await file_manage_dialog.value.showDialogAsync(
"select",
".mp4;.avi;.ts;.jpg;.png;"
@ -1032,22 +1036,19 @@ export default defineComponent({
const cell_width = 1.0 / $store.state.wall_col;
const cell_height = 1.0 / $store.state.wall_row;
const x =
parseInt(
(
last_context_menu_pos_x.value /
wall.value.offsetWidth /
cell_width
).toFixed(0)
) * cell_width;
const y =
parseInt(
(
last_context_menu_pos_y.value /
wall.value.offsetHeight /
cell_height
).toFixed(0)
) * cell_height;
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;
if (!isNaN(x) && !isNaN(y)) {
const open_window_request =
@ -1114,49 +1115,27 @@ export default defineComponent({
.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;
const open_window_request =
new Protocol.OpenWindowRequestEntity(
response.uuid,
old_window.x,
old_window.y,
old_window.width,
old_window.height
);
const x =
parseInt(
(
last_context_menu_pos_x.value /
wall.value.offsetWidth /
cell_width
).toFixed(0)
) * cell_width;
const y =
parseInt(
(
last_context_menu_pos_y.value /
wall.value.offsetHeight /
cell_height
).toFixed(0)
) * cell_height;
open_window_request.muted = old_window.muted;
open_window_request.volume = old_window.volume;
open_window_request.paused = old_window.paused;
open_window_request.play_speed = old_window.play_speed;
if (!isNaN(x) && !isNaN(y)) {
const open_window_request =
new Protocol.OpenWindowRequestEntity(
response.uuid,
old_window.x,
old_window.y,
old_window.width,
old_window.height
);
GlobalData.getInstance()
.getCurrentClient()
?.closeWindow(old_window.window_id);
open_window_request.muted = old_window.muted;
open_window_request.volume = old_window.volume;
open_window_request.paused = old_window.paused;
open_window_request.play_speed = old_window.play_speed;
GlobalData.getInstance()
.getCurrentClient()
?.closeWindow(old_window.window_id);
GlobalData.getInstance()
.getCurrentClient()
?.openWindow(open_window_request);
}
GlobalData.getInstance()
.getCurrentClient()
?.openWindow(open_window_request);
}
} catch {}
}