From d1ef26e2ae7454a64ede86e3a99e777393094959 Mon Sep 17 00:00:00 2001 From: fangxiang Date: Fri, 25 Mar 2022 16:24:28 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E8=99=9A=E6=8B=9F=E7=AA=97?= =?UTF-8?q?=E5=8F=A3=E5=8F=AF=E8=83=BD=E4=B8=BA=E9=80=8F=E6=98=8E=E8=83=8C?= =?UTF-8?q?=E6=99=AF=E7=9A=84BUG?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/common/ClientConnection.ts | 6 ++++-- src/components/AboutDialog.vue | 4 ++-- src/entities/MultimediaWindowEntity.ts | 6 +++++- src/entities/WSProtocol.ts | 6 +++++- src/store/index.ts | 21 ++++++++++++--------- 5 files changed, 28 insertions(+), 15 deletions(-) diff --git a/src/common/ClientConnection.ts b/src/common/ClientConnection.ts index 0b3e598..f6d565f 100644 --- a/src/common/ClientConnection.ts +++ b/src/common/ClientConnection.ts @@ -554,7 +554,8 @@ export default class ClientConnection { x: number, y: number, width: number, - height: number + height: number, + limit: boolean = true ) { this.ws?.send( JSON.stringify( @@ -563,7 +564,8 @@ export default class ClientConnection { x, y, width, - height + height, + limit ) ) ); diff --git a/src/components/AboutDialog.vue b/src/components/AboutDialog.vue index 199c0f8..6ebf677 100644 --- a/src/components/AboutDialog.vue +++ b/src/components/AboutDialog.vue @@ -30,12 +30,12 @@ - + {{ $t("product name") }}: {{ $t("TV splicing box") }} - + {{ $t("copyright") }}: {{ $t("guangdong chuangxian jishu") }} LTD. diff --git a/src/entities/MultimediaWindowEntity.ts b/src/entities/MultimediaWindowEntity.ts index aadfa9d..0a7491b 100644 --- a/src/entities/MultimediaWindowEntity.ts +++ b/src/entities/MultimediaWindowEntity.ts @@ -3,6 +3,8 @@ import { SignalSourceEntity } from "./SignalSourceEntity"; import { StringKeyValueEntity } from "./StringKeyValueEntity"; import { Protocol } from "./WSProtocol"; +import window_color_list from "../store/window_color_list.js"; + export class MultimediaWindowEntity extends BaseEntity { x: number = 0; y: number = 0; @@ -45,5 +47,7 @@ export class WindowOpenNotifyEntity extends MultimediaWindowEntity { /** 轮询时的属性,不轮询时无效 */ polling_window_type: string = "EWindowType::Normal"; - client_color: string = ""; + client_color: string = window_color_list.length + ? window_color_list[Math.round(Math.random() * window_color_list.length)] + : "blue"; } diff --git a/src/entities/WSProtocol.ts b/src/entities/WSProtocol.ts index d62c497..daf7df9 100644 --- a/src/entities/WSProtocol.ts +++ b/src/entities/WSProtocol.ts @@ -628,12 +628,15 @@ export namespace Protocol { y: number = 0; width: number = 0; height: number = 0; + limit: boolean = true; + constructor( window_id: number, x: number, y: number, width: number, - height: number + height: number, + limit: boolean = true ) { super(); this.command = Commands.kSetWindowGeometry; @@ -642,6 +645,7 @@ export namespace Protocol { this.y = y ?? 0; this.width = width ?? 0; this.height = height ?? 0; + this.limit = limit ?? 0; } } diff --git a/src/store/index.ts b/src/store/index.ts index 009612a..36dcb6d 100644 --- a/src/store/index.ts +++ b/src/store/index.ts @@ -338,10 +338,12 @@ export default store(function (/* { ssrContext } */) { } for (const window of state.windows) { if (window) { - window.client_color = window_color_list.splice( - Math.round(Math.random() * window_color_list.length), - 1 - )[0]; + try { + window.client_color = window_color_list.splice( + Math.round(Math.random() * window_color_list.length), + 1 + )[0]; + } catch {} } } } @@ -352,11 +354,12 @@ export default store(function (/* { ssrContext } */) { }, pushWindow(state: StateInterface, playload?: WindowOpenNotifyEntity) { if (playload) { - playload.client_color = window_color_list.splice( - Math.round(Math.random() * window_color_list.length), - 1 - )[0]; - + try { + playload.client_color = window_color_list.splice( + Math.round(Math.random() * window_color_list.length), + 1 + )[0]; + } catch {} state.windows.push(playload); state.windows_sort.push(playload.uuid); }