zoomOut method

void zoomOut()

Decreases the magnification of the plot area.

Implementation

void zoomOut() {
  final RenderBehaviorArea? parent = parentBox as RenderBehaviorArea?;
  if (parent == null) {
    return;
  }

  parent.hideInteractiveTooltip();
  final RenderCartesianAxes? cartesianAxes = parent.cartesianAxes;
  if (cartesianAxes == null) {
    return;
  }
  _isZoomIn = false;
  _isZoomOut = true;
  // TODO(YuvarajG): Need to have variable to notify zooming inprogress
  // _stateProperties.zoomProgress = true;
  RenderChartAxis? child = cartesianAxes.firstChild;
  while (child != null) {
    if ((child.isVertical && zoomMode != ZoomMode.x) ||
        (!child.isVertical && zoomMode != ZoomMode.y)) {
      if (child.controller.zoomFactor < 1.0 &&
          child.controller.zoomFactor > 0.0) {
        _updateZoomFactorAndZoomPosition(child);
        child.controller.zoomFactor = child.controller.zoomFactor > 1.0
            ? 1.0
            : (child.controller.zoomFactor < 0.0
                ? 0.0
                : child.controller.zoomFactor);
      }
      if (parent.onZooming != null) {
        _bindZoomEvent(child, parent.onZooming!);
      }
    }
    final CartesianAxesParentData childParentData =
        child.parentData! as CartesianAxesParentData;
    child = childParentData.nextSibling;
  }
  (parentBox as RenderBehaviorArea?)?.invalidate();
}