Zoom with easing

Is there a provided way to zoom in/out (or even zoom-to-fit) with an easing function of a given timeframe?

I can implement this myself manually, but a provided way would be nice. :-)

Thanks.

Yes, I believe that would be easy for us to implement by calling an undocumented method of AnimationManager. Give us some time to look into it.

Awesome, I appreciate it!

If you want users to double-click on a Node in order to center on it and automatically zoom to the default Diagram.scale, try this event handler on your Node template(s):

    myDiagram.nodeTemplate =
      $(go.Node, . . .
        { 
          doubleClick: function(e, node) {
            e.diagram.animationManager.prepareAutomaticAnimation("zoomToRect");
            e.diagram.commandHandler.resetZoom();
            e.diagram.centerRect(node.actualBounds);
          }
        },
        . . .

I believe changing the easing function hasn’t been exposed yet in the API, even undocumented.

It’s been some years since we’ve touched animation issues, and if we want to expose more of the API, things may change incompatibly.

Okay, thanks. I’ll give this a shot.

What does prepareAutomaticAnimation do? This is an undocumented method.

Magic?? That’s why it’s undocumented.

Perfect! Just what I needed. :-)