[TIMOB-5225] Slider change event object properties {x,y,globalPoint} are undefined
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Low |
Status | Closed |
Resolution | Invalid |
Resolution Date | 2017-06-09T17:07:51.000+0000 |
Affected Version/s | n/a |
Fix Version/s | n/a |
Components | iOS |
Labels | n/a |
Reporter | Tony Lukasavage |
Assignee | Ingo Muschenetz |
Created | 2011-08-12T07:40:58.000+0000 |
Updated | 2017-06-09T17:07:51.000+0000 |
Description
When the *change* event is fired on a Slider, the *x*, *y*, and *globalPoint* properties are being returned as undefined. Here is a simple example showing the bug, as well as a naive workaround that will allow you to ascertain the relative *x* position of the Slider using its width and current value. Obviously, this workaround only works with a slider whose range is from 0 to 1, but a more robust workaround could use the min and max ranges to create a 0 to 1 multiplier.
var win = Ti.UI.createWindow();
var slider = Ti.UI.createSlider();
slider.addEventListener('change', function(e) {
Ti.API.info("x:" + e.x + " -- y:" + e.y + " -- globalPoint:" + e.globalPoint);
Ti.API.info("calculated x:" + e.source.width * e.source.value);
});
win.add(slider);
win.open();
Reassigning tickets, as per Tony Guntharp's request
Closing ticket due to time passed, any problems please open a new ticket.