Skip to content
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

Issue with cytoscape-edgehandles , wrong handlePositions #47

Open
mafar opened this issue May 27, 2020 · 5 comments
Open

Issue with cytoscape-edgehandles , wrong handlePositions #47

mafar opened this issue May 27, 2020 · 5 comments
Labels

Comments

@mafar
Copy link

mafar commented May 27, 2020

Dear Devs,
I am using cytoscape-grid-guide && cytoscape-edgehandles together.
Even though I have set handlePosition: "middle top", in cy.edgehandles but
handles are displayed at wrong position on hover, node selected.

  1. If i disable cy.gridGuide() , cy.edgehandles seem to work fine
  2. Node size and grid spacing seem to effect this behaviour too. Node size width,height 80,80 and grid spacing 100 would yield different handle position
  3. For very first time when i hover on node, handlePosition, appears at node center while i set it as handlePosition: "middle top", in cy.edgehandles

Code Pen Demo:
https://codepen.io/mafar/pen/JjYqvVp?editors=0010

ISSUE (Animated GIF):
See how handlePosition, offsets
bug
**ISSUE , First Hover node , handlePosition, appears at node center **

sss

@mafar mafar changed the title [BUG] issue with cytoscape-edgehandles , weird handlePositions [BUG] issue with cytoscape-edgehandles , wrong handlePositions May 27, 2020
@hasanbalci
Copy link
Contributor

@mafar It needs further investigation, but my first observation is that this problem doesn't occur when snapToGridOnRelease option is set to false. You can try this until the real reason of the issue is found and the issue is fixed if this option isn't necessary for your case.

@mafar
Copy link
Author

mafar commented May 29, 2020

@hasanbalci
snapToGridOnRelease :false works.
My guess is that extra node generated by edge handles also gets snapToGridOnRelease : true treatment

Providing an option in cytoscape.js-grid-guide to filter nodes like
handleNodes: 'node', // selector/filter function for whether edges can be made from a given node
from cytoscape.js-edgehandles wil lbe helpful here which can be called internally to skip node generated by edge-handles so that they dont get treatment of geometricGuidelines and snapping from cytoscape.js-grid-guide

handleNodes: 'node', can be good option to provide as some other plugins may also generate extra nodes and someone would want them to skip grid options like snapping, geometricGuidelines etc provided by this plugin.

@mafar
Copy link
Author

mafar commented May 29, 2020

it seems following must be added

if (cyTarget.hasClass('eh-handle') ||cyTarget.hasClass('eh-ghost')  ||cyTarget.hasClass('eh-ghost-node') ){
              return false;
}

at places like

  1. snap_during_drag.js
  2. snap_on_release.js
  3. resize.js
  4. alignment.js

So that edgesHandles Nodes dont receieve treatment from cytoscape.js-grid-guide

@mafar
Copy link
Author

mafar commented May 29, 2020

Dear Devs,
It will be helpful to have functionality of handleNodes option so that desired nodes can be filtered to avoid Snapping and resize by this plugin

//https://github.com/cytoscape/cytoscape.js-edgehandles/blob/master/cytoscape-edgehandles.js
  var userFilter = function userFilter(el) {
    return el.filter(options.handleNodes).length > 0;
  };

Becuase in my use case there are some parent Nodes that I dont want to snap to grid or resize.
Please this is a must have feature.

@ugurdogrusoz ugurdogrusoz changed the title [BUG] issue with cytoscape-edgehandles , wrong handlePositions Issue with cytoscape-edgehandles , wrong handlePositions Aug 24, 2020
canbax added a commit that referenced this issue Feb 11, 2022
@canbax
Copy link
Member

canbax commented Feb 11, 2022

@mafar Please check the new commit on the unstable version. It should work for your case

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants