8000 More image editor improvements by lakesare · Pull Request #4676 · transloadit/uppy · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

More image editor improvements #4676

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

Merged
merged 21 commits into from
Nov 1, 2023
Merged

More image editor improvements #4676

merged 21 commits into from
Nov 1, 2023

Conversation

lakesare
Copy link
Contributor
@lakesare lakesare commented Sep 11, 2023

In this PR

  • readded labels to all buttons

    image
  • centered slider's label
    Notes: we discussed that we'd like that label to follow user's cursor, but our label library (microtip) doesn't support that. I think leaving it in the center is pretty nice though, also gives some orientation to the user as to where the 0° is.

    image
  • limited cropbox movements
    Note 2 different modes of interaction, first you see me moving the cropbox; then you see me resizing the cropbox.
    First one is handled by limitCropboxMovementOnMove, second one is handled by limitCropboxMovementOnResize.

    Screen.Recording.2023-09-15.at.13.33.39.mov
  • change the checkered bg color

    Before:

    image

    After:

    image
  • like we discussed in slack with Artur&Alex, made the background theme-dependent

  • made both inputrange.scss and cropper.scss veridical copypastes from the library, all our custom styles are now in style.scss

  • made granular rotation [-45, 45] instead of [-45, 44] like Alex noted

  • made slider hover/focus visible in all browsers

Notes

@arturi arturi requested review from nqst and arturi September 11, 2023 11:56
Copy link
Contributor
@nqst nqst left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We discussed that we'd like that label to follow user's cursor, but our label library (microtip) doesn't support that.

TBH the static version doesn't look good to me. I'd propose to either adjust the library functionality, or use another library.

we can use a small library to make it a proper select

I'm in favor of this option :)

lakesare and others added 2 commits September 13, 2023 11:29
Co-authored-by: Alexander Zaytsev <nqst@users.noreply.github.com>
locale - Flip => Flip horizontally

Co-authored-by: Alexander Zaytsev <nqst@users.noreply.github.com>
@lakesare
Copy link
Contributor Author
lakesare commented Sep 13, 2023

TBH the static version doesn't look good to me. I'd propose to either adjust the library functionality, or use another library.

@nqst, even when you actually use it? I think it looks bad on the screenshot, but in real life it's quite nice (remember we're always starting from 0deg, so it just looks like "the point we started from", quite organic).

@nqst
Copy link
Contributor
nqst commented Sep 13, 2023

@nqst, even when you actually use it? I think it looks bad on the screenshot, but in real life it's quite nice (remember we're always starting from 0deg, so it just looks like "the point we started from", quite organic).

Just tried it once again, but I couldn't change my mind about it. Sorry :) It's not a blocker to merge the current iteration I think, but I believe it would feel much nicer when that particular tooltip was following the handle.

P.S. It might be nice to indicate the 0deg point, but in a different way. The most common solution is to add some subtle indication marks to the track, e.g. like here https://m3.material.io/components/sliders/guidelines#0b2644fa-2308-458b-9e8e-f0289d5b483f

@lakesare
Copy link
Contributor Author

Just tried it once again, but I couldn't change my mind about it. Sorry :) It's not a blocker to merge the current iteration I think, but I believe it would feel much nicer when that particular tooltip was following the handle.

No no, I kind of agree, just made sure you used it real-time too (which gives a slightly better impression than the screenshot version).

@lakesare lakesare marked this pull request as ready for review September 30, 2023 02:30
Copy link
Member
@Murderlon Murderlon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very nice improvements and code LGTM. Have not tested locally though.

@lakesare
Copy link
Contributor Author
lakesare commented Oct 9, 2023

@Murderlon would be happy if you test it locally too, alex is reporting no-zoom-in-on-rotation which I'm yet to reproduce locally https://transloadit.slack.com/archives/C0FMW9PSB/p1696582613328759?thread_ts=1695764122.569399&cid=C0FMW9PSB


UPDATE: nevermind, managed to reproduce it with Alex's image!

@lakesare lakesare requested a review from nqst October 24, 2023 02:22
Copy link
Contributor
@nqst nqst left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Broken rotation is fixed for me, too! Nice 🎉

Here are the other things that we discussed earlier. What do you think about them?

  • Removing the zoom in/out buttons
  • Restricting the cropping tool so it doesn't go beyond the image (including the rotated image)
  • Setting a minimum bounding box area
  • Making the tooltip with the rotation value movable

@arturi
Copy link
Contributor
arturi commented Oct 24, 2023

Thank you for the update!

I’ve managed to almost crash Firefox with a 3.4MB picture — rotating is fine, saving is where it stops responding:

image

Maybe it's just my machine, but I've had similar issues on a Mac before.

@lakesare
Copy link
Contributor Author
lakesare commented Oct 25, 2023

@arturi

It's a 13MB picture!

image

I can reproduce some staggering on save with your image, firefox does stop responding to my hovers and clicks for me for a few milliseconds (and then recovers). The same happens upon me pasting this image into Uppy (again, for a few milliseconds), I think operations with such images are just funamentally computationally expensive (Foliotek/Croppie#324 (comment)).

I guess the important questions are:

  1. Does it recover for you after a few seconds too, or never does?
  2. Does it happen with smaller images?

@lakesare
Copy link
Contributor Author

@nqst

Removing the zoom in/out buttons

I'm pro this, but I thought we should leave this for further PRs, after we play with it for some time ourselves/refreshen our eyes.
I can remove it if both you & @arturi are sure though.

Restricting the cropping tool so it doesn't go beyond the image (including the rotated image)

I see a point in limiting the cropbox to the confines of the image, however that would only work nicely if we limit it while the user is moving the cropbox, and we can't do that (hard with cropperjs, we'll get glitches).

I think our current version is pretty nice, it both gives us full freedom to crop anything we want AND doesn't let us travel too far off the image.

Setting a minimum bounding box area

Meaning minimum cropbox area, right, like this?

image

It can be hard to do for the same reason why it's hard to do the point above, cropperjs doesn't report each event, so we can't just event.preventDefault() when the cropbox is too small, it will sometimes work and sometimes it won't; and when it won't work we'll get stuck.

Making the tooltip with the rotation value movable

I described my musings about this here #4715. I'd say the conclusion is - @arturi is justifiably worried about the bundle sizes & thinks materialui is an overkill; so we should implement the tooltip movability manually. I think that's a todo for further PRs.

@arturi
Copy link
Contributor
arturi commented Oct 25, 2023

It's a 13MB picture!

No, original is 3.3MB, so the fact that it turns into a 13MB PNG is also bad. Not sure how though, as I just tried again and the resulting JPEG was 1.1MB.

Does it recover for you after a few seconds too, or never does?

It never did recover, I waited for a minute or two, but some stuff might have been running in the background, plus too many open tabs, it could all contribute to the issue.

Does it happen with smaller images?

No, mostly with the ones >3MB, which is average or even smaller than usual mobile phone picture.

@arturi
Copy link
Contributor
arturi commented Oct 25, 2023

Meaning minimum cropbox area, right, like this?

I thought we could easily do this with minCropBoxWidth and minCropBoxHeight?

Removing the zoom in/out buttons

Let's do in a follow-up PR, as long as we just flip the default to off, but allow users to re-enable it, I am pro this change.

I think our current version is pretty nice, it both gives us full freedom to crop anything we want AND doesn't let us travel too far off the image.
Making the tooltip with the rotation value movable

I agree we should finalize this PR and move on to other things in the next, so it doesn't feel stale and people already benefit from Evgenia’s amazing work here :)

@lakesare
Copy link
Contributor Author
lakesare commented Nov 1, 2023

No, original is 3.3MB, so the fact that it turns into a 13MB PNG is also bad. Not sure how though, as I just tried again and the resulting JPEG was 1.1MB.

I took that 13MB screenshot before I edited it in Uppy.

Oh, the size is wildly different based on whether I use Copy image and then do cmd+v in Uppy, or whether I Download the image and then drag&drop it into Uppy.

Copy image & `cmd+v` in Uppy => 13MB Press the download image & drag&drop in Uppy => 3.1MB
image image

Either way - a properly downloaded image is initially 3.1MB, and turns into 1.2MB (the size lessens) after editing, so we don't need to worry about that; and I cannot reproduce the lagging you described with the 3.1MB image at all.

@lakesare
Copy link
Contributor Author
lakesare commented Nov 1, 2023

