pinch

How to keep an image inside the screen limits while using pinch zoom and drag gestures?

社会主义新天地 提交于 2019-12-03 07:32:41
I'm building an app that uses the pinch zoom and drag. The problem is that for now I can drag the picture out of it bounds. I wanted to know how can I use drag and make sure the image stays on the screen at the same time. Here is my code : public boolean onTouch(View v, MotionEvent event) { ImageView view = (ImageView)v; //handle touch events here. switch (event.getAction() & MotionEvent.ACTION_MASK) { case MotionEvent.ACTION_DOWN: savedMatrix.set(matrix); start.set(event.getX(), event.getY()); Log.d(TAG, "mode=DRAG" ); mode = DRAG; break; case MotionEvent.ACTION_POINTER_DOWN: oldDist =

How to do pinch gestures on the iPhone?

拜拜、爱过 提交于 2019-12-03 06:10:10
问题 How does one implement pinch gestures on the iPhone? I'm familiar with using touch events on the iPhone but I'm extremely lazy and don't want to re-invent the wheel for something as widespread as PINCH gestures...Source code or links thereto would be helpful. 回答1: You need to implement it yourself using some basic math. (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event; (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event; Those are the delegate methods that you need to

is possible to zoom in/out a UIImageView in custom cell of a UICollectionView only when pinch the cell's imageView?

混江龙づ霸主 提交于 2019-12-03 00:51:10
I have a CollectionView that have one custom cell. I want to zoom in/out imageView in cell, so i add pinch gesture at CollectionView.m when i add gesture to self.collectionView, like this: [self.collectionView addGestureRecognizer:pinchGesture]; it works! my cell.imageView can zoom in/out, but when i pinch other place(not in cell's imageView, my cell.imageView still zoom in/out with the gesture, I want the cell.imageView zoom in/out just when user pinch the cell.imageView, so i try to add gesture use this code: [cell.imageView addGestureRecognizer:pinchGesture]; but unfortunately it doesn't

How to do pinch gestures on the iPhone?

*爱你&永不变心* 提交于 2019-12-02 20:48:53
How does one implement pinch gestures on the iPhone? I'm familiar with using touch events on the iPhone but I'm extremely lazy and don't want to re-invent the wheel for something as widespread as PINCH gestures...Source code or links thereto would be helpful. Brock Woolf You need to implement it yourself using some basic math. (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event; (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event; Those are the delegate methods that you need to implement in your application. You need to get the distance between the two touches, then

How do you control pinch and zoom speed for a UISCrollview?

a 夏天 提交于 2019-12-02 15:42:34
问题 Pinch and zoom is way too violent of an animation need to turn it down a notch. 回答1: well i came up with this: since speed seems to be dependent on the min and max scroll speeds i kept them close to the min and max zooms every time it actually zooms using the uiscroll delegate - (void)scrollViewDidZoom:(UIScrollView *)scrollView { if(scrollView.multipleTouchEnabled){ CGFloat fSpeedZoom=.02; scrollView.maximumZoomScale=scrollView.zoomScale+fSpeedZoom; scrollView.minimumZoomScale=scrollView

How do you control pinch and zoom speed for a UISCrollview?

心已入冬 提交于 2019-12-02 07:35:45
Pinch and zoom is way too violent of an animation need to turn it down a notch. yeahdixon well i came up with this: since speed seems to be dependent on the min and max scroll speeds i kept them close to the min and max zooms every time it actually zooms using the uiscroll delegate - (void)scrollViewDidZoom:(UIScrollView *)scrollView { if(scrollView.multipleTouchEnabled){ CGFloat fSpeedZoom=.02; scrollView.maximumZoomScale=scrollView.zoomScale+fSpeedZoom; scrollView.minimumZoomScale=scrollView.zoomScale-fSpeedZoom; if(scrollView.maximumZoomScale>fMaxZoomScale) SV.maximumZoomScale=fMaxZoomScale

Firefox disable browser zoom but allow element zoom on pinch

被刻印的时光 ゝ 提交于 2019-12-01 11:24:37
I've got a site running aimed at touchscreens running Firefox (very specific I know, but it will hopefully help with a solution) On the page in question, I've got a d3 map that I'm trying to enable pinch zooming for, however any pinch gesture is causing Firefox to set the zoom for the whole page. Is there a way to prevent the page zooming and only allow the map to zoom? It's not an issue if I have to modify Firefox config settings but I'd prefer to avoid it and rely entirely on javascript if possible. Thank you in advance You might be able to do this using the viewport metatag and Hammer.js

Pinch to Zoom Google Maps API v3 Android Webkit

断了今生、忘了曾经 提交于 2019-12-01 09:09:32
问题 I am writing a webkit app, and i'm using google maps api v3. I tried it on a android phone (HTC Desire) but it dosen't pinch to zoom. Note, i don't want to pinch and zoom a web page I want to pinch to zoom a google map v3 map in a web view. Has anyone got this working on android? 回答1: It would appear that, currently, you cannot rely on being able to receive pinch-to-zoom events on Android browsers. Here it is in the Android issue tracker: http://code.google.com/p/android/issues/detail?id

Firefox disable browser zoom but allow element zoom on pinch

人盡茶涼 提交于 2019-12-01 08:17:44
问题 I've got a site running aimed at touchscreens running Firefox (very specific I know, but it will hopefully help with a solution) On the page in question, I've got a d3 map that I'm trying to enable pinch zooming for, however any pinch gesture is causing Firefox to set the zoom for the whole page. Is there a way to prevent the page zooming and only allow the map to zoom? It's not an issue if I have to modify Firefox config settings but I'd prefer to avoid it and rely entirely on javascript if

Limit maximum scale for scaling image with pinch gesture in IOS

 ̄綄美尐妖づ 提交于 2019-12-01 03:34:10
问题 I am currently able to make an image scale by using the pinch gesture recognizer provided by Apple, but how can I limit the maximum scale for the image? I have been using the SimpleGestureRecognizers sample from Apple, which sets the scale to 1, and makes it very easy to scale image, but when I remove it, it jumps suddenly, which is not nice. But then it is hard to track the scale since its alway set to 1. Thank you in advance. 回答1: UIKit will call your selector method many times for a single