Reset (or change Pivot of) an Image in ScrollRect when scaling down
I have a single image that is displayed inside a scrollRect.. pivot is centered and the user is able to scale the image up and down using a slider.. then he/she is able to scroll drag the image around (with the scrollRect functionality) like for example a page in a book-app.. but when the user scales the image up and drags it around and then scales it back down again, the page shrinks at its own pivot point and sometimes gabs are visible on the sides depending on where the user has dragged the image.. When you start to drag the image again it snaps to the correct location but it doesn't look very polished when you force a user to "nudge" something before it snaps into place..
does anybody know of a way to invoke the "nudge" after scaling? Or force the ScrollRect to calculate the position of the image after scaling? I tried using math and pivot points but since the position alters with both scaling and dragging I can't hardcode a value to change pivot points (like f.e. if x < -50 and y < -50 then the pivot point should be top right) ..
The simplest solution would be to invoke that little nudge the user has to do now but I don't know how I have to go about doing it (just changing the transform.positon.x in code doesn't work, the scrollRect needs to update its content)
Answer by dieterweireldt · Nov 27, 2017 at 10:33 AM
I tried adding some details using images so people can have a better understanding of my problem (don't worry about the placeholder graphics please :s)
Your answer
![](https://koobas.hobune.stream/wayback/20220612142451im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Scaling giant images as 2D Sprite 0 Answers
UI image dissapears when using localScale. 0 Answers
How To Change Which Edge Tiled Images Snap To? 0 Answers