-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
fix(android): allow image to drag horizontally inside a ScrollableView #14227
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
fix(android): allow image to drag horizontally inside a ScrollableView #14227
Conversation
Not tested it but yes: you should be able to swipe the image instead of going to the next page. I use this module https://github.com/iotashan/TiTouchImageView and when you zoom in you can move the image and if the zoomed image is fully moved to the right it will swipe to the next page when you drag it again. Bildschirmaufnahme_20250515_122534.mp4This would be the ideal solution |
This is the reason we moved to use the inbuilt ImageView to have less maintenance onwards. We can improve the gesture handling anyways in the SDK itself. But this PR will at least allow the drag on zoomed image properly. |
totally agree! Just saw your PR in the module, nice. I didn't have any crash with it...I think I was using a custom version already 😄 But having not to use the module for it would be better of course. I'll check the PR soon |
First feedback: I've created an example: var win = Ti.UI.createWindow();
var view1 = Ti.UI.createView({ backgroundColor:'#123' });
var view2 = Ti.UI.createView({ backgroundColor:'#246' });
var view3 = Ti.UI.createView({ backgroundColor:'#48b' });
var img = Ti.UI.createImageView({
image:"https://picsum.photos/1000/2000",
enableZoomControls:true,
width: Ti.UI.FILL,
height: Ti.UI.FILL,
})
view1.add(img);
var scrollableView = Ti.UI.createScrollableView({
views:[view1,view2,view3],
showPagingControl:true
});
win.add(scrollableView);
win.open(); and it works as described: once I'm zoomed in I can move the image but will stay in the current slide. But the pinch gesture is not very reliable (not your fault, it has been like this before!) when you let go and zoom for a second time. Especially trying to zoom out fully - without the double click - to be able to swipe the page again is very difficult. |
@m1ga I believe we can go ahead with this version and fine tune it in further updates. What do you suggest? Edit: I improved the pinch-to-zoom a bit today, will continue improving it. |
improved swiping sounds great! I still think there should be a property to disable it again. Otherwise we'll remove a existing mechanism and people can't go back to it when they use it like this. I don't mind it being enabled by default but there should at least be a way to switch to the current behavior for people who just want to use to fingers to zoom and move and one finger for scrolling the slides. |
@m1ga I will try to summarise the issue again, as it sounds confusing! With
Apart from below two improvements, I feel the PR is fine:
|
If that is in the PR then it would be awesome and cover all cases 👍 Then we don't need a property. My only concern before is that the current PR removes the "swipe horizontal even when zoomed in to swipe the ScrollableView" functionality and don't have an option to get that back user might not want to update if they use that. |
@m1ga The double tap area is fixed along-with the smooth zooming. However, the below concern you highlighted was actually a bug earlier 😄 which is also fixed in this PR. Please give this PR a try and let me know if it's fine to go ahead as discussed. Edit: This PR only improves the existing issues, and does not strip away any existing features.
|
Fix: When zoomed in, an
ImageView
withenableZoomControls: true
cannot be dragged horizontally inside aScrollableView
. However, it can be dragged in any direction other than horizontally since aScrollableView
intercepts the horizontal gesture to swipe left/right.I believe when an image is zoomed in, users would ideally want to drag it, rather than changing the swipe-able pages.
Or should we allow a new property to let users swipe left/right even when zoomed in?