From b724adea461e00b9a662fafc8a125e0f06607553 Mon Sep 17 00:00:00 2001 From: ananzhusen <2459622492@qq.com> Date: Tue, 3 Dec 2024 15:24:05 +0800 Subject: [PATCH 1/6] feat --- packages/core/src/core.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/core/src/core.ts b/packages/core/src/core.ts index e975e894..68760420 100644 --- a/packages/core/src/core.ts +++ b/packages/core/src/core.ts @@ -752,7 +752,7 @@ export class Meta2d { console.info('http消息发送成功'); } } else if (network.protocol === 'mqtt') { - const clients = this.mqttClients.filter( + const clients = this.mqttClients?.filter( (client) => (client.options as any).href === network.url ); if (clients && clients.length) { @@ -773,7 +773,7 @@ export class Meta2d { }); } } else if (network.protocol === 'websocket') { - const websockets = this.websockets.filter( + const websockets = this.websockets?.filter( (socket) => socket.url === network.url ); if (websockets && websockets.length) { From 1d182fa0be43a02b8fa59c5f508dbcfc76456bc0 Mon Sep 17 00:00:00 2001 From: ananzhusen <2459622492@qq.com> Date: Tue, 3 Dec 2024 17:33:00 +0800 Subject: [PATCH 2/6] =?UTF-8?q?feat:dialog-=E8=AE=BE=E7=BD=AE=E9=AB=98?= =?UTF-8?q?=E5=BA=A6=E5=90=8E=E9=BB=98=E8=AE=A4=E4=B8=8A=E4=B8=8B=E5=B1=85?= =?UTF-8?q?=E4=B8=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/core/src/dialog/dialog.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/core/src/dialog/dialog.ts b/packages/core/src/dialog/dialog.ts index f9f82800..73ab365b 100644 --- a/packages/core/src/dialog/dialog.ts +++ b/packages/core/src/dialog/dialog.ts @@ -188,7 +188,7 @@ export class Dialog { if(rect) { this.dialog.style.width = rect.width?(rect.width + 'px'): '80%' this.dialog.style.height = rect.height?(rect.height + 'px'): '420px'; - this.dialog.style.top = rect.y?(rect.y + 'px'): '15vh'; + this.dialog.style.top = rect.y?(rect.y + 'px'):(rect.height? `calc( 50% - ${rect.height/2}px )` : '15vh'); this.dialog.style.left = rect.x? (rect.x + 'px'): `calc( 50% - ${rect.width? rect.width/2+'px': '40%'} )`; } if(isIframe&&data){ From 62dfeb63629b772ffe515fd9c159262087b84222 Mon Sep 17 00:00:00 2001 From: ananzhusen <2459622492@qq.com> Date: Wed, 4 Dec 2024 10:26:52 +0800 Subject: [PATCH 3/6] fix:sendDataToNetWork --- packages/core/src/core.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/core/src/core.ts b/packages/core/src/core.ts index 4505be3a..b969b596 100644 --- a/packages/core/src/core.ts +++ b/packages/core/src/core.ts @@ -790,7 +790,7 @@ export class Meta2d { if (clients && clients.length) { if (clients[0].connected) { network.topics.split(',').forEach((topic) => { - clients[0].publish(topic, value); + clients[0].publish(topic, JSON.stringify(value)); }); } } else { @@ -799,7 +799,7 @@ export class Meta2d { mqttClient.on('connect', () => { console.info('mqtt连接成功'); network.topics.split(',').forEach((topic) => { - mqttClient.publish(topic, value); + mqttClient.publish(topic, JSON.stringify(value)); mqttClient?.end(); }); }); @@ -810,7 +810,7 @@ export class Meta2d { ); if (websockets && websockets.length) { if (websockets[0].readyState === 1) { - websockets[0].send(value); + websockets[0].send(JSON.stringify(value)); } } else { //临时建立连接 @@ -820,7 +820,7 @@ export class Meta2d { ); websocket.onopen = function () { console.info('websocket连接成功'); - websocket.send(value); + websocket.send(JSON.stringify(value)); setTimeout(() => { websocket.close(); }, 100); From b16c800eb554910cedd26cd0e6302341c0bac14e Mon Sep 17 00:00:00 2001 From: ananzhusen <2459622492@qq.com> Date: Wed, 4 Dec 2024 10:49:47 +0800 Subject: [PATCH 4/6] fix:sendDataToNetWork-mqtt --- packages/core/src/core.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/core/src/core.ts b/packages/core/src/core.ts index b969b596..cf8859f6 100644 --- a/packages/core/src/core.ts +++ b/packages/core/src/core.ts @@ -800,7 +800,9 @@ export class Meta2d { console.info('mqtt连接成功'); network.topics.split(',').forEach((topic) => { mqttClient.publish(topic, JSON.stringify(value)); - mqttClient?.end(); + setTimeout(() => { + mqttClient?.end(); + },1000); }); }); } From 58aafe5161334963c9d92fdbecb20cb42e1b1763 Mon Sep 17 00:00:00 2001 From: ananzhusen <2459622492@qq.com> Date: Thu, 5 Dec 2024 10:20:52 +0800 Subject: [PATCH 5/6] =?UTF-8?q?feat:combine-=E6=B7=BB=E5=8A=A0active?= =?UTF-8?q?=E5=8F=82=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/core/src/core.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/core/src/core.ts b/packages/core/src/core.ts index cf8859f6..b9355038 100644 --- a/packages/core/src/core.ts +++ b/packages/core/src/core.ts @@ -1600,8 +1600,9 @@ export class Meta2d { * 组合 * @param pens 组合的画笔们 * @param showChild 组合后展示第几个孩子 + * @param active 是否激活组合后的画笔 */ - combine(pens: Pen[] = this.store.active, showChild?: number): any { + combine(pens: Pen[] = this.store.active, showChild?: number, active = true): any { if (!pens || !pens.length) { return; } @@ -1670,7 +1671,7 @@ export class Meta2d { //将组合后的父节点置底 this.store.data.pens.splice(minIndex, 0, parent); this.store.data.pens.pop(); - this.canvas.active([parent]); + active && this.canvas.active([parent]); let step = 1; // if (!oneIsParent) { // step = 2; From bf526cf66e94885449dbec9e9b094813adbef933 Mon Sep 17 00:00:00 2001 From: ananzhusen <2459622492@qq.com> Date: Fri, 6 Dec 2024 11:35:26 +0800 Subject: [PATCH 6/6] fix:video-audio-controls --- packages/core/src/diagrams/video.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/core/src/diagrams/video.ts b/packages/core/src/diagrams/video.ts index e1ae1560..6492e3c8 100644 --- a/packages/core/src/diagrams/video.ts +++ b/packages/core/src/diagrams/video.ts @@ -75,6 +75,7 @@ export function video(pen: Pen) { media.src = pen.video; } else if (pen.audio) { media = document.createElement('audio'); + media.controls = (pen as any).controls; media.src = pen.audio; } media.loop = pen.playLoop;