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

No multiselect controls for selection with the same uids #4251

Merged
merged 14 commits into from
Oct 2, 2023

Conversation

gbalint
Copy link
Contributor

@gbalint gbalint commented Sep 28, 2023

Problem:
When there are two remix scenes in the project, it is really easy to accidentally select the same element in both (by using the code editor). In this case we should a multiselect outline around those elements, which is kinda meaningless for theis special case.

Fix:
When the selected elements all share the same uid we don't show the multiselect outline and the strategy controls.

@gbalint gbalint changed the title Update simple-outline-control.tsx No bounding box for multiselection with same uids Sep 28, 2023
@github-actions
Copy link
Contributor

github-actions bot commented Sep 28, 2023

Try me

@relativeci
Copy link

relativeci bot commented Sep 28, 2023

Job #8350: Bundle Size — 62.78MiB (~+0.01%).

0eb4721(current) vs 5957b21 master#8349(baseline)

Warning

Bundle contains 64 duplicate packages - View duplicate packages

Bundle metrics (2 changes)
                 Current
Job #8350
     Baseline
Job #8349
Initial JS 35.05MiB(~+0.01%) 35.05MiB
Initial CSS 0B 0B
Cache Invalidation 19.6% 18.39%
Chunks 27 27
Assets 31 31
Modules 3973 3973
Duplicate Modules 424 424
Duplicate Code 30.9% 30.9%
Packages 409 409
Duplicate Packages 64 64
Bundle size by type (1 change)
                 Current
Job #8350
     Baseline
Job #8349
CSS 0B 0B
Fonts 0B 0B
HTML 11.43KiB 11.43KiB
IMG 0B 0B
JS 62.77MiB (~+0.01%) 62.77MiB
Media 0B 0B
Other 0B 0B

View job #8350 reportView feature/all-uids-the-same-multis... branch activity

@github-actions
Copy link
Contributor

github-actions bot commented Sep 28, 2023

Performance test results:
(Chart1)
(Chart2)

@gbalint gbalint marked this pull request as ready for review September 28, 2023 15:47
@gbalint gbalint changed the title No bounding box for multiselection with same uids No multiselect controls for selection with the same uids Sep 28, 2023
@@ -1139,3 +1139,15 @@ export function getStoryboardPathFromPath(path: ElementPath): ElementPath | null
export function appendTwoPaths(base: ElementPath, other: ElementPath): ElementPath {
return elementPath([...base.parts, ...other.parts])
}

export function multipleElementPathsWithTheSameUid(paths: Array<ElementPath>): boolean {
Copy link
Contributor

Choose a reason for hiding this comment

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

Would this be a more suitable name?

Suggested change
export function multipleElementPathsWithTheSameUid(paths: Array<ElementPath>): boolean {
export function allPathsHaveTheSameUid(paths: Array<ElementPath>): boolean {

Copy link
Contributor Author

Choose a reason for hiding this comment

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

First I used a similar name but I wanted the function to return false when there is only one uid (or when the array is empty), and for these cases allPathsHaveTheSameUid would be misleading a name.

Copy link
Contributor

Choose a reason for hiding this comment

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

Hmmm I agree with that reasoning, but this name now gives the impression that it is checking for the presence of any duplicate UIDs, rather than checking that all paths end in the same UID. so e.g. given the input [ 'aaa/bbb', 'aaa/ccc', 'aaa/ccc:ddd/bbb' ] I'd expect this function to return true because there are two paths ending in bbb. So I think for that reason it would be better to name this something multiplePathsAllWithTheSameUID

@balazsbajorics
Copy link
Contributor

balazsbajorics commented Sep 28, 2023

I did a very poor job following the remix track lately, could you link a test project here where I can play with this?

Copy link
Contributor

@balazsbajorics balazsbajorics left a comment

Choose a reason for hiding this comment

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

I think it's an OK mitigation step, but comes with a big downside: if you actually want to interact with the (multi)selected element on the canvas, you have to unselect it and select it again so you have a single selection.

I think the long term solution should be that we introduce a third type of outline on the canvas, sitting between highlight (temporary) and real selection (permanent, multiseletion usually very deliberate). This "code highlight" should be more permanent than a highlight, and allow you to single click turn it into a "real" selection.

@gbalint gbalint merged commit c031b7d into master Oct 2, 2023
@gbalint gbalint deleted the feature/all-uids-the-same-multiselection branch October 2, 2023 14:26
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.

5 participants