canStart method

bool canStart(
  1. String reason
)

This method is passed the reason a default animation is to begin, and must return true or false based on whether or not the animation is to be allowed. Returning true means the animation will occur, returning false will stop the animation's setup.

By default, this method always returns true. Setting this to a function that always returns false will disable all default animations, but allow other animations, such as AnimationTriggers, to run.

These are the possible reasons GoJS will begin an animation:

Called by CommandHandler:

  • "Collapse SubGraph"
  • "Expand SubGraph"
  • "Collapse Tree"
  • "Expand Tree"
  • "Scroll To Part"
  • "Zoom To Fit" Called by Diagram:
  • "Model"
  • "Layout" Called by AnimationTriggers:
  • "Trigger"

Example usage:

// disallow expand/collapse animations, but allow all other default animations:
myDiagram.animationManager.canStart = function(reason) {
  if (reason === "Expand Tree") return false;
  return true;
}

// disallow all default animations:
myDiagram.animationManager.canStart = function(reason) {
  return false;
}

@param {string} reason Reason for starting the animation @return {boolean} @since 2.1

Implementation

_i2.bool canStart(_i2.String reason) => _i4.callMethod(
      this,
      'canStart',
      [reason],
    );