I thought we could easily do this with minCropBoxWidth and minCropBoxHeight?

😅 right, thanks for fresh eyes

@lakesare lakesare requested a review from nqst November 1, 2023 07:33
@lakesare
Copy link
Contributor Author
lakesare commented Nov 1, 2023

@arturi, @nqst - added the smallest cropbox width/height commit, works well locally, you don't need to rereview if you checked the PR already.

image

So this PR can be merged.

Copy link
Contributor
@nqst nqst left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just tested this once again. Significant improvement! 👍

Removing zoom in/out buttons

Let's do in a follow-up PR, as long as we just flip the default to off, but allow users to re-enable it, I am pro this change.

Personally, I'd prefer just remove this entirely soon. Destructive zooming seems to be pretty useless and confusing feature to me, to be honest.

Making the tooltip with the rotation value movable

I described my musings about this here #4715.

This issue is now closed, is there a chance we'll get back to it in the near future?

@arturi
Copy link
Contributor
arturi commented Nov 1, 2023

Evgenia @lakesare, please carry the todos from here to the next PR if you'll open one 🙏 Very nice work, merging!

@arturi arturi merged commit 47e9f70 into main Nov 1, 2023
@arturi arturi deleted the lakesare/image-editor branch November 1, 2023 13:33
Murderlon added a commit that referenced this pull request Nov 1, 2023
* main:
  More image editor improvements (#4676)
  @uppy/react: add useUppyState (#4711)
  Release: uppy@3.18.1 (#4760)
  Bump jsonwebtoken from 8.5.1 to 9.0.0 in /packages/@uppy/companion (#4751)
  Bump react-devtools-core from 4.25.0 to 4.28.4 (#4756)
  Bump webpack from 5.74.0 to 5.88.2 (#4740)
  Bump @babel/traverse from 7.22.5 to 7.23.2 (#4739)
  @uppy/core: fix `sideEffects` declaration (#4759)
  Release: uppy@3.18.0 (#4754)
  @uppy/aws-s3-multipart: fix `TypeError` (#4748)
  Bump tough-cookie from 4.1.2 to 4.1.3 (#4750)
  example: simplify code by using built-in `throwIfAborted` (#4749)
  @uppy/aws-s3-multipart: pass `signal` as separate arg for backward compat (#4746)
  meta: fix TS integration (#4741)
@github-actions github-actions bot mentioned this pull request Nov 8, 2023
github-actions bot added a commit that referenced this pull request Nov 8, 2023
| Package                | Version | Package                | Version |
| ---------------------- | ------- | ---------------------- | ------- |
| @uppy/aws-s3           |   3.5.0 | @uppy/provider-views   |   3.7.0 |
| @uppy/aws-s3-multipart |   3.9.0 | @uppy/react            |   3.2.0 |
| @uppy/companion        |  4.11.0 | @uppy/transloadit      |   3.4.0 |
| @uppy/companion-client |   3.6.0 | @uppy/tus              |   3.4.0 |
| @uppy/core             |   3.7.0 | @uppy/url              |   3.4.0 |
| @uppy/dashboard        |   3.7.0 | @uppy/utils            |   5.6.0 |
| @uppy/image-editor     |   2.3.0 | @uppy/xhr-upload       |   3.5.0 |
| @uppy/locales          |   3.4.0 | uppy                   |  3.19.0 |

- @uppy/dashboard: Remove uppy-Dashboard-isFixed when uppy.close() is invoked (Artur Paikin / #4775)
- @uppy/core,@uppy/dashboard: don't cancel all files when clicking "done" (Mikael Finstad / #4771)
- @uppy/utils: refactor to TS (Antoine du Hamel / #4699)
- @uppy/locales: locales: add ca_ES (ordago / #4772)
- @uppy/companion: Companion+client stability fixes, error handling and retry (Mikael Finstad / #4734)
- @uppy/companion: add getBucket metadata argument (Mikael Finstad / #4770)
- 
7AE7
@uppy/core: simplify types with class generic (JokcyLou / #4761)
- @uppy/image-editor: More image editor improvements (Evgenia Karunus / #4676)
- @uppy/react: add useUppyState (Merlijn Vos / #4711)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants
0