You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Feb 24, 2019. It is now read-only.
where 0.9 is the "give" or "leeway" so that the image can zoom out a little.
Image Scrolls out of Viewport. I fixed this in the Horizontal direction, but not the vertical. In the same function, I changed:
// Ensure that item under the focal point stays in the same place despite zooming
final Offset normalizedOffset =
(_startingFocalPoint - _previousOffset) / _previousZoom;
Offset newOffset = d.focalPoint / _scale - normalizedOffset * _zoom;
setState(() {
_zoom = newZoom;
_offset = newOffset;
});
}
to this:
// Ensure that item under the focal point stays in the same place despite zooming
final Offset normalizedOffset =
(_startingFocalPoint - _previousOffset) / _previousZoom;
Offset newOffset = d.focalPoint / _scale - normalizedOffset * _zoom;
// Out of Bounds X]
double give = 20.0;
if (newOffset.dx > give/_scale)
newOffset = newOffset.scale(0.0, 1.0).translate(give/_scale, 0.0);
else if (newOffset.dx*_scale + size.width*_zoom < size.width - give)
newOffset = newOffset.scale(0.0, 1.0).translate((size.width - size.width*_zoom - give)/_scale, 0.0);
setState(() {
_zoom = newZoom;
_offset = newOffset;
});
}
Here the variable "give" is the padding around the picture when it moves to its extreme right or left. Feel free to incorporate this into your code. No attribution or anything necessary. Sorry I couldn't do any fancy animations, but maybe you can figure it out.
The text was updated successfully, but these errors were encountered:
The user is able to zoom out until the image disappears. This fixed it for me:
I changed:
to:
where 0.9 is the "give" or "leeway" so that the image can zoom out a little.
Image Scrolls out of Viewport. I fixed this in the Horizontal direction, but not the vertical. In the same function, I changed:
to this:
Here the variable "give" is the padding around the picture when it moves to its extreme right or left. Feel free to incorporate this into your code. No attribution or anything necessary. Sorry I couldn't do any fancy animations, but maybe you can figure it out.
The text was updated successfully, but these errors were encountered: