Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-4695] GlobalPoint coordinates do not update with rotation

GitHub Issuen/a
TypeBug
PriorityLow
StatusClosed
ResolutionWon't Fix
Resolution Date2011-08-26T11:53:39.000+0000
Affected Version/sRelease 1.7.1
Fix Version/sSprint 2011-30
ComponentsiOS
Labelsdefect
ReporterMatthew Congrove
AssigneeReggie Seagraves
Created2011-07-15T11:07:17.000+0000
Updated2017-03-03T22:30:51.000+0000

Description

The globalPoint coordinates returned from touch events on an element do not update once the device is rotated; when in portrait mode the X coordinate will increase as you touch from left-to-right, but if you switch to landscape mode the X coordinate becomes the Y coordinate, and vice versa. Sample code below; to reproduce, start in portrait mode and drag left to right (X coordinate increases as expected)... then flip into landscape and drag from left to right; X coordinate does not change as expected.
var win = Ti.UI.createWindow();
var view = Ti.UI.createView();
var output = Ti.UI.createLabel({
	top: 20,
	left: 20,
	width: 280,
	color: "#FFF",
	textAlign: "center",
	font: {
		fontSize: 16,
		fontWeight: "bold"
	},
	text: "Touch and drag anywhere"
});

view.addEventListener("touchmove", function(_event) {
	output.text = "X Global Point: " + _event.globalPoint.x;
});

view.add(output);
win.add(view);
win.open();

Comments

  1. Blain Hamon 2011-07-26

    The global coordinate is just that. Global. Rotation is something that happens at the Ti.Window (technically, rootViewController's view) level; global happens at the device level. A feature request to translate global coordinates back into a view's coordinates (Such as a window) should be requested instead.
  2. Reggie Seagraves 2011-08-26

    globalpoint is being deprecated. Please see linked item for customer solution.
  3. Lee Morris 2017-03-03

    Closing as duplicate.

JSON Source