Hello, in this video I am going to show you the pan gesture. So the pan gesture is very similar to the horizontal and vertical drag it basically combines them. So if for example, you have an image and you want to be able to put your finger on the screen and drag it around, so maybe no you have a separate gesture for zooming in on the image. Once you've zoomed in, you can't see your image. So you want to be able to pan it not just vertically or horizontally but in both direction. This is very common in you know, image gallery apps, whether it's Google Photos, whether it's you know even on Facebook or Twitter, when you have an image, you open it up for zoom in you want to you know, look at some detail on it.
You can't see all the images anymore CV you zoom out or you pan so this is what this is really useful for. For the pan gesture. If you've done a horizontal if you've I mean if you watch the horizontal and vertical drag videos, this will feel waste of time. If you haven't I highly recommend that you watch those two first, because this is no sort of building on top of some of that, but I'm gonna start from scratch, but he will help if you watch them as well. So to do it, you need to create a child detector. And then here you put the child or the widget itself as a child that you want the pan gesture to be attached to, then you put on pan and a few different ones.
So this arm pan star cancel down and update the only two that I'm going to implement in this one case stop but the process is the same for all of them. So start and this has drag DOD detailed details here. up to date, and I'm going to start so it's meant to be the variable not a strength that was saved. Reload. So if I click here, as you can see, we say started if you just on the click is given the coordinates relative to the towards myself is closer to the left edge is closer to, you know, being zero probably can't quite get it at zero close, you know, trying to move to slightly less than a logical pixel is very difficult. And as you can see, so if we want to actually detect the drug, we need the update method.
So if we copy and paste this, so instead of on plants.on, the on update, this needs to be dragged update details, and I'll change this to update. Well, if I save that, and I reload, if I click in the middle of this image, right there, and if I drag it, as you can see we are getting different values over dragging left and right. It's mainly only affecting the Dragon's Den mainly only the white belly for dragon in like any dark We all get in and find using the x add y. So, again, I recommend you watch the vertical and horizontal drag videos to explain more about significance of the minus the direction. And you know, the, the actual, you know, difference in values. large value just means a faster drag.
That's really all there is. flatly that's all you have to do to detect when you pan on a particular widget. We're all wanting you to do as an extra task is implemented over time method. So that's down and and cancel. And I want you to try and figure out how to get the individual values for the x and y pan on the real goofy do dot you can get some of its properties. But if you have any questions, feel free to pop me a message.
And as usual, I look forward to seeing you in the next video.