How to zoom the background image on the canvas ?

684 views
Skip to first unread message

john lewis

unread,
Mar 16, 2017, 11:09:52 AM3/16/17
to MIT App Inventor Forum
how to make pinch zoom on canvas without webviewer or html is it possible ? .thanks

SteveJG

unread,
Mar 16, 2017, 12:05:50 PM3/16/17
to MIT App Inventor Forum
There is no pinch event handler on a Canvas.    You could use a Touched or a TouchedDown or a TouchedUp or a Flung or a Dragged with some logic to replace the background image with a zoomed in or zoomed out version using IF then Else logic perhaps.

You can also zoom + or - the actual Canvas H and W.


Taifun

unread,
Mar 16, 2017, 3:44:43 PM3/16/17
to MIT App Inventor Forum

john lewis

unread,
Mar 17, 2017, 3:07:08 AM3/17/17
to mitappinv...@googlegroups.com
hi taifun and steve .i did a html image view it works and i try to add swipe between images but it doesn't work .these are the blocks can you check what wrong please
and this error shown "The operation - cannot accept the arguments: , [(file:///mnt/sdcard/AppInventor/assets/003.gif file:///mnt/sdcard/AppInventor/assets/004.gif)],"


Taifun

unread,
Mar 17, 2017, 10:29:29 AM3/17/17
to MIT App Inventor Forum
the imageindex should be a number and not a filenname
remember you only can add or subtract numeric values, but no texts...

btw, how should that work in the webviewer? if you only display an image, then how can you receive some kind of event (for example swipe left or right)?
see here how to do it using the canvas https://puravidaapps.com/snippets.php#2flung

my label example https://puravidaapps.com/label.php uses HTML/jQuery and the Hammer.js library, which is able to detect touch gestures ...

Taifun
Reply all
Reply to author
Forward
0 new messages