Coder Social home page Coder Social logo

le5le-com / meta2d.js Goto Github PK

View Code? Open in Web Editor NEW
627.0 12.0 213.0 4.05 MB

The meta2d.js is real-time data exchange and interactive web 2D engine. Developers are able to build Web SCADA, IoT, Digital twins and so on. Meta2d.js是一个实时数据响应和交互的2d引擎,可用于Web组态,物联网,数字孪生等场景。

Home Page: http://2ds.le5le.com

License: MIT License

TypeScript 99.94% JavaScript 0.06%
graph diagram visualization typescript 2d 2d-engine canvas scada

meta2d.js's People

Contributors

alsmile avatar ananzhusen avatar binadan avatar ggsimidadada avatar gjl17371420372 avatar grnetsky avatar plortinus avatar signdawn avatar soundmark avatar wanrongyu avatar wind-breaker1 avatar xlcodes avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

meta2d.js's Issues

bug

ll
19url.0afeddfa.js:1 Uncaught TypeError: Cannot read properties of undefined (reading 'slice')
at ft (url.0afeddfa.js:1:8648)
at dt (url.0afeddfa.js:1:7443)
at Xi.dirtyPenRect (url.0afeddfa.js:1:144366)
at url.0afeddfa.js:1:148325
at Array.forEach ()
at Xi.resizePens (url.0afeddfa.js:1:147863)
at Xi.onMouseMove (url.0afeddfa.js:1:104839)
at HTMLDivElement.xt.externalElements.onmousemove (url.0afeddfa.js:1:125669)

[Bug]The package may have incorrect main/module/exports specified in its package.json.

问题描述:

根据快速上手示例安装依赖运行时报以下错误: Failed to resolve entry for package "@topology/sequence-diagram"

可复现代码(其实就是根据示例复制粘贴了一份):

code.zip

Failed to resolve entry for package "@topology/sequence-diagram". The pac
kage may have incorrect main/module/exports specified in its package.json: Failed to resolve entry for package "@topology/sequence-diagram". The package may have incorrect main/module/exports specified in its package.json.

运行环境:

node v16.13.1, on windows 11

问题引发原因:

https://nodejs.org/api/deprecations.html#dep0128-modules-with-an-invalid-main-entry-and-an-indexjs-file

简单来说,原来在 package.json 中配置的 main 指向路径在构建产物中是不存在的,但是因为构建产物中存在 index.js,所以会使用 index.js 而不报错。

在 16 及以后的版本,这种情况会报错。

图片

解决方案:

去掉 package.json 中的 main 字段(或者指向正确的 index.js 而不是 index.ts)。

使用铅笔多画几次 就报错了

image
url.7700b673.js:1 Uncaught TypeError: Cannot set properties of undefined (setting 'x')
at zi.onMouseUp (url.7700b673.js:1:108784)
at HTMLDivElement.mt.externalElements.onmouseup (url.7700b673.js:1:126949)
onMouseUp @ url.7700b673.js:1
mt.externalElements.onmouseup @ url.7700b673.js:1
25url.7700b673.js:1 Uncaught TypeError: Cannot set properties of undefined (setting 'x')
at zi.onMouseUp (url.7700b673.js:1:108784)
at zi.onMouseMove (url.7700b673.js:1:107653)
at HTMLDivElement.mt.externalElements.onmousemove (url.7700b673.js:1:126797)

1.1.4 导入之前的设计,官网能打开 vue-demo也能打开

