react-diagrams icon indicating copy to clipboard operation
react-diagrams copied to clipboard

Plain new diagram engine causes "Uncaught TypeError: Cannot read property 'x' of undefined"

Open marcojahn opened this issue 7 years ago • 1 comments

Hi,

initializing a fresh/empty engine without nodes causes an error.

Using Version: 6.0.1-beta.5

The solution in #214 does not work, because the method recalculatePortsVisually is not known.

Would appreciate any hint on this topic.

demo

import React from 'react';

import createEngine, { DiagramModel } from '@projectstorm/react-diagrams';

import { CanvasWidget } from '@projectstorm/react-canvas-core';

const engine = createEngine();
const activeModel = new DiagramModel();
engine.setModel(activeModel);

class ReactDiagramsComponent extends React.Component {
  render() {
    return (
      <div>
        <CanvasWidget className="diagram-container" engine={engine} />
      </div>
    );
  }
}

export default ReactDiagramsComponent;

marcojahn avatar Sep 18 '19 06:09 marcojahn

Instead of recalculatePortsVisually I tried, this.props.app.getDiagramEngine().repaintCanvas(); and it seemed to work.

horvay avatar Oct 29 '19 01:10 horvay