Cytoscape.js: wrong mouse position after changing container

I am using cytoscape.js 2.2.5 to draw a graph in an angular.js application, and I can select nodes correctly. When <div>moving the graph, the position of the mouse pointer on the canvas is not updated. This means that I have to click the "old" node position to select it.

I tried cy.reset(), cy.center()and cy.fit(), but the mouse is not changed.

How to update the chart after changing the position of the cytoscape <div>?

Original page:

enter image description here

After position change <div>

When I remove the blue panel and the chart <div>moves up, the position of the mouse pointer is incorrect. I am using the ng-show directive (which uses css hidden / visible). enter image description here

+4
1

( , ) cy div, . , DOM .

cy.resize(); // notify that the container has changed dims

http://cytoscape.imtqy.com/cytoscape.js/#core/viewport-manipulation/cy.resize

, cy.resize() cy.invalidateDimensions(), .

+3

Source: https://habr.com/ru/post/1539193/


All Articles