Uploaded image for project: 'Appcelerator - INBOX'
  1. Appcelerator - INBOX
  2. AC-1345

Anchor Point, doesn´t recalculate when transform is set before the image.

    Details

      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.xml

      <View id="vwContainer">
      			<ImageView id="imgProfilePicture"></ImageView>
      </View>
      

      Controller:

      controller.js

      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;
                      }
              }
      });
      

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                ragrawal Ritu Agrawal
                Reporter:
                juanu Juan Manuel
              • Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Git Integration