getNonCoveringZoomHorizontalTranslation method

  1. @protected
double getNonCoveringZoomHorizontalTranslation(
  1. double scale
)

Returns the translation to apply when the child is smaller than the viewport horizontally.

Implementation

@protected
double getNonCoveringZoomHorizontalTranslation(double scale) {
  switch (nonCoveringZoomAlignmentHorizontal) {
    case HorizontalNonCoveringZoomAlign.left:
      return 0;
    case HorizontalNonCoveringZoomAlign.middle:
      return (widgetViewport.width - (childBoundaryRect.width * scale)) / 2;
    case HorizontalNonCoveringZoomAlign.right:
      return widgetViewport.width - (childBoundaryRect.width * scale);
  }
}