diff --git a/lib/index.d.ts b/lib/index.d.ts index d2f97fe..826e1af 100644 --- a/lib/index.d.ts +++ b/lib/index.d.ts @@ -1,4 +1,4 @@ -/// +/// export * as GraphicsExtras from '@pixi/graphics-extras'; export * from './app'; export * from './core'; diff --git a/lib/index.js b/lib/index.js index eb896a9..fd225e5 100644 --- a/lib/index.js +++ b/lib/index.js @@ -5458,6 +5458,7 @@ class MqttMsgClient extends MessageClient { this.emit('error', error); }); this.cli.on('message', (topic, message) => { + console.debug('MQTT 收到消息', topic, message); const handle = this.subMsgHandler.get(topic); if (handle) { if (this.options.protocol === 'json') { @@ -5469,6 +5470,9 @@ class MqttMsgClient extends MessageClient { handle(message); } } + else { + console.warn('未找到订阅的消息处理器', topic); + } }); } catch (err) { @@ -5492,13 +5496,15 @@ class MqttMsgClient extends MessageClient { } unsubscribe0(destination) { console.debug('MQTT取消订阅执行', destination); + // 删除指定订阅的消息处理器 + this.subMsgHandler.delete(destination); + // 通知服务器取消订阅 this.cli.unsubscribe(destination, (error, packet) => { if (error) { console.warn('MQTT 取消订阅失败', error); } else { console.debug('MQTT 取消订阅成功', packet); - this.subMsgHandler.delete(destination); } }); } @@ -6852,6 +6858,9 @@ class GraphicSceneBase extends EventEmitter { this._dom = dom; this.pixi.resizeTo = dom; dom.appendChild(this.pixi.view); + // 绑定dom后,先调整视口 + this.updateViewport(dom.clientWidth, dom.clientHeight); + // 监听dom大小变化 this._viewportResizer = setInterval(() => { this.updateViewport(dom.clientWidth, dom.clientHeight); }, 1000);