Closed rafaelekol closed 6 years ago
Can you tell which version of the fresco library are you using? The behavior you're describing is the default one. I need to know your version of use to suggest how you can overwrite the controller or the view to achieve you goal.
Fresco version is latest, 0.9.0
In ZDV, you can see
@Override
public boolean onTouchEvent(MotionEvent event) {
if (mZoomableController.onTouchEvent(event)) {
if (mZoomableController.getScaleFactor() > 1.0f) {
getParent().requestDisallowInterceptTouchEvent(true);
}
FLog.v(TAG, "onTouchEvent: view %x, handled by zoomable controller", this.hashCode());
return true;
}
FLog.v(TAG, "onTouchEvent: view %x, handled by the super", this.hashCode());
return super.onTouchEvent(event);
}
which disallow you to scroll to the previous or next page if zoom happened. So to achieve your goal, you'll need to subclass ZDV and override the onTouchEvent.
Thank you for help. It scrolls now zoomed image immediately. But I need scrolling only when image border reached. How can I accomplish this?
I actually don't understand what do you mean by "enable scroll only when image border reached". I suppose if you wanna enable scroll in limited occasions, you need to implement under onTouchEvent, and disallow scrolling by using getParent().requestDisallowInterceptTouchEvent(true); when in the occasions you define.
For example I zoomed image, and now I am see middle of zoomed image. Then I try to drag zoomed image to left to see left side of the image, but instead of dragging, it scrolls to next image. Thus I need to enable scrolling to next image only in case when my zoomed image reached its left or right border(end of the image). How I can check this?
Yeah, I understand what you mean. This is on our TODO list, but it is not the top-priority thing we have on our plate at the moment and therefore we can not promise when will this be implemented.
OK, noted
I actually found some time and sent a pull request. ZoomableDraweeView should work just fine in ViewPager.
This should have been fixed already, take a look at the sample app here: https://github.com/facebook/fresco/tree/master/samples/zoomableapp There's even a toggle now to select what behaviour you want: swipe to next image when zoomed or stay at current image.
I am using PagerView with images showed in ZoomableDraweeView. When image not zoomed it scrolls to next without problem, but when I zoom the image its not scrolling to the next image.