How to pinch in and out to zoom and scroll it as we normally do in images in cocos creator 2.4.10v

Hello team,
I am finding it difficult to add the feature of pinch guesture for cocos creator 2.4.10v, can anyone has solution for it?

I had tried with scaling up the target node according to the touch(when 2 touch is recognised), but finding difficult to move the target as the finger moves to certain point.

I need help in,

  • Moving the target node that needs to be zoomed according to finger(single touch) moves
  • Adding the boundary/limit so that the node does move away from visible area.
  • Reset the node while zooming out, After zooming(scaling) in and moving(setting the position according to touch) the node to finger touch.

Thanks in advance

OnMutiTouchInput.zip (184.6 KB)

Here is an example of multi-finger touch zoom for images, which you can import into your project for reference.

1 Like

Thanks for the example @zzf_Cocos . I need zooming start from the point of touch or from between the two touch points. How to do it?

Iā€™m not quite sure about your specific request. Do you have any demos or videos that can provide more context?

To be more specific, here according to example whenever we pinch in, it always zoom from images center points no matter which area we zoomed.

I need something works like zooming begins always from the center of touch points on the image.
I found this one posted in https://stackoverflow.com/questions/16112140/ios-pinch-zoom-an-image-centered-on-touches

This demo has already demonstrated the function of centering zoom.


Here in this video, first I try to zoom from center that is fine, then for second time when I try to zoom from border, it is zooming from center only, instead I wanted it look like I am zooming from border.
I there any other conditions to be checked for this feature.