替换窗口时附带之前窗口的状态信息

This commit is contained in:
fangxiang 2022-04-08 11:34:55 +08:00
parent 2c13c31f7a
commit 191793fbf3
4 changed files with 65 additions and 33 deletions

View File

@ -14,7 +14,7 @@ export class MultimediaWindowEntity extends BaseEntity {
volume: number = 80; volume: number = 80;
muted: boolean = false; muted: boolean = false;
playing: boolean = false; paused: boolean = false;
play_speed: number = 1; play_speed: number = 1;
polling: boolean = false; polling: boolean = false;
polling_uuid: string = ""; polling_uuid: string = "";

View File

@ -2,7 +2,7 @@ import { Protocol } from "./WSProtocol";
export default class WindowOtherStateChangeNotifyEntity extends Protocol.PacketEntity { export default class WindowOtherStateChangeNotifyEntity extends Protocol.PacketEntity {
window_id: number = 0; window_id: number = 0;
playing = false; paused = false;
muted = false; muted = false;
volume = 80; volume = 80;
polling = false; polling = false;

View File

@ -28,7 +28,7 @@
round round
flag flag
size="lg" size="lg"
v-if="!selected_window?.playing" v-if="selected_window?.paused"
:disable="!can_pause_window || plan_running" :disable="!can_pause_window || plan_running"
icon="play_arrow" icon="play_arrow"
@click="play" @click="play"
@ -156,6 +156,7 @@ export default defineComponent({
); );
if (window) { if (window) {
selected_window.value = window; selected_window.value = window;
console.log(window);
const signal_source = GlobalData.getInstance().signal_source.find( const signal_source = GlobalData.getInstance().signal_source.find(
(element) => (element) =>
element && element.uuid == window.signal_source_table_uuid element && element.uuid == window.signal_source_table_uuid

View File

@ -518,8 +518,8 @@ export default defineComponent({
$store.commit("setWindowPropertys", [ $store.commit("setWindowPropertys", [
{ {
window, window,
property_name: "playing", property_name: "paused",
value: temp.playing, value: temp.paused,
}, },
{ {
window, window,
@ -708,7 +708,7 @@ export default defineComponent({
const y = dom.offsetTop / wall.value.clientHeight; const y = dom.offsetTop / wall.value.clientHeight;
const width = dom.offsetWidth / wall.value.clientWidth; const width = dom.offsetWidth / wall.value.clientWidth;
const height = dom.offsetHeight / wall.value.clientHeight; const height = dom.offsetHeight / wall.value.clientHeight;
console.log(type);
switch (type) { switch (type) {
case "polling": case "polling":
GlobalData.getInstance() GlobalData.getInstance()
@ -743,7 +743,7 @@ export default defineComponent({
break; break;
} }
} else if (dom.classList.contains("window_flag")) { } else if (dom.classList.contains("window_flag")) {
// //
const rep_uuid = dom.getAttribute("uuid"); const rep_uuid = dom.getAttribute("uuid");
if (rep_uuid) { if (rep_uuid) {
let window = $store.state.windows.find( let window = $store.state.windows.find(
@ -758,39 +758,68 @@ export default defineComponent({
let height = window.height; let height = window.height;
client.closeWindow(window.window_id); client.closeWindow(window.window_id);
setTimeout(() => { const open_window_request =
switch (type) { new Protocol.OpenPollingRequestEntity(
case "polling": 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;
console.log(window);
//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() GlobalData.getInstance()
.getCurrentClient() .getCurrentClient()
?.openPolling( ?.openPolling(open_polling_request);
new Protocol.OpenPollingRequestEntity( }
uuid,
x, break;
y, case "signal_source":
width, {
height const open_window_request =
) new Protocol.OpenWindowRequestEntity(
uuid,
x,
y,
width,
height
); );
break; open_window_request.muted = window.muted;
case "signal_source": open_window_request.volume = window.volume;
open_window_request.paused = window.paused;
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) {
client?.openWindow( client?.openWindow(open_window_request);
new Protocol.OpenWindowRequestEntity(
signal_source.uuid,
x,
y,
width,
height
)
);
} }
} }
break; }
}
}, 100); break;
}
//}, 100);
} }
} }
} }
@ -1040,6 +1069,7 @@ export default defineComponent({
} }
}, },
async repliceWindow(window_id: number) { async repliceWindow(window_id: number) {
// ,
if (!wall.value) { if (!wall.value) {
return; return;
} }
@ -1113,9 +1143,10 @@ export default defineComponent({
old_window.width, old_window.width,
old_window.height old_window.height
); );
open_window_request.muted = old_window.muted; open_window_request.muted = old_window.muted;
open_window_request.volume = old_window.volume; open_window_request.volume = old_window.volume;
open_window_request.paused = !old_window.playing; open_window_request.paused = old_window.paused;
open_window_request.play_speed = old_window.play_speed; open_window_request.play_speed = old_window.play_speed;
GlobalData.getInstance() GlobalData.getInstance()