-
Notifications
You must be signed in to change notification settings - Fork 513
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for rectangle area crop #6
Comments
+1 |
This is implemented in pull request #1 |
chirgwin, I am noticing a couple of issues with your build:
Thanks, |
@paulflo150 I've just merged some additional selection fixes from the I've been able to reproduce both the aspect ratio and minimum size bugs you point out and will work on fixes for those. Automated test would be very helpful in avoiding regressions like these. I've been meaning to write some, but haven't gotten around to it yet. |
Hey chirgwin, thanks for the great work, looking forward to the fixes. I just tried the latest build, and I am now seeing an issue with the selection resizing on circle/ square are types. I do not see the resize cursor anymore, and the resizing does not seem to be animated anymore. It works perfectly with the rectangle. Also, how would you go about maintaining the AR of the original image when using the rectangle area type. I would be perfectly fine if the selection would keep the same AR as the image, which in turn would ensure the cropped image also has the correct AR, however I am not sure if that would be correct or not. Suppose you have an original image that is 600 x 300 pixels, what I would like to do is for the cropped image to also have the same AR by specifying a max width and a max height. For instance I want this max width to be 150 and max height 100, and assuming I am selecting the whole image, my cropped image would become 150 (my max width) by 75 px. Vice versa, if the image was 300 by 400, the cropped image would be 75 by 100 px (my max height). Any thoughts on how to achieve this? Thanks, |
Just quick follow up: I think that _dontDragOutside got left out of one of the files. |
Ok, so it appears that when resetHost is called it does not know anything about the area type, and the initial crop box gets created based on both the width and height of the image, but in case of a square or circle these should be the same. I fixed it by passing the areaType to resetCropHost, although you may have a better way of doing this: // Resets CropHost
|
@paulflo150 Thanks for that fix. Looks reasonable. If you want to create a pull request on my fork, I'll gladly take a closer look and merge it. Or, I can incorporate this change myself. The drawing issue you're seeing should be fixed in commit be414c2 in On your suggestions, I think what would allow the most flexibility would be to expose an arbitrary fixed aspect ratio (in addition to 1:1, as currently supported by square selection) for rectangle selections as an attribute in the directive. You could also add a parameter to automatically determine this aspect ratio of the selection from the dimensions of the loaded image, effectively pegging the selection aspect ratio to the original image aspect ratio. This, in combination with the maximum selection dimensions, should accomplish what you're describing. I was hoping to keep my changes on rectangular selections minimal until @alexk111 has a chance to review pull request(s) and I'll defer to him on design changes/feature requests. That said, I will likely continue scratching my own itches on the |
Thanks for getting these fixes in so quickly! It may be easier if you implemented those changes as I am not sure which branch to fork :), here are all my changes for your review:
Oh and I also removed _dontDragOutside from two places - you may have already fixed this as I have not looked at the latest build yet. Thanks again! |
…on types, as suggested by @paulflo150 in issue alexk111#6
…ing around the type; improvements to suggestion by @paulflo150 in issue alexk111#6
@sanketsaurav The problem here is that the output image isn't being resized with the selection (see issue #4 and pull request #7). I've cherry-picked these changes from #7 into the 0.2.1 branch of my fork and tweaked them a little to get things working. This fork of your fiddle puts it all together. |
Awesome, I look forward to this implementation so that I can start using this lib :) |
Guys, thanks for the fork. Is there a chance to implement fixed ratio rectangle option? |
Thanks for the fork implementing the fixed aspect ratio.I tried it and I've seen a problem, as doc says: "The result image will always be a square for the both circle and square area types." This shouldn't be for the rectangle areaType. A quick fix for me has been to change the setResultImageSize method adding this before drawScene: if (theArea._aspectRatio) { |
Just added few lines to manage rectangle and aspect ratio on resultImage Other useful infos printed out (original dimension and original image crop position and size) |
@iceye
|
I saw, I need to add some checks because the code is called also when there's no image uploaded. There's the other error Thank you. |
@iceye
line 1291 is like this. "scope.$apply ..."
Do you have some ideas? |
I don't get why this is happening, the problem is this:
probably it's because I added scope variables assignments in the wrong way. The strange things is that the demo is working 0_o Hope you have better luck |
Ok, fixed (problem was caused by 'areaCoords' scope variable declaration): |
@iceye |
@iceye I'll gladly merge your changes into my fork if you create a pull request. Ditto for other rectangle related changes. @alexk111 What iceye said; would love to see this (pull request #1) merged into your mainline. The less desirable alternative would be for me (or others?) to maintain a rectangular fork indefinitely. |
Nice work, regards to all of you. |
@iceye I'm running into the same problem as @zokipoki when I try and use the When rectangle is selected the size of the output image is staying a square. I also set an Any idea what I'm doing wrong? Thanks! EDIT: here is a plunker using the compiled EDIT2: @chirgwin ah I see you have addressed this issue on your 0.2.1 branch. But there is no aspect ratio feature on that branch. Does anyone have a working demo that specifies an |
Hi guys. Sorry for the delayed response. Waiting for an update here #1 |
Thanks, @alexk111. #1 should be ready to merge. @robianmcd Aspect ratio is covered by issue #17. See my comment about it there. Short answer is it will be lumped in with pull request #1. To clarify: I've mainly been maintaining branches for release and bower dependency purposes, generating compiled versions and reference branch git repository from bower. As of this writing and to my knowledge, all outstanding changes discussed in this thread are covered by pull requests. |
Just curious: |
@iceye |
@iceye , |
You may find more recent developments here: |
Checkout my fork: https://github.com/CrackerakiUA/ngImgCropFullExtended |
How is it going in official release? |
Official release don't look to need rectangle ) |
Is area-min-size property working on rectangle area-type? I've tested, but only square area-type seems to be resizable. |
Can you do minified version of this ngImgCrop http://jsfiddle.net/iceye/ryb31tj1/ ? |
hey I want to use rectangle but when I set area-type to rectangle that dosn't work and shows circle instead I used exactly http://jsfiddle.net/iceye/ryb31tj1/1/ code and version of ngImgCrop is 0.3.2 |
am having the same issue |
Would love it if you could include support for rectangular area crop, in addition to the existing circle and square.
The text was updated successfully, but these errors were encountered: