Quantcast
Channel: GoJS - Northwoods Software
Viewing all articles
Browse latest Browse all 7069

What is the idiomatic way to turn off selective animations?

$
0
0

@Charles wrote:

I’m curious what the intended way is to disable specific animations for something like subgraphs expanding/closing?

I found this snippet in the AnimationManager api, but unless I misunderstand how the animationReasons api is supposed to work, this doesn’t seem like it would do what it says it does.

myDiagram.animationManager.canStart = function(reason) {
    if (this.animationReasons.contains("Expand Tree")) return false;
    return true;
}

I was under the impression that animationReasons was basically an immutable enum property of animation manager that enumerates all possible reasons, so wouldn’t it always contain “Expand Tree”?

I tried to write something like both this (both in the same canStart override):

var disabledAnimations = ["Expand SubGraph", "Collapse SubGraph"];
if (disabledAnimations.includes(reason)) 
    return false;
return true;

and

if(this.animationReasons.contains("Expand SubGraph") || this.animationReasons.contains("Collapse SubGraph"))
    return false;
return true;

and neither seems to create the behavior I want (disabling the “slide in” animation on subgraph expand/collapse).

I can just disable the animation manager entirely and then I see the expand/collapse instantly like I’d like, but I lose the zoomToRect animations that I’d like to keep.

Am I misunderstanding the way to disable animations?

Posts: 11

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 7069

Trending Articles