New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Flow diagram support #147

Merged
merged 3 commits into from Feb 11, 2018

Conversation

Projects
None yet
2 participants
@yngndrw
Copy link
Contributor

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

yngndrw added some commits Jan 24, 2018

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
@dylanvorster

This comment has been minimized.

Copy link
Contributor

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

This comment has been minimized.

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 Feb 11, 2018

@dylanvorster dylanvorster merged commit 6dc3a45 into projectstorm:links_refactor Feb 11, 2018

1 check passed

ci/circleci Your tests passed on CircleCI!
Details

@yngndrw yngndrw deleted the yngndrw:flow-diagram-changes branch Feb 28, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment