Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Jan 25 20:15
    LuisEgan commented #746
  • Jan 20 16:16
    challamalla commented #799
  • Jan 15 00:46
    yuliolinares opened #917
  • Jan 13 13:49
    LiKaiChang commented #850
  • Jan 13 13:42
    LiKaiChang commented #850
  • Jan 13 13:39
    LiKaiChang commented #850
  • Jan 13 04:02
    HatWeight closed #910
  • Jan 06 12:44
    serjikus22 commented #375
  • Jan 06 08:56
    mengjie0320 commented #916
  • Jan 06 08:56
    mengjie0320 closed #916
  • Jan 06 08:56
    mengjie0320 commented #916
  • Jan 05 16:30
    carb synchronize #915
  • Jan 05 16:18
    carb synchronize #915
  • Jan 05 07:09
    mengjie0320 opened #916
  • Jan 04 17:31
    carb commented #915
  • Jan 04 17:31
    carb commented #915
  • Dec 30 2021 20:27
    danlobo synchronize #782
  • Dec 24 2021 01:24
    carb edited #915
  • Dec 24 2021 01:13
    carb opened #915
  • Dec 21 2021 15:41
    DaSilvaRemi commented #914
marcosaso
@marcosaso
Captura de Tela 2021-09-20 às 20.51.05.png
Captura de Tela 2021-09-20 às 20.35.13.png
Captura de Tela 2021-09-20 às 20.36.51.png
These images above is about that issue.
marcosaso
@marcosaso
It is also showing in issue #642: projectstorm/react-diagrams#642
Kuba Szymanowski
@KKSzymanowski
Is there a built-in way to edit nodes (the name for example) or do I have to implement it manually?
If there is no way to do it out of the box, is there some example of how to extend a node to add for example an edit button or a button to add new port?
marcosaso
@marcosaso

Hey @KKSzymanowski ,

To edit nodes, you've to implement it manually. Just put a edit and use the onChange event. For example:

onChange={(e) => {
                             // node receive value of edit
                              node_example.options.name = e.target.value;
                             // refresh diagram with new node name
                              engine.repaintCanvas();

                            }}
donkeyDau
@donkeyDau

I'm using dagre to distribute the nodes in the diagram. I randomly place the nodes and "autodistribute" them:

import {
  DagreEngine,
  PathFindingLinkFactory,
} from '@projectstorm/react-diagrams';

import centerModel from '../Actions/centerModel';

const reroute = (engine) => {
  engine
    .getLinkFactories()
    .getFactory(PathFindingLinkFactory.NAME)
    .calculateRoutingMatrix();
};

const autoDistributeNetwork = (engine, useGraphOptions = true) => {
  const graphOptions = useGraphOptions
    ? {
        rankdir: 'TB',
        ranker: 'longest-path',
        marginx: 50, // margin of whole diagram
        marginy: 50, // margin of whole diagram
        nodesep: 200, // minimum x distance between nodes
        ranksep: 100, // minimum y distance between nodes
      }
    : {};

  const distributionEngine = new DagreEngine({ graph: graphOptions });

  distributionEngine.redistribute(engine.getModel());
  reroute(engine);
  centerModel(engine);
};

Additionally I have a sidebar which can pull in from the side and shrinking the canvas. On this action the nodes on the diagram "crumble" together in the state they used to have before "autodistribution" kicked in. And it keeps in this state. Calling autoDistributeNetwork has no effect on the layout. Even dragging and dropping has no (coordinated) effect (the nodes get picked randomly and dropped at weird places).

Does anyone encounter this problem as well? How can I get around this?

1 reply
Aymen Marouani
@AymenMarouani
Hi All,
Aymen Marouani
@AymenMarouani

Simple question, I'd like to ask about the property added to DiagramWidget called inverseZoom to inverse the behavior of the mouse's zoom wheel(see projectstorm/react-diagrams#95): actually, I'm using CanvasWidget which came after DiagramWidget with a react-diagrams version 6.5.2 as following `

<CanvasWidget  engine={engine}/>

Does any one have an example of how to add the property inverseZoom to work with (code please) ?
Thanks in advance.

1 reply
sudha53633
@sudha53633
Hi There, I need help on adding html content in nodes and ports
Can anyone provide inputs on this ?
sudha53633
@sudha53633
Thanks
projectstorm/react-diagrams#27 Kindly help here?
Aaron Michaux
@aaron-michaux

So... when I add repaintDebounceMs to the engine options, it sometimes disables panning the CanvasWidget.

  const engine = createEngine({
    registerDefaultDeleteItemsAction: false,
    repaintDebounceMs: 50
  })

Anyone else seen this?

Aaron Michaux
@aaron-michaux
For anyone out there, the problem went away when I patched engine.repaintCanvas, so that debouncing happens on the leading edge of the timeout.
Sinan Yaman
@sinanyaman95
Hey fellow developers, does anyone know if there is a way to get the ids of the visible ports (i.e. not zoomed out or dragged out of view from canvas)?
MNewbigging
@MNewbigging
Hey folks, I'm just getting started with react-diagrams. I'm following the demo project for custom node widget/model/factory. I've written a custom node model, extending NodeModel, and in overriding the deserialize function I'd like to provide the type for the event parameter - but auto imports aren't working for some reason. So, where can I import the DeserializeEvent from? And should I use it like this:
deserialize(event: DeserializeEvent<CustomNodeModel>) {...}
Malav Shah
@malavshah-9
Hi Guys, I have integrated this lib in my project which builds using vite and is monorepo. Now facing issue in building production build.
Any help will be appreciated. Thanks in advance.
Saintcat617
@Saintcat617_gitlab
your problem is when trying to assign null the variable in your declaration, try:
var node: DefaultNodeModel;
I'm sure it will work for you!
Andrii Zhyvchyn
@azhyvchyn-rr
hi all!
Does someone know how I can change target port with mouse?
I tied to .setTargetPort(null) on link, but this not attach link to mouse movements
K Wood
@kristopher-wood
Hello everyone!
I'm trying to get the diamond node model demo working, but it gives me an error using it as written when running it through create-react-app's npm start script
Error: Cannot find factory with type [diamond]
More specifically I'm trying to use this with the drag and drop demo, and I've got it showing up in the tray on the left hand side, but when I drag it on to the canvas I get the error
How do you let your app know how to find the factory for it?
K Wood
@kristopher-wood
Got it! Instead of defining engine as new CreateEngine, I needed to use this.props.app.getDiagramEngine()
Aaron
@a3ng7n
Hey there - it seems like the repo has quite a few open issues and hasnt been updated in 20 days - is this project dying? Not trying to be negative, but is project storm working on this anymore?
Dylan Vorster
@dylanvorster
i work on it when i get time
I have a project coming up shortly that will see it have some activity soon
Jeremy Kuhnash
@jeremykuhnash
does anyone have working directions on how to build a standalone project?