Skip to content

Conversation

@yngndrw
Copy link
Contributor

@yngndrw yngndrw commented Jan 24, 2018

Checklist

  • The code has been run through pretty yarn run pretty
  • The tests pass on CircleCI
  • You have referenced the issue(s) or other PR(s) this fixes/relates-to
  • The PR Template has been filled out (see below)

What?

  • Added a new demo showing off flow diagram usage
  • PortModel can now decide whether or not a link should be allowed (E.g. only allowing outputs to connect to inputs)
  • PortModel now has an optional maximum number of links - When set to 1 an existing link is returned by createLinkModel and when set to another finite number null will be returned when the maximum is reached
  • LinkModel has been updated to support the resetting of existing links (I.e. removing ports and removing mid-points)
  • DiagramWidget has been updated to handle null being returned by createLinkModel as well as an existing link (this also supports an existing link where the link's target port should now be the source port)
  • DiagramWidget has been updated to respect the PortModel's new canLinkToPort method
  • DiagramWidget has been updated to disallow duplicate links

There may some optimisation that could be done within the onMouseUp event of DiagramWidget, but I'm not best-placed to do that.

Also resolves issue #143.

I should note that the unit tests didn't pass before I started:

 FAIL  tests\1.test.tsx
  simple test
    × should drag a new link (377ms)
    × should drag a node (161ms)

  ● simple test › should drag a new link

    net::ERR_FILE_NOT_FOUND

      at navigate (node_modules/puppeteer/lib/Page.js:526:37)

  ● simple test › should drag a node

    net::ERR_FILE_NOT_FOUND

      at navigate (node_modules/puppeteer/lib/Page.js:526:37)

Why?

Better user experience in situations where you need to capture the flow from output nodes to input nodes.

How?

See above. ^

Feel-Good "programming lol" image:

LOL

- PortModel can now decide whether or not a link should be allowed (E.g. only allowing outputs to connect to inputs)
- PortModel now has an optional maximum number of links - When set to 1 an existing link is returned by createLinkModel and when set to another finite number null will be returned when the maximum is reached
- LinkModel has been updated to support the resetting of existing links (I.e. removing ports and removing mid-points)
- DiagramWidget has been updated to handle null being returned by createLinkModel as well as an existing link (this also supports an existing link where the link's target port should now be the source port)
- DiagramWidget has been updated to respect the PortModel's new canLinkToPort method
- DiagramWidget has been updated to disallow duplicate links
@dylanvorster
Copy link
Member

dylanvorster commented Jan 25, 2018

wow this is really good and theres a lot of awesome stuff here. Im just going to need some time to go through the changes, because Im currently in the process of refactoring a massive amount of the library (in the other open PR) and will probably need to do some additional refactoring. But honestly this is just pure awesome. Thanks so much.

@yngndrw
Copy link
Contributor Author

yngndrw commented Jan 25, 2018

Happy to help. Let me know if you need anything from me after you've gone through it.

@dylanvorster dylanvorster changed the base branch from master to links_refactor February 11, 2018 17:04
@dylanvorster dylanvorster merged commit 6dc3a45 into projectstorm:links_refactor Feb 11, 2018
@yngndrw yngndrw deleted the flow-diagram-changes branch February 28, 2018 11:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants