Hi all,
I have what might be a simple question on image scrolling, but I have tried a number of approaches and can't get it working the way I would like.
I have a screen with a resolution of 640x1136. On this screen I place an image of 1900x900. The idea is that the user can swipe on the screen to scroll across the image. What I have tried ...
- Use a horizontal gallery, setting the width of the gallery to >1900, and the item within the gallery of a similar width. Doesn't work. The part of the image which is currently visible on screen (the initial 640 pixels) is repeated as I scroll. So the image appears corrupted. Scrolls beautifully though 🙂
If I limit the gallery to a single item (FirstN(gallery,1), i can see the full image in the power apps editor (not corrupted), but it doesn't scroll (even thought the item width is > 640).
Is it possible to have a horizontal gallery item width > screen width?
- Segment the image into smaller widths, and use a horizontal gallery, with each segmented part of the image placed in a separate item (of less than 640 pixels) within the gallery. Works, but alignment will be an issue as the final app has scale to fit enabled and the layout is slightly different on different devices as a result.
- Use an invisible slider control above the image, and tie the image X position to the slider value. Works, but it has two drawbacks.
1. Scroll is too fast, as I'm scrolling an image which is three times the width of the screen, using a slider control just under a single screen width
2. If the user touches the screen, they adjust the slider position and the image position 'jumps' as the image X position is tied to the slider value.
Ideally i want to measure the amount the slider has moved, and link that value to the Image X position, rather than the actual slider position.
I can set a variable to the initial slider value using the OnSelect property of the slider, then subtracting the current slider value from this initial value, I have the distance the slider moves. Great! But to support multiple swipes across the image, I need a running count of the total distance moved by the slider across multiple adjustments of the slider position, and this is where I am stuck.
I can use the OnChange property of the slider to update a variable with the total distance the slider has moved, but this only updates when the slider is released, but I need this variable updated as the slider is being moved.
Any ideas?