-
Notifications
You must be signed in to change notification settings - Fork 235
Image not centered wrt viewport #53
Comments
Wondering the same thing. Taking a picture with the camera, and then after the camera activity result, I'm doing:
But the image is bottom aligned to the base of the 'cropping square'... |
Thanks for reporting this @liangricha / @mhousser do you have a sample image I can use to reproduce this? |
@eveliotc well actually I'm launching the camera, then upon camera ActivityResult, I'm running this line:
So I don't have a sample image per se - but let me try and get a screenshot. |
First of all, my XML is pretty standard:
Immediately after taking a picture with my camera and running this line: cropView.extensions().load(new File(newImageFilename)); It's bottom-aligning to the crop square: I would expect it to be vertically centred with the square, just like this (I dragged the image down to make it look like this): |
@eveliotc and another alignment issue, this time when passing in a It's right aligning, instead of being horizontally centered. This time, it's via the line Some screens. The gallery: And after I run |
@eveliotc maybe this is just a setup issue. I'm using Picasso, and so Scissors should be using Picasso to do its loading. Am I missing somewhere a specific call to tell Picasso and/or Scissors to load things in 'center inside' mode (with respect to the scissors viewport)? Starting to feel like this is just a setup issue (I missed a call somewhere), instead of an actual bug... |
For the above gif, I used http://earthzine.org/wp-content/uploads/2015/08/image2.jpeg and called |
The same problem. If setViewportRatio() before the image is loaded,it's bottom-aligning to the crop square.If setViewportRatio() after the image is loaded,it will be center inside. so should i add a callback to image load? |
@ZoroYouth are you saying there's currently an easy workaround? Just call |
now i just wait 1 second to setViewportRatio. it solved my problem,but the way is terrible. |
I have same problem. Maybe this issue is caused by TouchManager#ensureInsideViewport() method call. I sent the pull request #57 . |
@nshmura Good job.I have tried your method and it works well,thank you |
@eveliotc can we please accept the fix above and push out a new version? This library is quite broken when all the taken images are not centered by default.. |
@mhousser Fix was included for 1.1.1 |
@eveliotc is 1.1.1 available for Gradle inclusion in yet? i.e. |
Nevermind, I see now that 1.1.1 is published and I have included it in Android Studio. It works! Finally this library works very well for me and chosen/taken pictures are centred nicely in the cropping area by default. |
@eveliotc Thank you. I done! |
Hi! Thanks for open-sourcing this amazing library!
I noticed that if I have a thin viewport ratio, the underlying bitmp is not initially centered:
![device-2016-06-21-143417](https://cloud.githubusercontent.com/assets/6540299/16241885/c4537248-37bd-11e6-99a0-a21744e10584.gif)
I can get the centered image by doing
position.set (availableWidth / 2, availableHeight / 2)
here - https://github.com/lyft/scissors/blob/master/scissors/src/main/java/com/lyft/android/scissors/TouchManager.java#L88Is this the appropriate workaround?
The text was updated successfully, but these errors were encountered: