Latest Thunkable for Android releases (Pinch to scale on Canvas)

Hey Thunkers,

Hope you are having a happy Friday. To get you started for the weekend, we have added the ability to scale up or down objects on a Canvas by pinching, one of the most intuitive gestures on a smartphone. We think this should enable even more interesting and powerful gaming and drawing apps.

Release notes are below and make sure to download the latest Thunkable companion app
Thunkable Release Notes

Next up for us on Android are Push Notifications and a native Floating Action Button -

Happy Thunking!
Albert on behalf of the team


Great work! Thank you very much!




great work @albert

I am sure, this is added by @tingc

1 Like

Is this based on Hal Abelson’s ScaleDetector extension?

1 Like

I think so.

Yes correct.

When using scale_factor to adjust the width and height of a non-square sprite, I’m finding that the sprite’s aspect ratio is getting slightly distorted each time it’s scaled down smaller than a certain size, until the smaller dimension approaches zero and the sprite disappears. I’m assuming this is a quirk of the whole-number nature of both pixel dimensions, meaning that when each dimension is multiplied by the five-decimal-place scale factor and then rounded to a whole pixel, the two dimensions gradually become out of sync with one another.

It might be helpful if we could set a locked aspect ratio for a sprite. But in the meantime, I have found that I can more or less work around this by allowing a sprite to scale down only if both dimensions are greater than a minimum pixel count (and again, I haven’t worked out the ideal minimum, but 100+ seems to be working for me right now).

Posting here because I would’ve been happy to find this info an hour ago. :rofl: Please advise if this is not an appropriate use of this forum topic—I’m new to Thunkable.

1 Like

When resizing proportionally, you can use this formula:

Only use the pinch to resize the width and calculate the height like this

sprite.height = ( original height / original width ) x new width

Indeed I did, but the issue persists.

ETA: I’m finding that even when I do set a bottom limit for the dimensions, the sprite will still distort if I pinch it big-medium-big-medium, so this is not at all a foolproof workaround. It does seem to slow the distortion process down a bit, though.

You are doing something wrong, because using that formula I have perfect proportional resizing. Can you post the blocks where you resize your sprite?

This is the separate app where I have been searching for a workaround (so as to rule out any other part of my app interfering). It only does this, and over the course of many resizings, the image gradually and consistently distorts. The nearer it is to square, the more times it takes.

@notkristina: You need to calculate the aspect ratio for the sprite in the beginning of your app, to make sure that value is not changed later in the app, like you are doing inside your Canvas.Scaled event.
Did you notice the red circle with a cross in your global oldWidth definition? That’s an error. It means you can’t assign that value in a definition. So that variable is empty at start.
Also I added the blocks you need to keep the sprite between 100 and 300 pixels wide, you change it to whatever you need there.


I am such a fool. I misread your equation the first time and went on thinking I knew what I was doing. Of course this will work. Thank you so much for your time and patience. Your solution will help lots of people, but first, me! :laughing:

I did not notice that red X, thank you for bringing it up. It didn’t especially matter what that variable was initialized to in this instance, but I wonder why that’s not an acceptable value.

1 Like

i used these blocks but whenever i pinch to zoom the sprite becomes invisible

Show your blocks.

This is NOT a support or discussion topic… Please create a new topic in the right category(e.g. Android Discussions) if you have problems :wink:

1 Like


It looks like it should work. How big the image assigned to your sprite is?