目前 引入 core 1.1.4版本

  1. 官网能打开之前的配置好的json
  2. vue-demo那个也能打开(core 0.2.30)
  3. 自己搭建的基于 core1.1.4 就打不开了
    发现line.js报错 (worldAnchors 是 空的 undefined )
    export function line(pen, path) {
    if (!path) {
    path = new Path2D();
    }
    if (pen.calculative.worldAnchors.length > 1) {

【建议】钢笔绘制的时候,是否考虑添加吸附功能

吸附功能就是每个anchor的实际坐标位置都在网格点上,就是在绘制过程中计算鼠标点击过程中最近的网格点;
在绘制水平线垂直线,以及个性化图形的时候有很大帮助,减少偏移,减少多余一丢丢线条的情况

toComponent 报错

image
image
toComponent 一个组件好像没问题 两个及以上报错 但是在控制台直接调用这个方法却不报错

vue版问题

试了下Vue版本的事件触发,不支持通过js脚本修改节点的背景颜色,这个后续版本会不会更新,还是只能购买企业版

关于旋转后组合再操作图形就会异常的问题

if (pen.width > 1 && !isEqual(pen.height, 1)) {
rect.width = pen.width;
}
if (pen.height > 1 && !isEqual(pen.height, 1)) {
rect.height = pen.height;
}
没明白calcWorldRects方法中这段的作用,这个会导致宽大于高的图形旋转90度后参与组合必定出问题;

描绘图片bug

lll
设置描绘图片后 鼠标悬浮或选择图元 应该还是显示描绘图片

toComponent 生成新组件 再次 toComponent children丢失

选择两个组件调用toComponent 收藏起来 清空画布 方便测试 拖拽收藏的组件到画布 在拖拽一次到画布 现在画布有两个一样的收藏组件 然后全选 再调用 toComponent 生成的新的组件 拖拽到画布后 不显示组件

// toComponent   生成的新的组件 
[
    {
        "id": "e633899",
        "name": "combine",
        "x": 44.5,
        "y": 83.5,
        "ex": 520.5,
        "ey": 204.5,
        "width": 476,
        "height": 121,
        "center": {
            "x": 282.5,
            "y": 144
        },
        "children": [
            "fb35658",
            "669def0"
        ]
        
    },
    {
        "id": "fb35658",
        "name": "combine",
        "x": 0,
        "y": 0.24793388429752067,
        "ex": 0.7331932773109243,
        "ey": 1,
        "width": 0.7331932773109243,
        "height": 0.7520661157024794,
        "center": {
            "x": 454.5,
            "y": 192.5
        },
        "children": [
            "7c352c28",
            "1631dd95"
        ],
       
        "parentId": "e633899",
        "lineWidth": 1,
        "fontSize": 12,
        "lineHeight": 1.5,
        "anchors": [],
        "rotate": 0,
        "locked": 2
    },
    {
        "id": "669def0",
        "name": "combine",
        "x": 0.2668067226890756,
        "y": 0,
        "ex": 1,
        "ey": 0.7520661157024794,
        "width": 0.7331932773109243,
        "height": 0.7520661157024794,
        "center": {
            "x": 454.5,
            "y": 192.5
        },
        "children": [
            "20a03fd",
            "0991647"
        ],
        
        "parentId": "e633899",
        "lineWidth": 1,
        "fontSize": 12,
        "lineHeight": 1.5,
        "anchors": [],
        "rotate": 0,
        "locked": 2
    }
]
//拖拽到画布后  新组件的子组件的children为空 
const onDragStart = (e, data) => {

  e.dataTransfer.setData('Topology', JSON.stringify(deepClone(data)))
}



image

Originally posted by @Blizzard-liu in #46 (comment)

topology.active(pens);

调用这个api会报错:如下
react-dom.development.js:4091 Uncaught TypeError: Cannot set properties of undefined (setting 'active')
at eval (canvas.ts:2505)
at Array.forEach ()
at Canvas.active (canvas.ts:2504)
at Topology.active (core.ts:861)
at handleSelectedNode (CanvasNodes.tsx:36)
at onClick (CanvasNodes.tsx:49)
at HTMLUnknownElement.callCallback (react-dom.development.js:3945)
at Object.invokeGuardedCallbackDev (react-dom.development.js:3994)
at invokeGuardedCallback (react-dom.development.js:4056)
at invokeGuardedCallbackAndCatchFirstError (react-dom.development.js:4070)

源码:
this.store.active = [];
pens.forEach(function (pen) {
pen.calculative.active = true;
(0,pen__WEBPACK_IMPORTED_MODULE_22_.setChildrenActive)(pen);
});

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.