Skip to content
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 more resizing handles #3023

Merged
merged 30 commits into from
Aug 21, 2019
Merged

Add more resizing handles #3023

merged 30 commits into from
Aug 21, 2019

Conversation

swissspidy
Copy link
Collaborator

@swissspidy swissspidy commented Aug 13, 2019

To do

  • Consolidate styling for resizing handles (currently split across 2 files)
  • Fix styling for resizing handles (some look different on hover)
  • Change block position when dragging from top or left (side or corner)
  • E2E Tests

Fixes #2985.

@googlebot googlebot added the cla: yes Signed the Google CLA label Aug 13, 2019
@swissspidy
Copy link
Collaborator Author

Current WIP screenshots:

Screenshot 2019-08-13 at 16 30 57
Screenshot 2019-08-13 at 16 30 52

@swissspidy
Copy link
Collaborator Author

@miina I think this is a good opportunity to extract the onResize callbacks into a bunch of smaller helper functions. Those are currently quite large. Thoughts?

@miina
Copy link
Contributor

miina commented Aug 13, 2019

I think this is a good opportunity to extract the onResize callbacks into a bunch of smaller helper functions. Those are currently quite large.

Sounds good to me! It is getting quite large, especially when we'll add more calculations for additional handles.

By "Rotation handles" in the title, do you mean "resizing handles"? Or is the plan to add more rotation handles as well?

@swissspidy
Copy link
Collaborator Author

By "Rotation handles" in the title, do you mean "resizing handles"? Or is the plan to add more rotation handles as well?

Imagine additional rotation handles at every blue dot 😄 Yes, I meant resizing handles.

@swissspidy swissspidy changed the title Add more rotation handles Add more resizing handles Aug 13, 2019
@swissspidy
Copy link
Collaborator Author

Change block position when dragging from top or left (side or corner)

@miina In case you wanna tackle this one, that would be greatly appreciated 😄 It would probably take me way longer to dig through the logic there.

@miina
Copy link
Contributor

miina commented Aug 14, 2019

I can try 😄

@miina
Copy link
Contributor

miina commented Aug 16, 2019

Note:
Would be good to get #2863 merged first since it reduces the complexity with Text block by removing the area added for dragging only.

@swissspidy
Copy link
Collaborator Author

Alright! That one's on my list for reviewing today anyway 🙂

@googlebot
Copy link

All (the pull request submitter and all commit authors) CLAs are signed, but one or more commits were authored or co-authored by someone other than the pull request submitter.

We need to confirm that all authors are ok with their commits being contributed to this project. Please have them confirm that by leaving a comment that contains only @googlebot I consent. in this pull request.

Note to project maintainer: There may be cases where the author cannot leave a comment, or the comment is not properly detected as consent. In those cases, you can manually confirm consent of the commit author(s), and set the cla label to yes (if enabled on your project).

ℹ️ Googlers: Go here for more info.

@googlebot googlebot added cla: no Has not signed the Google CLA and removed cla: yes Signed the Google CLA labels Aug 16, 2019
@miina
Copy link
Contributor

miina commented Aug 16, 2019

@googlebot I consent.

@googlebot
Copy link

CLAs look good, thanks!

ℹ️ Googlers: Go here for more info.

@googlebot googlebot added cla: yes Signed the Google CLA and removed cla: no Has not signed the Google CLA labels Aug 16, 2019
@miina
Copy link
Contributor

miina commented Aug 19, 2019

The corners are working OK now as well, however, now there's a bug with the block still continuing to change the position when moving the mouse even when it's not resizing anymore due to the minimum size limit.

Looking into this now.

@miina
Copy link
Contributor

miina commented Aug 19, 2019

The issue mentioned above is fixed now as well, will add e2e tests and should be done.

Actually, will check also if this can be fixed:

// @todo Figure out why calculating the new top / left position doesn't work in case of small height value.
// @todo Remove this temporary fix.
if ( appliedHeight < 60 ) {
diff.left = diff.left / ( 60 / appliedHeight );
diff.right = diff.right / ( 60 / appliedHeight );
}

^ It's a bit more noticeable now with the corner handles. If it seems to remain a mystery then will create a separate issue for it.

@miina
Copy link
Contributor

miina commented Aug 19, 2019

Just for information that dragging from the resizing handles seems to work as expected in e2e tests, started adding those, will finish tomorrow.

@miina
Copy link
Contributor

miina commented Aug 20, 2019

E2e tests are added now. The resizing part should be ready for testing/reviewing.

* e2e tests should be in a `specs` folder, or have a `spec.js` suffix
* unit tests should be in a `test` or `__tests__` folder, or have a `test.js` suffix

This change makes sure that there is no overlap between the two configs, and that previously ignored unit tests are actually run.
@swissspidy swissspidy requested a review from miina August 20, 2019 14:53
@swissspidy swissspidy marked this pull request as ready for review August 20, 2019 14:53
@swissspidy
Copy link
Collaborator Author

@miina Please review this when you get a chance 🙂
It affects #2992 a bit, so would be nice if this one's in before that.

@swissspidy
Copy link
Collaborator Author

Ah, will need to fix the merge conflict first. Doing that tomorrow.

And for #2992 I'll just rebase it on this branch. That seems to work fine.

Copy link
Contributor

@miina miina left a comment

Choose a reason for hiding this comment

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

Thanks for fixing the tests folder name, too.

@swissspidy swissspidy modified the milestone: v1.2.2 Aug 21, 2019
@swissspidy swissspidy merged commit ec8949a into develop Aug 21, 2019
@swissspidy swissspidy deleted the add/more-rotation-handles branch August 21, 2019 07:44
westonruter added a commit that referenced this pull request Aug 22, 2019
* tag '1.2.1': (434 commits)
  Bump 1.2.1
  Adjust block inserter style. (#3075)
  Update dependency eslint-plugin-jest to v22.15.2
  Fix flaky CTA test (#3057)
  Add more resizing handles (#3023)
  Bump version to 1.2.1-RC1
  Improve story page background media with image srcset, reduced image size, and a11y text (#3006)
  Wait until content loaded before calculating font size. (#3052)
  Harden logic for normalizing image metadata before adding story images (#3049)
  Update dependency uuid to v3.3.3 (#3046)
  Inline color support (#3033)
  Update dependency webpack-cli to v3.3.7 (#3040)
  Tiny prop-types fix
  Update dependency babel-jest to v24.9.0 (#3037)
  Update e2e test setup (#3031)
  Include amp-script among dynamic_element_selectors in tree shaking
  Another try to fix tests.
  Ensure selecting the first page before removing the block.
  Move setting input selection to the end to helpers.
  Fix editor test.
  ...
@swissspidy swissspidy added this to the v1.3 milestone Aug 29, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes Signed the Google CLA
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow user to resize blocks from corners
3 participants