首页 > 解决方案 > jsPlumb 函数失败:TypeError:无法读取未定义的属性(正在读取“resetBounds”)

问题描述

当我添加类型为“Bezier”的连接器属性时,添加连接时会抛出

jsPlumb function failed : TypeError: Cannot read properties of undefined (reading 'resetBounds')
ERROR TypeError: Cannot read properties of undefined (reading 'canvas')
at BrowserJsPlumbInstance.setConnectorHover (jsplumb.browser-ui.es.js:4774)

我将以下属性添加到 addEndPoint

import {BezierConnector} from '@jsplumb/connector-bezier'
{
    endpoint: {
      type: DotEndpoint.type,
      options:{
        radius: 7
    }
    },
    paintStyle: { fill: '#99cb3a' },
    source: true,
    connector:{
      type:BezierConnector.type,
      options:{
        curviness:50
      }
    },
}

标签: angularjsplumb

解决方案


为了将来遇到此问题的人们的利益,该问题已在 Github 上进行了讨论,原因似乎是 jsPlumb 包的混合版本。

您必须使用相同版本的@jsplumb/connector-flowchartas@jsplumb/browser-ui等。理论上这是由包本身强制执行的;在这种情况下,不匹配是如何产生的还不清楚。


推荐阅读