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

Include border into the element selection line #11940

Merged
merged 42 commits into from
Jul 29, 2022
Merged

Conversation

miina
Copy link
Contributor

@miina miina commented Jul 18, 2022

Context

Originally only an "outer" border was implemented outside of the selection line.
It was discussed later that the border should also be included in the selection line, so the user can snap by the border and also select an element by clicking on the border.

Summary

This PR adjusts the frame, edit, display mode to include the border into the selection line.

Relevant Technical Choices

  • Note that the border width does not change the width and height of the element directly as originally intended since the border is in pixels and not responsive.
  • Non-rectangular shapes have a different border logic and are already displaying the frame somewhere in the middle of the border -- these will not have the selection line perfectly including the border now either. This change mainly applies to rectangular elements / shapes.
  • Edit mode stays the same for media -- border is not included in the edit mode.

To-do

  • Fix display with unlocked border
  • Fix text edit with unlocked border
  • Fix resizing multiple elements
  • Refactor
  • Fix tests
  • Add new test for selecting by clicking on border

User-facing changes

text-edit
border-resizing
border-display

Testing Instructions

  • This is a non-user-facing change and requires no QA

This PR can be tested by following these steps:

  1. Add rectangular elements with border (media, text, shape)
  2. Increase and decrease the border -- verify that border is now included in the selection line.
  3. Verify it's possible to drag from the border
  4. Verify it's possible to select an element by clicking on the border
  5. Verify that resizing still works and isn't jumpy / changing the element size unexpectedly.
  6. Verify that border is also included in the selection in text edit mode.
  7. Verify that media edit mode does not include border (is as before)
  8. Verify that output is not influenced by this change.
  9. Verify that when adding border to an element, the content of the element stays in the same place.

Reviews

Does this PR have a security-related impact?

Does this PR change what data or activity we track or use?

Does this PR have a legal-related impact?

Checklist

  • This PR addresses an existing issue and I have linked this PR to it in ZenHub
  • I have tested this code to the best of my abilities
  • I have verified accessibility to the best of my abilities (docs)
  • I have verified i18n and l10n (translation, right-to-left layout) to the best of my abilities
  • This code is covered by automated tests (unit, integration, and/or e2e) to verify it works as intended (docs)
  • I have added documentation where necessary
  • I have added a matching Type: XYZ label to the PR

Fixes #5325

@miina miina added Type: Enhancement New feature or improvement of an existing feature Pod: Prometheus labels Jul 18, 2022
@miina miina self-assigned this Jul 18, 2022
@lgtm-com
Copy link

lgtm-com bot commented Jul 18, 2022

This pull request introduces 3 alerts when merging 936fcb0 into 88943a0 - view on LGTM.com

new alerts:

  • 3 for Unused variable, import, function or class

@lgtm-com
Copy link

lgtm-com bot commented Jul 18, 2022

This pull request introduces 3 alerts when merging 55bb1b2 into 88943a0 - view on LGTM.com

new alerts:

  • 3 for Unused variable, import, function or class

@lgtm-com
Copy link

lgtm-com bot commented Jul 19, 2022

This pull request introduces 3 alerts when merging 09ace6c into 6460356 - view on LGTM.com

new alerts:

  • 3 for Unused variable, import, function or class

@miina miina marked this pull request as ready for review July 22, 2022 09:40
@miina miina requested review from barklund and merapi July 22, 2022 09:40
@merapi merapi added the Group: Borders Element border and border radius label Jul 25, 2022
@merapi
Copy link
Contributor

merapi commented Jul 25, 2022

Note that the border width does not change the width and height of the element directly as originally intended since the border is in pixels and not responsive.

A side effect of that(?) is the alignment for those elements is trickier, we should probably consult that with UX but Andrew is out until Wednesday.

(elements in both groups are aligned to the left)
image

@miina
Copy link
Contributor Author

miina commented Jul 25, 2022

Note that the border width does not change the width and height of the element directly as originally intended since the border is in pixels and not responsive.

A side effect of that(?) is the alignment for those elements is trickier, we should probably consult that with UX but Andrew is out until Wednesday.

This was actually like this before as well -- since the border width isn't included to the width/height currently either. Since we're using non-responsive CSS border but the elements are responsive, using the border to align is not really possible and is as it was before. We could create a follow-up issue if this needs changing.

@googleforcreators-bot
Copy link
Collaborator

googleforcreators-bot commented Jul 25, 2022

Plugin builds for 43e0f5f are ready 🛎️!

@merapi
Copy link
Contributor

merapi commented Jul 26, 2022

This was actually like this before as well

Oh, that's good then - no change in behavior 👍🏻

Copy link
Contributor

@merapi merapi left a comment

Choose a reason for hiding this comment

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

LG, @barklund PTAL and let's move it to QA because there is a lot to check.

@miina
Copy link
Contributor Author

miina commented Jul 27, 2022

Moved it to QA already in case something time-consuming comes up but would be still good to get a review from @barklund, too.

Copy link
Contributor

@barklund barklund left a comment

Choose a reason for hiding this comment

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

Generally looks great, but found a few edge-cases with bugs.

@miina miina merged commit 9833d16 into main Jul 29, 2022
@miina miina deleted the add/5325-border-to-selection branch July 29, 2022 10:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Group: Borders Element border and border radius Type: Enhancement New feature or improvement of an existing feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow selecting element by clicking on the outer border
4 participants