[TIMOB-4695] GlobalPoint coordinates do not update with rotation
| GitHub Issue | n/a |
|---|---|
| Type | Bug |
| Priority | Low |
| Status | Closed |
| Resolution | Won't Fix |
| Resolution Date | 2011-08-26T11:53:39.000+0000 |
| Affected Version/s | Release 1.7.1 |
| Fix Version/s | Sprint 2011-30 |
| Components | iOS |
| Labels | defect |
| Reporter | Matthew Congrove |
| Assignee | Reggie Seagraves |
| Created | 2011-07-15T11:07:17.000+0000 |
| Updated | 2017-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();
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.
globalpoint is being deprecated. Please see linked item for customer solution.
Closing as duplicate.