Built in Multi-Touch Features

built in functions for pinch zoom, rotate etc.

That’s not multi-touch, that’s gesture.
You have to support them by your own.

https://github.com/britzl/defold-input supports gestures

4 Likes

I understand that I can implement pinch zoom etc by myself, I’m just suggesting it would be nice to have a built in function to turn it on/off and to set parameters without having to measure distances between touch points etc.

For example:

display.multitouch = true – > turn on multitouch if you are deployed to a touchscreen environment

display.minzoom = .75
display.maxzoom = 1.5
display.defaultzoom = 1
display.pinchzoom = true --> turn on pinch zooming with the default values

Just easier for users to implement out of the box.

The API you suggest can be implemented on top of the Defold API quite easily. You can use the Defold-Input extension and just a little bit of code:

go.property("minzoom", 0.75)
go.property("maxzoom", 1.5)
go.property("defaultzoom", 1)

function init(self)
	self.zoom = self.defaultzoom
end

function on_input(self, action_id, action)
	local g = gesture.on_input(self, action_id, action)
	if g and g.two_finger.pinch then
		self.zoom = vmath.lerp(g.two_finger.pinch.ratio, self.minzoom, self.maxzoom)
		msg.post("@render:", "use_fixed_projection", { zoom = self.zoom })
	end
end
4 Likes

Wow, thanks for the example, that looks pretty straight forward!