Compare commits

...

14 Commits

Author SHA1 Message Date
joylink_zhaoerwei
1c803d0965 类型报错处理 2024-10-14 13:37:02 +08:00
joylink_fanyuhong
0106643c1a 更改版本号 2024-10-14 09:42:30 +08:00
joylink_fanyuhong
2a2a4ce488 打包 2024-10-14 09:40:45 +08:00
joylink_fanyuhong
3214ef1cc4 Merge branch 'master' of https://gitea.joylink.club/joylink/graphic-pixi 2024-10-14 09:39:51 +08:00
joylink_fanyuhong
78507c2b91 添加查询id是否存在 2024-10-14 09:39:50 +08:00
joylink_zhaoerwei
38045a1027 测试类型报错 2024-10-09 17:23:16 +08:00
joylink_fanyuhong
af71702840 打包 2024-10-08 15:01:19 +08:00
joylink_fanyuhong
461713baba 订阅发布消息类型调整 2024-10-08 14:58:19 +08:00
joylink_fanyuhong
0aa1bc102b 更新版本号 2024-09-29 10:10:04 +08:00
joylink_fanyuhong
8f04522278 删除package-lock 2024-09-29 10:06:03 +08:00
joylink_fanyuhong
02ac6e6deb 更新版本 2024-09-28 10:13:07 +08:00
joylink_fanyuhong
2255232499 mqtt添加发布消息 2024-09-28 10:04:20 +08:00
joylink_zhaoerwei
8b0ad14f73 类型报错 2024-07-04 09:05:53 +08:00
11ee6c1531 添加版本发布说明 2024-05-11 15:27:17 +08:00
17 changed files with 428 additions and 377 deletions

View File

