[AC-1345] Anchor Point, doesn´t recalculate when transform is set before the image.
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | n/a |
Status | Resolved |
Resolution | Duplicate |
Resolution Date | 2014-05-19T05:22:43.000+0000 |
Affected Version/s | n/a |
Fix Version/s | n/a |
Components | Titanium SDK & CLI |
Labels | anchorpoint, android, transform |
Reporter | Juan Manuel |
Assignee | Ritu Agrawal |
Created | 2014-05-11T21:46:45.000+0000 |
Updated | 2016-03-08T07:37:45.000+0000 |
Description
If you apply a transformation with a desired anchorPoint, on a that doesn't have it's width and height properties set programatically or the width and height are set to Ti.UI.SIZE and the transform is set before the image, the anchorpoint doesn´t recalculate and even if the width or height changes, the anchor point stays it was.
For example, for an ImageView that has it's image set programatically, the width and height changes based on the size of the image, but the anchor point works as if it's size still were 0,0, making it look like it's being rotated from the top left corner, even when anchorpoint is set at 0.5,0.5
In short: Only works and recalculates correctly if Ti.UI.FILL or a fixed height is set.
Code to reproduce on Android:
View:
<View id="vwContainer">
<ImageView id="imgProfilePicture"></ImageView>
</View>
Controller:
Titanium.Media.openPhotoGallery(
{
success:function(event)
{
if (event.mediaType == Ti.Media.MEDIA_TYPE_PHOTO)
{
var image= event.media;
var transform = Ti.UI.create2DMatrix({ anchorPoint: {x: 0.5, y: 0.5}}).rotate(90);
$.imgProfilePicture.transform = transform;
$.imgProfilePicture.image = image;
}
else
{
alert('Only pictures can be taken');
return;
}
}
});
Resolving this ticket as a duplicate of TIMOB-16596. Please track that ticket for further updates.