Titanium JIRA Archive
Appcelerator Community (AC)

[AC-1345] Anchor Point, doesn´t recalculate when transform is set before the image.

GitHub Issuen/a
TypeBug
Priorityn/a
StatusResolved
ResolutionDuplicate
Resolution Date2014-05-19T05:22:43.000+0000
Affected Version/sn/a
Fix Version/sn/a
ComponentsTitanium SDK & CLI
Labelsanchorpoint, android, transform
ReporterJuan Manuel
AssigneeRitu Agrawal
Created2014-05-11T21:46:45.000+0000
Updated2016-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;
                }
        }
});

Comments

  1. Ritu Agrawal 2014-05-14

    Resolving this ticket as a duplicate of TIMOB-16596. Please track that ticket for further updates.

JSON Source