From 7e28f2c5ea5832c7bedf27295ae04780621e6852 Mon Sep 17 00:00:00 2001 From: miao <2514145421@qq.com> Date: Thu, 22 Dec 2022 11:24:28 +0800 Subject: [PATCH] =?UTF-8?q?=E9=AD=94=E5=A2=99=E6=B7=BB=E5=8A=A0=E7=BC=A9?= =?UTF-8?q?=E6=94=BE=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/AdvancedDebugDialog.vue | 43 +++- src/components/ControlPanelDialog.vue | 265 ++++++++++++++----------- src/components/RegisterDialog.vue | 18 ++ src/entities/EDeviceAttribute.ts | 2 +- src/entities/RectF.ts | 3 + src/i18n/en-US/index.ts | 3 +- src/i18n/zh-CN/index.ts | 2 +- src/pages/TopToolBar.vue | 1 + src/store/index.ts | 3 + 9 files changed, 210 insertions(+), 130 deletions(-) diff --git a/src/components/AdvancedDebugDialog.vue b/src/components/AdvancedDebugDialog.vue index 0c325cb..0e00bf7 100644 --- a/src/components/AdvancedDebugDialog.vue +++ b/src/components/AdvancedDebugDialog.vue @@ -69,15 +69,7 @@ :disable="loading" /> - - - + @@ -85,12 +77,33 @@ + + + + + + + @@ -198,6 +211,9 @@ export default defineComponent({ const function_mirroring_output = ref( $store.state.custom_defines.function_mirroring_output ); + const function_magic_wall = ref( + $store.state.custom_defines.function_magic_wall + ); const target_language = ref("zh-CN"); return { @@ -206,6 +222,7 @@ export default defineComponent({ function_center_control, function_output_board, function_custom_ISV, + function_magic_wall, function_mirroring_output, target_language, @@ -219,6 +236,8 @@ export default defineComponent({ $store.state.custom_defines.function_output_board; function_mirroring_output.value = $store.state.custom_defines.function_mirroring_output; + function_magic_wall.value = + $store.state.custom_defines.function_magic_wall; }, resetData() { loading.value = false; @@ -227,6 +246,7 @@ export default defineComponent({ function_output_board.value = false; function_mirroring_output.value = false; function_custom_ISV.value = false; + function_magic_wall.value=false; }, restartDevice() { @@ -319,6 +339,9 @@ export default defineComponent({ if (function_custom_ISV.value) { attribute |= EDeviceAttribute.CustomISV; } + if (function_magic_wall.value) { + attribute |= EDeviceAttribute.ProductMagicWall; + } GlobalData.getInstance() .getCurrentClient() diff --git a/src/components/ControlPanelDialog.vue b/src/components/ControlPanelDialog.vue index f00dd28..3f15922 100644 --- a/src/components/ControlPanelDialog.vue +++ b/src/components/ControlPanelDialog.vue @@ -66,10 +66,8 @@ @@ -100,9 +99,7 @@ -
{{ $t("topology diagram") }}
+
+
缩放
+ +
+ :class="$store.state.power_state ? 'wall' : ''">
@@ -141,18 +143,15 @@
-
+
+ @mousedown="activeMouseDown(item, index)" :z-index="item.active ? 99 : 0">
+ style="text-align:center;" :style="{ lineHeight: show_box_line_height(item.h) }"> @@ -188,7 +187,7 @@ -
+
@@ -273,12 +272,14 @@ class test_monitor { active = false; start_x = 0; start_y = 0; + InitialW = 0; + InitialH = 0; w = 0; h = 0; currentx = 0; currenty = 0; - centerx=0; - centery=0; + centerx = 0; + centery = 0; angle = 0; id = 0; resize = 0; @@ -293,13 +294,15 @@ class test_monitor { this.h = 0; this.currentx = 0; this.currenty = 0; - this.centerx=0; - this.centery=0; + this.centerx = 0; + this.centery = 0; this.angle = 0; this.id = 0; this.isHide = false;//列表隐藏 this.isShow = false;//墙显示 this.resize = 0; + this.InitialW = 0; + this.InitialW = 0; } constructor(id: number, uuid: string, w: number, h: number, resize: number) { this.reset(); @@ -334,7 +337,10 @@ export default defineComponent({ const aw = 128; const ah = 72; const bw = 160; const bh = 90; - const ar = 0.2; const br = 0.6; + //调整与背景的百分比 + const percenter = ref(1); + const ar = 0.5; + const br = 0.6; let test_monitor_list: Ref = ref([ new test_monitor(0, "01", aw, ah, ar), new test_monitor(1, "02", aw, ah, ar), @@ -355,7 +361,6 @@ export default defineComponent({ left: number; top: number; angle: number; - }; let showMonitor = reactive({ x: 0, @@ -365,65 +370,65 @@ export default defineComponent({ active: false }); let test_monitor_wall: Ref = ref([]); - const set_x=()=>{ - const wall_dom = wall.value - const item = test_monitor_wall.value[current_index.value] - const rx: number = item.currentx + item.w; - if (wall_dom) { - if (rx > wall_dom.offsetWidth) { - item.currentx = Math.round(wall_dom.offsetWidth - item.w) - return parseInt(item.currentx.toString()); - }else{ - return item.currentx - } - } - - }; - const min_x=()=>{ + const set_x = () => { const wall_dom = wall.value const item = test_monitor_wall.value[current_index.value] - if (wall_dom) { - return Math.floor(item.w/2) + const rx: number = item.currentx + item.w; + if (wall_dom) { + if (rx > wall_dom.offsetWidth) { + item.currentx = Math.round(wall_dom.offsetWidth - item.w) + return parseInt(item.currentx.toString()); + } else { + return item.currentx } + } + }; - const max_x=()=>{ + const min_x = () => { const wall_dom = wall.value - const item = test_monitor_wall.value[current_index.value] - if (wall_dom) { - return Math.round(wall_dom.offsetWidth -item.w/2) - } + const item = test_monitor_wall.value[current_index.value] + if (wall_dom) { + return Math.floor(item.w / 2) + } }; - const set_y=()=>{ - //输入框正向溢出 - const wall_dom = wall.value - const item = test_monitor_wall.value[current_index.value] - const ry: number = item.currenty + item.h; - if (wall_dom) { - if (ry > wall_dom.offsetHeight) { - item.currenty = Math.round(wall_dom.offsetHeight - item.h) - return parseInt(item.currenty.toString()); - }else{ - return parseInt(item.currenty.toString()); - } - } - - }; - const min_y=()=>{ + const max_x = () => { const wall_dom = wall.value - const item = test_monitor_wall.value[current_index.value] - if (wall_dom) { - return Math.floor(item.h/2) - } + const item = test_monitor_wall.value[current_index.value] + if (wall_dom) { + return Math.round(wall_dom.offsetWidth - item.w / 2) + } }; - const max_y=()=>{ - const wall_dom = wall.value - const item = test_monitor_wall.value[current_index.value] - if (wall_dom) { - return Math.round(wall_dom.offsetHeight - item.h/2) + const set_y = () => { + //输入框正向溢出 + const wall_dom = wall.value + const item = test_monitor_wall.value[current_index.value] + const ry: number = item.currenty + item.h; + if (wall_dom) { + if (ry > wall_dom.offsetHeight) { + item.currenty = Math.round(wall_dom.offsetHeight - item.h) + return parseInt(item.currenty.toString()); + } else { + return parseInt(item.currenty.toString()); } + } }; - let Unchecked=ref(false); + const min_y = () => { + const wall_dom = wall.value + const item = test_monitor_wall.value[current_index.value] + if (wall_dom) { + return Math.floor(item.h / 2) + } + }; + const max_y = () => { + const wall_dom = wall.value + const item = test_monitor_wall.value[current_index.value] + if (wall_dom) { + return Math.round(wall_dom.offsetHeight - item.h / 2) + } + }; + let Unchecked = ref(false); const moveingMonitor = (item: test_monitor, rect: show__Rect, index: number) => { + item.active = true; if (item.active) { test_monitor_wall.value.forEach(element => { element.active = false @@ -431,47 +436,48 @@ export default defineComponent({ } const wall_dom = wall.value if (wall_dom) { - item.h = wall_dom.offsetHeight * item.resize; - item.w = wall_dom.offsetWidth * item.resize; + item.h = item.InitialH * percenter.value; + item.w = item.InitialW * percenter.value; } item.active = true; item.currentx = parseInt(rect.left.toString()) item.currenty = parseInt(rect.top.toString()) - item.centerx=Math.round(item.currentx+item.w/2) - item.centery=Math.round(item.currenty+item.h/2) + item.centerx = Math.round(item.currentx + item.w / 2) + item.centery = Math.round(item.currenty + item.h / 2) if (Number.isNaN(rect.left || rect.left < 0)) { item.currentx = 0 } }; - const rotateMonitor = (item: test_monitor, rect: show__Rect) => { - }; + const moveMonitor = (item: test_monitor, rect: show__Rect) => { //计算是否超出,然后放回 const wall_dom = wall.value if (rect.left < 0) { item.currentx = 0 - } else if(wall_dom&&rect.left>wall_dom.offsetWidth-item.w) { - item.currentx =set_x()??0; - }else{ + } else if (wall_dom && rect.left > wall_dom.offsetWidth - item.w) { + item.currentx = set_x() ?? 0; + } else { item.currentx = parseInt(rect.left.toString()) } if (rect.top < 0) { item.currenty = 0 - } else if(wall.value&&rect.top>wall.value.offsetHeight-item.h){ - item.currenty =set_y()??0; - }else{ + } else if (wall.value && rect.top > wall.value.offsetHeight - item.h) { + item.currenty = set_y() ?? 0; + } else { item.currenty = parseInt(rect.top.toString()) } - item.centerx=Math.floor(item.currentx+item.w/2) - item.centery=Math.floor(item.currenty+item.h/2) + item.centerx = Math.floor(item.currentx + item.w / 2) + item.centery = Math.floor(item.currenty + item.h / 2) }; let test_delete_flag = false; EventBus.getInstance().on(EventNamesDefine.WindowResize, () => { const wall_dom = wall.value if (wall_dom) { test_monitor_wall.value.forEach((element) => { - element.h = wall_dom.offsetHeight * element.resize; - element.w = wall_dom.offsetWidth * element.resize; + element.InitialH = wall_dom.offsetHeight * element.resize; + element.InitialW = wall_dom.offsetWidth * element.resize; + element.h = element.InitialH * percenter.value; + element.w = element.InitialW * percenter.value; }) } }); @@ -483,6 +489,7 @@ export default defineComponent({ current_index, test_monitor_list, test_monitor_wall, + percenter, wall, set_x, min_x, @@ -492,7 +499,6 @@ export default defineComponent({ max_y, moveMonitor, moveingMonitor, - rotateMonitor, loga(a: any) { console.log(a); }, @@ -509,10 +515,14 @@ export default defineComponent({ extend(true, item, test_monitor_list.value[element.index]) item.currentx = Math.round(element.lt.x * wall_dom.offsetWidth); item.currenty = Math.round(element.lt.y * wall_dom.offsetHeight); - item.h = wall_dom.offsetHeight * element.h; - item.w = wall_dom.offsetWidth * element.w; - item.centerx=Math.floor(item.currentx+item.w/2); - item.centery=Math.floor(item.currenty+item.h/2); + percenter.value = parseFloat(element.percenter.toString()); + console.log(element.percenter) + item.InitialH = element.initial_h; + item.InitialW = element.initial_w; + item.h = parseInt((item.InitialH * percenter.value).toString()); + item.w = parseInt((item.InitialW * percenter.value).toString()); + item.centerx = Math.floor(item.currentx + item.w / 2); + item.centery = Math.floor(item.currenty + item.h / 2); item.angle = element.angle item.isShow = true; test_monitor_wall.value.push(item); @@ -534,6 +544,7 @@ export default defineComponent({ resetData() { test_monitor_wall.value = []; current_index.value = -1; + percenter.value = 1 test_monitor_list.value.forEach(element => { element.isHide = false; }) @@ -546,17 +557,24 @@ export default defineComponent({ if (client && wall_dom) { const response = await client.getMagicWallConfig(); const cloud_monitor_list = new MagicWallConfig(); - cloud_monitor_list.magic_wall_enable = response?.config.magic_wall_enable ?? true; - cloud_monitor_list.col = response?.config.col ?? 2; - cloud_monitor_list.row = response?.config.row ?? 2; + cloud_monitor_list.magic_wall_enable = true;//response?.config.magic_wall_enable ?? true; + cloud_monitor_list.col = parseInt((GlobalData.getInstance().applicationConfig?.wall_col ?? 2).toString()) // response?.config.col ?? 2; + cloud_monitor_list.row = parseInt((GlobalData.getInstance().applicationConfig?.wall_row ?? 2).toString()) // response?.config.row ?? 2; let tep_width = 0; test_monitor_wall.value.forEach((element, index) => { if (element.isShow) { cloud_monitor_list.windows.push({ - index: element.id, lt: new PointF(element.currentx / wall_dom.offsetWidth, element.currenty / wall_dom.offsetHeight), h: element.h / wall_dom.offsetHeight, w: element.w / wall_dom.offsetWidth, angle: parseInt(element.angle.toString()) + index: element.id, + lt: new PointF(element.currentx / wall_dom.offsetWidth, element.currenty / wall_dom.offsetHeight), + h: element.h / wall_dom.offsetHeight, + w: element.w / wall_dom.offsetWidth, + angle: parseInt(element.angle.toString()), + initial_h: element.InitialH, initial_w: element.InitialW, + percenter: percenter.value, }) } }); + console.log("set") const setMagic = await client.setMagicWallConfig(cloud_monitor_list); $q.notify({ color: setMagic?.success ? "positive" : "negative", @@ -575,7 +593,7 @@ export default defineComponent({ }, activeMouseDown(item: test_monitor, index: number) { item.active = true; - Unchecked.value=false; + Unchecked.value = false; if (item.active) { test_monitor_wall.value.forEach(element => { element.active = false @@ -623,18 +641,19 @@ export default defineComponent({ const wall_dom = wall.value item.isShow = true; if (wall_dom) { - item.h = wall_dom?.offsetHeight * item.resize; - item.w = wall_dom?.offsetWidth * item.resize; - if(item.currentx> wall_dom?.offsetWidth-item.w){ - item.currentx=Math.round(wall_dom?.offsetWidth-item.w) + item.InitialH = wall_dom?.offsetHeight * (item.resize); + item.InitialW = wall_dom?.offsetWidth * (item.resize); + item.h = item.InitialH * percenter.value; + item.w = item.InitialW * percenter.value; + if (item.currentx > wall_dom?.offsetWidth - item.w) { + item.currentx = Math.round(wall_dom?.offsetWidth - item.w) } - if(item.currenty> wall_dom?.offsetHeight-item.h){ - item.currenty=Math.round(wall_dom?.offsetHeight-item.h) + if (item.currenty > wall_dom?.offsetHeight - item.h) { + item.currenty = Math.round(wall_dom?.offsetHeight - item.h) } - item.centerx=Math.round(item.currentx+item.w/2); - item.centery=Math.round(item.currenty+item.h/2); + item.centerx = Math.round(item.currentx + item.w / 2); + item.centery = Math.round(item.currenty + item.h / 2); } - if (test_monitor_wall.value.indexOf(item) == -1) { test_monitor_wall.value.push(item); test_delete_flag = true; @@ -704,22 +723,34 @@ export default defineComponent({ show_box_line_height(height: number) { return height * 0.5 + "px" }, - center_x(){ + center_x() { const wall_dom = wall.value const item = test_monitor_wall.value[current_index.value] - item.currentx=Math.round(item.centerx-item.w/2); + item.currentx = Math.round(item.centerx - item.w / 2); }, - center_y(){ + center_y() { const wall_dom = wall.value const item = test_monitor_wall.value[current_index.value] - item.currenty=Math.round(item.centery-item.h/2); + item.currenty = Math.round(item.centery - item.h / 2); }, - canel_active(){ - Unchecked.value=true; - if(Unchecked){ - current_index.value=-1 - test_monitor_wall.value.forEach((element)=>{ - element.active=false; + changePercenter() { + let tep = false; + test_monitor_wall.value.forEach((element) => { + element.w = element.InitialW * percenter.value; + element.h = element.InitialH * percenter.value; + element.centerx = element.currentx + Math.floor(element.w / 2); + element.centery = element.currenty + Math.floor(element.h / 2); + if (element.isShow) { + tep = true; + } + }) + }, + canel_active() { + Unchecked.value = true; + if (Unchecked) { + current_index.value = -1 + test_monitor_wall.value.forEach((element) => { + element.active = false; }) } }, diff --git a/src/components/RegisterDialog.vue b/src/components/RegisterDialog.vue index 13cfbe2..3e3f2c4 100644 --- a/src/components/RegisterDialog.vue +++ b/src/components/RegisterDialog.vue @@ -303,6 +303,15 @@ :loading="loading" :disable="loading" /> +
@@ -419,6 +428,7 @@ export default defineComponent({ const function_output_board = ref(false); const function_mirroring_output = ref(false); const function_custom_ISV = ref(false); + const function_magic_wall = ref(false); const trial_days = ref(0); const last_days = ref(0); @@ -441,6 +451,7 @@ export default defineComponent({ function_output_board.value = false; function_mirroring_output.value = false; function_custom_ISV.value = false; + function_magic_wall.value=false; }; const showDialog = async () => { @@ -477,6 +488,9 @@ export default defineComponent({ const function_mirroring_output = ref( $store.state.custom_defines.function_mirroring_output ); + const function_magic_wall = ref( + $store.state.custom_defines.function_magic_wall + ); }; return { @@ -498,6 +512,7 @@ export default defineComponent({ server_address, function_output_board, function_custom_ISV, + function_magic_wall, function_center_control, function_mirroring_output, target_language, @@ -626,6 +641,9 @@ export default defineComponent({ if (function_custom_ISV.value) { attribute |= EDeviceAttribute.CustomISV; } + if (function_magic_wall.value) { + attribute |= EDeviceAttribute.ProductMagicWall; + } GlobalData.getInstance() .getCurrentClient() diff --git a/src/entities/EDeviceAttribute.ts b/src/entities/EDeviceAttribute.ts index f72de48..e39f6ca 100644 --- a/src/entities/EDeviceAttribute.ts +++ b/src/entities/EDeviceAttribute.ts @@ -22,7 +22,7 @@ export enum EDeviceAttribute { Reserve18 = 0x00040000, Reserve19 = 0x00080000, Reserve20 = 0x00100000, - Reserve21 = 0x00200000, + ProductMagicWall = 0x00200000, Reserve22 = 0x00400000, Reserve23 = 0x00800000, Reserve24 = 0x01000000, diff --git a/src/entities/RectF.ts b/src/entities/RectF.ts index 4f854ca..8ef4b1a 100644 --- a/src/entities/RectF.ts +++ b/src/entities/RectF.ts @@ -34,4 +34,7 @@ export class RotatedRectF extends RectF { } export class RotatedRectFWithIndex extends RotatedRectF{ index:number=0; + percenter:number=0; + initial_h:number=0; + initial_w:number=0; } diff --git a/src/i18n/en-US/index.ts b/src/i18n/en-US/index.ts index ba6af99..696bdd5 100644 --- a/src/i18n/en-US/index.ts +++ b/src/i18n/en-US/index.ts @@ -57,6 +57,7 @@ export default { Accept: "Accept", "move speed": "Move Speed", "y offset": "Y Offset", + "the number must be greater than 0":"the number must be greater than 0", "pos x": "X Position", "pos y": "Y Position", width: "Width", @@ -401,7 +402,7 @@ export default { "Please input vaild host. example: 192.168.1.1 or 192.168.1.1:8080": "Please Input Vaild Host. Example: 192.168.1.1 or 192.168.1.1:8080", "equipment data": "Equipment Data", - "set magic wall":"Set Magic wall Success", + "set magic wall":"Set Magic wall", "magic wall":"Magic Wall", "angle":"Angle", "topology diagram":"Topology Diagram", diff --git a/src/i18n/zh-CN/index.ts b/src/i18n/zh-CN/index.ts index f12e43d..b836569 100644 --- a/src/i18n/zh-CN/index.ts +++ b/src/i18n/zh-CN/index.ts @@ -499,7 +499,7 @@ export default { Warning: "警告", function: "功能", commit: "提交", - "set device function": "设置设备功能成功", + "set device function": "设置设备功能", operator_play_signal_source: "信号源", "toolbar edit window rect": "窗口大小", exit: "退出", diff --git a/src/pages/TopToolBar.vue b/src/pages/TopToolBar.vue index c0a8aec..fb9c120 100644 --- a/src/pages/TopToolBar.vue +++ b/src/pages/TopToolBar.vue @@ -318,6 +318,7 @@ :disable="!$store.state.power_state" v-close-popup @click="$refs.control_panel_dialog.showDialog()" + v-if="$store.state.custom_defines.function_magic_wall" > diff --git a/src/store/index.ts b/src/store/index.ts index 78b8cb5..d236d0b 100644 --- a/src/store/index.ts +++ b/src/store/index.ts @@ -37,6 +37,7 @@ export class CustomDefines { function_output_board = false; function_center_control = false; function_mirroring_output = false; + function_magic_wall=false; } export interface StateInterface { @@ -389,6 +390,8 @@ export default store(function (/* { ssrContext } */) { (state.device_attribute & EDeviceAttribute.CenterControl) != 0; state.custom_defines.function_mirroring_output = (state.device_attribute & EDeviceAttribute.MirroringOutput) != 0; + state.custom_defines.function_magic_wall = + (state.device_attribute & EDeviceAttribute.ProductMagicWall) != 0; } }, setAvancedDebug(state: StateInterface, playload?: any) {