修复右键开窗时坐标计算失败的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,9 +771,10 @@ export default defineComponent({
open_window_request.paused = window.paused; open_window_request.paused = window.paused;
open_window_request.play_speed = window.play_speed; open_window_request.play_speed = window.play_speed;
console.log(window); setTimeout(() => {
if (!window) {
//setTimeout(() => { return;
}
switch (type) { switch (type) {
case "polling": case "polling":
{ {
@ -788,7 +789,8 @@ export default defineComponent({
open_polling_request.muted = window.muted; open_polling_request.muted = window.muted;
open_polling_request.volume = window.volume; open_polling_request.volume = window.volume;
open_polling_request.paused = window.paused; open_polling_request.paused = window.paused;
open_polling_request.play_speed = window.play_speed; open_polling_request.play_speed =
window.play_speed;
GlobalData.getInstance() GlobalData.getInstance()
.getCurrentClient() .getCurrentClient()
?.openPolling(open_polling_request); ?.openPolling(open_polling_request);
@ -808,7 +810,8 @@ export default defineComponent({
open_window_request.muted = window.muted; open_window_request.muted = window.muted;
open_window_request.volume = window.volume; open_window_request.volume = window.volume;
open_window_request.paused = window.paused; open_window_request.paused = window.paused;
open_window_request.play_speed = window.play_speed; open_window_request.play_speed =
window.play_speed;
if (signal_sources.length) { if (signal_sources.length) {
const signal_source = signal_sources[0]; const signal_source = signal_sources[0];
if (signal_source) { if (signal_source) {
@ -819,7 +822,7 @@ export default defineComponent({
break; break;
} }
//}, 100); }, 50);
} }
} }
} }
@ -997,6 +1000,7 @@ export default defineComponent({
if (!wall.value) { if (!wall.value) {
return; return;
} }
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;"
@ -1032,22 +1036,19 @@ export default defineComponent({
const cell_width = 1.0 / $store.state.wall_col; const cell_width = 1.0 / $store.state.wall_col;
const cell_height = 1.0 / $store.state.wall_row; const cell_height = 1.0 / $store.state.wall_row;
const x = const col = Math.floor(
parseInt(
(
last_context_menu_pos_x.value / last_context_menu_pos_x.value /
wall.value.offsetWidth / wall.value.offsetWidth /
cell_width cell_width
).toFixed(0) );
) * cell_width; const row = Math.floor(
const y =
parseInt(
(
last_context_menu_pos_y.value / last_context_menu_pos_y.value /
wall.value.offsetHeight / wall.value.offsetHeight /
cell_height cell_height
).toFixed(0) );
) * cell_height;
const x = col * cell_width;
const y = row * cell_height;
if (!isNaN(x) && !isNaN(y)) { if (!isNaN(x) && !isNaN(y)) {
const open_window_request = const open_window_request =
@ -1114,27 +1115,6 @@ export default defineComponent({
.getCurrentClient() .getCurrentClient()
?.addSignalSource(entity); ?.addSignalSource(entity);
if (response && response.success) { if (response && response.success) {
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;
if (!isNaN(x) && !isNaN(y)) {
const open_window_request = const open_window_request =
new Protocol.OpenWindowRequestEntity( new Protocol.OpenWindowRequestEntity(
response.uuid, response.uuid,
@ -1157,7 +1137,6 @@ export default defineComponent({
.getCurrentClient() .getCurrentClient()
?.openWindow(open_window_request); ?.openWindow(open_window_request);
} }
}
} catch {} } catch {}
} }
} }