javascript - Get relative position of view in Appcelerator Titanium -
i'm trying relative position of imageview in view appcelerator titanium.
my code :
var contentview = ti.ui.createview({width:300,height:300,backgroundcolor:"red"}); var imgview = ti.ui.createimageview({image:'image.png', height:100, width:100, zindex:5}); contentview.add(imgview); win.add(contentview);
i want know position of imgview in contentview during touchmove event :
var olt = ti.ui.create3dmatrix(), curx, cury; imgview.addeventlistener('touchstart', function(e) { curx = e.x; cury = e.y; }); imgview.addeventlistener('touchmove', function(e) { var deltax = e.x - curx; var deltay = e.y - cury; olt = olt.translate(deltax, deltay, 0); imgview.animate({transform:olt, duration:100}); //-- top/left position of imgview ? });
do have ideas please ? :)
imgview.rect.x imgview.rect.y
does work you? properties on view object found @ http://docs.appcelerator.com/platform/latest/#!/api/titanium.ui.view
Comments
Post a Comment