@ -3,6 +3,12 @@
图形应用基础框架,基于 pixi.js([官网](https://pixijs.com/), [API Docs](https://pixijs.download/release/docs/index.html))
viewport 使用的 github 开源的 pixi-viewport[pixi-viewport](https://github.com/davidfig/pixi-viewport)
# 发布版本说明
测试好可以发布时执行yarn run build进行构建然后再提交push后在gitea.joylink.club中进行版本发布
```
yarn run build
```
# 路线图
- ~~图形的位置、旋转属性使用 pixijs 的 transform 变换(完成)~~

View File

@ -355,6 +355,10 @@ export interface IGraphicScene extends EventEmitter<GraphicAppEvents> {
* websocket订阅
*/
unsubscribe(destination: string): void;
/**
* websocket消息
*/
publishMessage(destination: string, message: Uint8Array): void;
}
declare abstract class GraphicSceneBase extends EventEmitter<GraphicAppEvents> implements IGraphicScene {
private graphicStore;
@ -489,6 +493,10 @@ declare abstract class GraphicSceneBase extends EventEmitter<GraphicAppEvents> i
* websocket订阅
*/
unsubscribe(destination: string): void;
/**
* websocket消息
*/
publishMessage(destination: string, message: Uint8Array): void;
/**
*
* @param graphicStates

View File

@ -52,6 +52,7 @@ export interface GraphicQueryStore {
* @param type
*/
queryByCodeAndTypeAmbiguous<T extends JlGraphic>(code: string, type: string): T[];
checkIdExist(v: number): boolean;
}
/**
*
@ -87,4 +88,5 @@ export declare class GraphicStore implements GraphicQueryStore {
*
*/
clear(): void;
checkIdExist(id: number): boolean;
}

2
lib/index.d.ts vendored
View File

@ -1,4 +1,4 @@
/// <reference types="global" />
/// <reference path="../global.d.ts" />
export * as GraphicsExtras from '@pixi/graphics-extras';
export * from './app';
export * from './core';

View File

@ -4446,6 +4446,9 @@ class GraphicStore {
this.relationManage.clear();
this.store.clear();
}
checkIdExist(id) {
return this.store.has(id);
}
}
//基础图形对象扩展
@ -5279,6 +5282,10 @@ class MessageClient extends EventEmitter {
removeSubscription(destination, handle) {
this.getOrNewSubClient(destination).removeHandler(handle);
}
publishMessage(destination, message) {
const cli = this.getOrNewSubClient(destination);
cli.publishMessage(destination, message);
}
}
class SubscriptionClient {
mc;
@ -5321,6 +5328,11 @@ class SubscriptionClient {
unsubscribe() {
this.mc.unsubscribe(this.destination);
}
publishMessage(destination, message) {
if (this.mc.connected) {
this.mc.publishMessage(destination, message);
}
}
handleMessage(data) {
if (this.protocol === 'json') {
console.debug('收到消息:', data);
@ -5403,6 +5415,9 @@ class StompMessagingClient extends MessageClient {
unsubscribe0(destination) {
this.cli.unsubscribe(destination);
}
publishMessage(destination, message) {
console.debug('MQTT发布消息:未实现');
}
close() {
this.cli.deactivate();
}
@ -5522,6 +5537,15 @@ class MqttMsgClient extends MessageClient {
console.warn('MQTT 消息客户端关闭失败', error);
}
}
publishMessage(destination, message) {
console.debug('MQTT发布消息');
if (this.connected) {
this.cli.publish(destination, message);
}
else {
console.warn('MQTT 未连接,消息发布失败');
}
}
}
var ClientEngine;
@ -5601,6 +5625,9 @@ class WsMsgCli {
static registerAppMsgBroker(broker) {
WsMsgCli.appMsgBroker.push(broker);
}
static publishMessage(destination, message) {
WsMsgCli.client.publishMessage(destination, message);
}
static removeAppMsgBroker(broker) {
const index = WsMsgCli.appMsgBroker.findIndex((mb) => mb == broker);
if (index >= 0) {
@ -5674,6 +5701,9 @@ class AppWsMsgBroker {
WsMsgCli.registerSubscription(destination, handler);
});
}
publishMessage(destination, message) {
WsMsgCli.publishMessage(destination, message);
}
/**
* 取消所有订阅从通用Stomp客户端移除此消息代理
*/
@ -7130,6 +7160,13 @@ class GraphicSceneBase extends EventEmitter {
this.checkWsMsgCli();
this.wsMsgBroker.unsbuscribe(destination);
}
/**
* 发布websocket消息
*/
publishMessage(destination, message) {
this.checkWsMsgCli();
this.wsMsgBroker.publishMessage(destination, message);
}
/**
* 处理图形状态
* @param graphicStates

View File

@ -33,6 +33,7 @@ export declare abstract class MessageClient extends EventEmitter<MessageClientEv
getOrNewSubClient(destination: string): SubscriptionClient;
addSubscription(destination: string, handler: IMessageHandler): void;
removeSubscription(destination: string, handle: IMessageHandler): void;
publishMessage(destination: string, message: Uint8Array): void;
abstract get connected(): boolean;
abstract close(): void;
}
@ -47,6 +48,7 @@ export declare class SubscriptionClient {
removeHandler(handler: IMessageHandler): void;
trySubscribe(): void;
unsubscribe(): void;
publishMessage(destination: string, message: Uint8Array): void;
handleMessage(data: any): void;
onDisconnect(): void;
}

View File

@ -64,6 +64,12 @@ export interface IMessageClient extends EventEmitter<MessageClientEvents> {
* @param handler
*/
removeSubscription(destination: string, handler: IMessageHandler): void;
/**
*
* @param destination
* @param message
*/
publishMessage(destination: string, message: Uint8Array): void;
/**
*
*/
@ -84,6 +90,7 @@ export declare class WsMsgCli {
static registerSubscription(destination: string, handler: IMessageHandler): void;
static unregisterSubscription(destination: string, handler: IMessageHandler): void;
static registerAppMsgBroker(broker: AppWsMsgBroker): void;
static publishMessage(destination: string, message: Uint8Array): void;
static removeAppMsgBroker(broker: AppWsMsgBroker): void;
static hasAppMsgBroker(): boolean;
/**
@ -138,6 +145,7 @@ export declare class AppWsMsgBroker {
unsbuscribe(destination: string): void;
unsubscribeAll(): void;
resubscribeAll(): void;
publishMessage(destination: string, message: Uint8Array): void;
/**
* Stomp客户端移除此消息代理
*/

View File

@ -10,4 +10,5 @@ export declare class MqttMsgClient extends MessageClient {
unsubscribe0(destination: string): void;
get connected(): boolean;
close(): void;
publishMessage(destination: string, message: Uint8Array): void;
}

View File

@ -7,5 +7,6 @@ export declare class StompMessagingClient extends MessageClient {
get connected(): boolean;
subscribe(destination: string, handle: HandleMessage): boolean;
unsubscribe0(destination: string): void;
publishMessage(destination: string, message: Uint8Array): void;
close(): void;
}

View File

@ -1,6 +1,6 @@
{
"name": "graphic-pixi",
"version": "0.1.14",
"version": "0.1.18",
"description": "基于pixijs的图形应用、绘制应用框架",
"productName": "Graphic-pixi",
"author": "walker <shengxuqiang@joylink.club>",

View File

@ -612,6 +612,10 @@ export interface IGraphicScene extends EventEmitter<GraphicAppEvents> {
* websocket订阅
*/
unsubscribe(destination: string): void;
/**
* websocket消息
*/
publishMessage(destination: string, message: Uint8Array): void;
}
abstract class GraphicSceneBase
@ -1158,6 +1162,13 @@ abstract class GraphicSceneBase
this.checkWsMsgCli();
this.wsMsgBroker.unsbuscribe(destination);
}
/**
* websocket消息
*/
publishMessage(destination: string, message: Uint8Array) {
this.checkWsMsgCli();
this.wsMsgBroker.publishMessage(destination, message);
}
/**
*
* @param graphicStates

View File

@ -60,6 +60,8 @@ export interface GraphicQueryStore {
code: string,
type: string
): T[];
checkIdExist(v: number): boolean;
}
/**
@ -208,4 +210,8 @@ export class GraphicStore implements GraphicQueryStore {
this.relationManage.clear();
this.store.clear();
}
checkIdExist(id: number) {
return this.store.has(id)
}
}

View File

@ -70,6 +70,11 @@ export abstract class MessageClient
this.getOrNewSubClient(destination).removeHandler(handle);
}
publishMessage(destination: string, message: Uint8Array): void {
const cli = this.getOrNewSubClient(destination);
cli.publishMessage(destination, message);
}
abstract get connected(): boolean;
abstract close(): void;
@ -125,6 +130,12 @@ export class SubscriptionClient {
this.mc.unsubscribe(this.destination);
}
publishMessage(destination: string, message: Uint8Array): void {
if (this.mc.connected) {
this.mc.publishMessage(destination, message);
}
}
handleMessage(data: any) {
if (this.protocol === 'json') {
console.debug('收到消息:', data);

View File

@ -83,7 +83,12 @@ export interface IMessageClient extends EventEmitter<MessageClientEvents> {
* @param handler
*/
removeSubscription(destination: string, handler: IMessageHandler): void;
/**
*
* @param destination
* @param message
*/
publishMessage(destination: string, message: Uint8Array): void;
/**
*
*/
@ -163,6 +168,10 @@ export class WsMsgCli {
WsMsgCli.appMsgBroker.push(broker);
}
static publishMessage(destination: string, message: Uint8Array) {
WsMsgCli.client.publishMessage(destination, message);
}
static removeAppMsgBroker(broker: AppWsMsgBroker) {
const index = WsMsgCli.appMsgBroker.findIndex((mb) => mb == broker);
if (index >= 0) {
@ -295,6 +304,10 @@ export class AppWsMsgBroker {
});
}
publishMessage(destination: string, message: Uint8Array) {
WsMsgCli.publishMessage(destination, message);
}
/**
* Stomp客户端移除此消息代理
*/

View File

@ -112,4 +112,13 @@ export class MqttMsgClient extends MessageClient {
console.warn('MQTT 消息客户端关闭失败', error);
}
}
publishMessage(destination: string, message: Uint8Array): void {
console.debug('MQTT发布消息');
if(this.connected) {
this.cli.publish(destination, message as Buffer);
}else {
console.warn('MQTT 未连接,消息发布失败');
}
}
}

View File

@ -77,6 +77,10 @@ export class StompMessagingClient extends MessageClient {
this.cli.unsubscribe(destination);
}
publishMessage(destination: string, message: Uint8Array): void {
console.debug('MQTT发布消息:未实现');
}
close(): void {
this.cli.deactivate();
}

680
yarn.lock

File diff suppressed because it is too large Load Diff