jbouwh opened a new issue, #21894:
URL: https://github.com/apache/echarts/issues/21894

   ### Version
   
   6.1.0
   
   ### Link to Minimal Reproduction
   
   Paste in the [example 
editor](https://echarts.apache.org/examples/en/editor.html):
   
   ```js
   option = {
     animationDurationUpdate: 1000,
     series: [
       {
         id: 'graph',
         type: 'graph',
         layout: 'none',
         roam: true,
         // Nodes keep their size on zoom. 0 is read as 1, see below.
         nodeScaleRatio: 0.0001,
         symbolSize: 20,
         label: { show: true, position: 'right' },
         data: [
           { name: 'A', x: 0, y: 0 },
           { name: 'B', x: 100, y: 50 },
           { name: 'C', x: 100, y: -50 }
         ],
         links: [
           { source: 'A', target: 'B' },
           { source: 'A', target: 'C' }
         ]
       }
     ]
   };
   setTimeout(() => myChart.setOption({ series: [{ id: 'graph', zoom: 3 }] }), 
1000);
   setTimeout(() => myChart.setOption({ series: [{ id: 'graph', zoom: 1 }] }), 
3000);
   ```
   
   ### Steps to Reproduce
   
   1. Run the code above.
   2. Watch the nodes and their labels when the zoom changes after 1 s (1 → 3) 
and after 3 s (3 → 1).
   
   ### Current Behavior
   
   On the first frame of the zoom animation the nodes and their labels jump in 
size, then grow or shrink back during the animation: to a third of their size 
when zooming in from 1 to 3, and to three times their size when zooming out.
   
   `GraphView.render` animates the main group to the new view transform 
(`applyViewCoordSysTransToElement` with `updateProps`), but 
`_updateNodeAndLinkScale` right after it sets the node compensation 
(`calcCompensationScaleToPreserveNodeSize`) for the end of the animation at 
once. Until the group reaches its end transform, the compensation does not 
match it.
   
   ### Expected Behavior
   
   The node scale follows the animated view transform, so with a 
`nodeScaleRatio` near 0 the nodes keep their size during the animation, and 
with other ratios their size changes gradually.
   
   ### Environment
   
   ```markdown
   - OS: Windows 11
   - Browser: Chromium
   - Framework: Lit (web components)
   ```
   
   ### Any additional comments?
   
   The same happens for any graph with a view coordinate system whose `center` 
or `zoom` changes through `setOption` with animation on, also with the default 
`nodeScaleRatio` (0.6), only less visibly.
   
   A related detail: `calcCompensationScaleToPreserveNodeSize` reads 
`model.getShallow('nodeScaleRatio', true) || 1`, so a `nodeScaleRatio` of `0`, 
which the docs describe as nodes not scaling with the zoom at all, acts as `1`.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to