Drawflow icon indicating copy to clipboard operation
Drawflow copied to clipboard

Re-arrange nodes position to look better view

Open vnomohan opened this issue 2 years ago • 12 comments

Hi there, is there any function to re-arrange the nodes x,y position after user drag/drop in the canvas. So that there will be no overlapping nodes each other

second question, how to automatically adjust the zoom in /out of the nodes in the canvas so that it will fit into it

Note: just started exploring the angular2 with Drawflow...awesome Thanks.

vnomohan avatar Nov 02 '23 12:11 vnomohan

View:

  • #685
  • #721
  • #383

Form move canvas to node:

  • #88

jerosoler avatar Nov 02 '23 12:11 jerosoler

Thanks jerosoler ! We will check on this and get back to you.

Another quick question - is there any css to change the node shape - circle, hexagon or any others. And i dnt want all are same shapes, onlye certain nodes is required in that shapes.

vnomohan avatar Nov 03 '23 05:11 vnomohan

View this comment

  • https://github.com/jerosoler/Drawflow/issues/454#issuecomment-1154762914

jerosoler avatar Nov 03 '23 05:11 jerosoler

thanks for the reply. im trying with the circle for nodes.

Screenshot 2023-11-09 at 1 33 59 AM

found that it is break the css. also lagging. i want similar to the other node. like border circle and inside circle div different color. Also specific nodes required the connector different color. example 5 main nodes connector is orange. 3 subnode connector with purple color. So that it will be easier to differentiate which is main and subnode.

vnomohan avatar Nov 08 '23 17:11 vnomohan

Example with circle node:

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8" />
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  <title>Document</title>
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/jerosoler/Drawflow/dist/drawflow.min.css" />
  <script src="https://cdn.jsdelivr.net/gh/jerosoler/Drawflow/dist/drawflow.min.js"></script>
  <style>
    #drawflow {
      position: relative;
      width: 100%;
      height: 800px;
      border: 1px solid red;
    }

    .drawflow-node.round {
      border-radius: 50%;
      width: 100px;
      height: 100px;
      box-shadow: 2px 2px 2px 1px rgba(0, 0, 0, 0.2);
    }

    .drawflow-node.orange {
      background-color: orange;
    }

    .drawflow-node.orange .outputs .output { 
      background: orange;
    }
  </style>
</head>
<body>
  <div>
    <div id="drawflow"></div>
  </div>
  <script>
    var id = document.getElementById("drawflow");
    const editor = new Drawflow(id);
    editor.start();
    editor.addNode('round', 1, 1, 50, 25, 'round orange', {}, 'Round');
  </script>
</body>
</html>

jerosoler avatar Nov 08 '23 19:11 jerosoler

Thank you so much ! great app and great support!

vnomohan avatar Nov 10 '23 06:11 vnomohan

hi jerosoler,

i have implemented theme changes accordingly for user taste. the themes can be changed and the nodes colors are changing. however the node connector seems not joined properly whenever change the themes.

i need to drag or move the node upper a bit or down to make it connect correctly. Please let me know how to handle this situation.

after theme changed Screenshot 2023-11-23 at 1 24 41 AM

after moved a bit the nodes, the connector sit in correcti position. Screenshot 2023-11-23 at 1 29 22 AM

vnomohan avatar Nov 22 '23 17:11 vnomohan

anyone?

vnomohan avatar Nov 25 '23 13:11 vnomohan

Force update conections with:

editor.updateConnectionNodes('node-4');

jerosoler avatar Nov 26 '23 15:11 jerosoler

yes above is what i have done initially. but no different.

`theme(styleName: any): void { const head = this.document.getElementsByTagName('head')[0] as HTMLHeadElement; let themeLink = this.document.getElementById('workflow-theme') as HTMLLinkElement; let cssFileNm = styleName.toLowerCase();

    if (themeLink) {
        themeLink.href = `assets/workflow/css/${cssFileNm}.css`;
    } else {
        const style = this.document.createElement('link') as HTMLLinkElement;
        style.id = 'workflow-theme';
        style.rel = 'stylesheet';
        style.type = 'text/css';
        style.href = `assets/workflow/css/${cssFileNm}.css`;
        head.appendChild(style);
     }

    this.editor.updateConnectionNodes("node-1");
    this.editor.updateConnectionNodes("node-2");
    this.editor.updateConnectionNodes("node-3");
    this.editor.updateConnectionNodes("node-4");

    this.currentTheme = styleName;
}`

vnomohan avatar Nov 27 '23 02:11 vnomohan

Try with a settimeout, the new style may not be loaded yet.

Others problems with style:

  • https://github.com/jerosoler/Drawflow/issues/708

jerosoler avatar Nov 27 '23 14:11 jerosoler

omg how im missed this...timeout...you are the saviour ! thanks man!

vnomohan avatar Nov 27 '23 14:11 vnomohan