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

Specifying a no-effect zoom animation causes an error #2614

Closed
aryoxp opened this issue Jan 28, 2020 · 0 comments
Closed

Specifying a no-effect zoom animation causes an error #2614

aryoxp opened this issue Jan 28, 2020 · 0 comments
Labels
bug A bug in the code of Cytoscape.js
Milestone

Comments

@aryoxp
Copy link

aryoxp commented Jan 28, 2020

Issue type

Bug report

Environment info

  • Cytoscape.js version : 3.13.0
  • Browser/Node.js & version : Google Chrome 79

Current (buggy) behaviour

Animating elements using a zoom configuration object to which the graph will be animated causes cytoscape JS to error, using the following script:

cy.animate({
   'zoom': {
     level: 1.0
    }
});

On the browser console, the error is something like:

Uncaught TypeError: Failed to construct 'OffscreenCanvas': Value is not of type 'unsigned long'.
at m.el.makeOffscreenCanvas (cytoscape.min.js:23)
at ys.ms.addTexture (cytoscape.min.js:23)
at y (cytoscape.min.js:23)
at ys.ms.getElement (cytoscape.min.js:23)
at m.drawCachedElementPortion (cytoscape.min.js:23)
at m.Bs.drawCachedElement (cytoscape.min.js:23)
at m.Bs.drawCachedElements (cytoscape.min.js:23)
at m.Bs.drawLayeredElements (cytoscape.min.js:23)
at m.qs.render (cytoscape.min.js:23)
at n (cytoscape.min.js:23)`

However, it is working properly when I animate using:

cy.animate({
   'zoom': 1.0
});

no matter how many times I execute the animate function.

Desired behaviour

Whether using any of those parameters, both animation should behave the same.
Actually, what I need to accomplish is to animate camera zoom to a particular node position, however, when I animate using a zoom configuration object, Cytoscape JS raises an error, hence the script immediately stop.

Minimum steps to reproduce

Run the following fork:
https://jsbin.com/qocuzim/1/edit?html,css,js,console,output

Clicking Button 1 everytime should not raises any error
Clicking Button 2 after the first zoom animation is completed will raise error.

@maxkfranz maxkfranz changed the title Possible bug on cy.animate() function using a zoom configuration object to which the graph will be animated Specifying a no-effect zoom animation causes an error Jan 31, 2020
maxkfranz added a commit that referenced this issue Jan 31, 2020
… `{ level: 1 }` if an invalid zoom level is specified. The application of a zoom animation to the current zoom level is invalid. For example, animating from zoom:1 to zoom:1 doesn't make sense.

When there is a case of an invalid zoom animation, the entire `zoom` animation value is discarded.  This voids the animation.

In the easing application routine, there is now an extra check for equal start and end values.  While this does not affect the code path for the zoom:1 to zoom:1 example, it adds an extra layer of safety.

Ref : Specifying a no-effect zoom animation causes an error #2614
@maxkfranz maxkfranz added this to the 3.13.1 milestone Jan 31, 2020
@maxkfranz maxkfranz added the bug A bug in the code of Cytoscape.js label Jan 31, 2020
maxkfranz added a commit that referenced this issue Feb 7, 2020
… `{ level: 1 }` if an invalid zoom level is specified. The application of a zoom animation to the current zoom level is invalid. For example, animating from zoom:1 to zoom:1 doesn't make sense.

When there is a case of an invalid zoom animation, the entire `zoom` animation value is discarded.  This voids the animation.

In the easing application routine, there is now an extra check for equal start and end values.  While this does not affect the code path for the zoom:1 to zoom:1 example, it adds an extra layer of safety.

Ref : Specifying a no-effect zoom animation causes an error #2614
maxkfranz added a commit that referenced this issue Feb 7, 2020
… `{ level: 1 }` if an invalid zoom level is specified. The application of a zoom animation to the current zoom level is invalid. For example, animating from zoom:1 to zoom:1 doesn't make sense.

When there is a case of an invalid zoom animation, the entire `zoom` animation value is discarded.  This voids the animation.

In the easing application routine, there is now an extra check for equal start and end values.  While this does not affect the code path for the zoom:1 to zoom:1 example, it adds an extra layer of safety.

Ref : Backport 3.12.x : Specifying a no-effect zoom animation causes an error  #2625 #2614
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A bug in the code of Cytoscape.js
Projects
None yet
Development

No branches or pull requests

2 participants