Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-28286] Android: Touch events should fire synchronously

GitHub Issuen/a
TypeImprovement
PriorityLow
StatusClosed
ResolutionUnresolved
Affected Version/sn/a
Fix Version/sRelease 9.3.1, Release 10.0.0
ComponentsAndroid
Labelsandroid, event, parity, touch
ReporterJoshua Quick
AssigneeJoshua Quick
Created2020-12-12T01:56:31.000+0000
Updated2021-01-19T18:48:43.000+0000

Description

*Summary:* The following view events should fire immediately like how it works on iOS... * touchstart * touchmove * touchend * touchcancel Currently, the above events are fired async on Android, which means they're one frame behind. The issue with this is that it makes it difficult to implement your own drag-and-drop interface because the drag affect looks jumpy/laggy. *Steps to reproduce:*

Build and run the below on Android.

Drag one of the squares onscreen.

Notice the square does not drag smoothly under your finger. (It jumps around your finger.)

function createDragSquare(top, left, color) {
	var view = Ti.UI.createView({
		touchEnabled: true,
		backgroundColor: color,
		center: { x: left + 50, y: top + 50 },
		width: 100,
		height: 100,
	});
	view.addEventListener("touchmove", function(event) {
		view.center = view.convertPointToView({ x: event.x, y: event.y }, window);
		event.cancelBubble = true;
	});
	return view;
}

var window = Ti.UI.createWindow({ backgroundColor: "white" });
window.add(createDragSquare(40, 40, "red"));
window.add(createDragSquare(120, 120, "green"));
window.add(createDragSquare(200, 200, "blue"));
window.open();

Comments

  1. Joshua Quick 2020-12-12

    PR (master): https://github.com/appcelerator/titanium_mobile/pull/12340
  2. Samir Mohammed 2020-12-15

    FR Passed, waiting on Jenkins build.
  3. Christopher Williams 2020-12-15

    merged to master for 10.0.0 target

JSON Source