[AC-643] Shake gesture timestamp always 0, x/y undefined
| GitHub Issue | n/a |
|---|---|
| Type | Bug |
| Priority | n/a |
| Status | Closed |
| Resolution | Cannot Reproduce |
| Resolution Date | 2016-03-07T20:16:34.000+0000 |
| Affected Version/s | Appcelerator Studio 4.5.0 |
| Fix Version/s | n/a |
| Components | Titanium SDK & CLI |
| Labels | gesture, ios, shake |
| Reporter | Arjan |
| Assignee | Shak Hossain |
| Created | 2016-02-23T14:23:52.000+0000 |
| Updated | 2016-03-07T20:16:34.000+0000 |
Description
Shake gesture return object doesn't contain e.x and e.y, and e.timestamp is always 0 (also after second shake).
My code (index controller):
Ti.Gesture.addEventListener('shake',function(e) {
console.info(e);
});
Output (with every shake):
[INFO] : {
[INFO] : bubbles = 1;
[INFO] : cancelBubble = 0;
[INFO] : source = "[object GestureModule]";
[INFO] : timestamp = 0;
[INFO] : type = shake;
[INFO] : }
Hello, I tested the issue with SDK 5.2.0.GA in Android 4.4.2(Explorer ZV). Ti. Gesture seems to be working as expected. Below is the console log.
[INFO] : {"type":"shake","source":{"bubbleParent":true,"portrait":true,"landscape":false,"orientation":1,"apiName":"Ti.Gesture","_events":{"shake":{}}},"timestamp":1457029037966,"z":6.129000186920166,"y":0.3059999942779541,"x":5.36299991607666,"bubbles":false,"cancelBubble":false} [INFO] : {"type":"shake","source":{"bubbleParent":true,"portrait":true,"landscape":false,"orientation":1,"apiName":"Ti.Gesture","_events":{"shake":{}}},"timestamp":1457029048120,"z":8.734000205993652,"y":4.442999839782715,"x":3.5239999294281006,"bubbles":false,"cancelBubble":false} [INFO] : {"type":"shake","source":{"bubbleParent":true,"portrait":true,"landscape":false,"orientation":1,"apiName":"Ti.Gesture","_events":{"shake":{}}},"timestamp":1457029053519,"z":9.194000244140625,"y":3.2170000076293945,"x":-0.45899999141693115,"bubbles":false,"cancelBubble":false}Sample Code Segment
index.jsindex.xmlfunction doClick(e) { Titanium.API.info("You clicked the button"); }; $.win.open(); Ti.Gesture.addEventListener('shake', function(e) { console.info(e); });<Alloy> <Window id="win" backgroundColor="white"> <!-- The title property can also be defined as node text. --> <Button id="button" onClick="doClick" title="Hello" top="10" width="100" height="50" /> </Window> </Alloy>Step to test
1. After the app launch, Jush shake the device to see the output in the console. Thanks.