cytoscape.js-context-menus icon indicating copy to clipboard operation
cytoscape.js-context-menus copied to clipboard

Menu hide itself when zoom in graph

Open Nicolas-PredictaLab opened this issue 2 years ago • 1 comments

Hello,

image

I've a very long submenu under "Social" submenu and I've managed to set a height and a overflow-y : auto in CSS but whenever I scroll in the submenu, the graph itself if zooming and then, menu closed itself. Everything is 'normal' from what I've seen in the library code, but how to prevent this ? I see 2 ways :

  • Having a method that return a boolean whether or not the context-menu is shown, that boolean can then be used to disabled graph zoom for example.
  • Having the possibility to disabled auto close menu on zoom maybe ?

Thanks for feedbacks, Have a nice day.

Nicolas-PredictaLab avatar Jan 05 '23 09:01 Nicolas-PredictaLab

An hacky way if to do like this :

// Disable zooming when user open the submenu
cy.on('cxttap', () => cy.userZoomingEnabled(false))
// Enable it again when user tap or modify viewport
cy.on('tap viewport', () => cy.userZoomingEnabled(true))

Nicolas-PredictaLab avatar Jan 05 '23 10:01 Nicolas-PredictaLab