zoomIn method
void
zoomIn()
Increases the magnification of the plot area.
Implementation
void zoomIn() {
final RenderBehaviorArea? parent = parentBox as RenderBehaviorArea?;
if (parent == null) {
return;
}
parent.hideInteractiveTooltip();
final RenderCartesianAxes? cartesianAxes = parent.cartesianAxes;
if (cartesianAxes == null) {
return;
}
_isZoomIn = true;
_isZoomOut = false;
// TODO(YuvarajG): Need to have variable to notify zooming inprogress
// _stateProperties.zoomProgress = true;
bool? needZoom;
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) {
if (child.controller.zoomFactor - 0.1 < 0) {
needZoom = false;
break;
} else {
_updateZoomFactorAndZoomPosition(child);
needZoom = true;
}
}
if (parent.onZooming != null) {
_bindZoomEvent(child, parent.onZooming!);
}
}
final CartesianAxesParentData childParentData =
child.parentData! as CartesianAxesParentData;
child = childParentData.nextSibling;
}
if (needZoom ?? false) {
(parentBox as RenderBehaviorArea?)?.invalidate();
}
}