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

feat(web): select a range of assets #3086

Merged
merged 1 commit into from
Jul 3, 2023
Merged

feat(web): select a range of assets #3086

merged 1 commit into from
Jul 3, 2023

Conversation

uhthomas
Copy link
Member

@uhthomas uhthomas commented Jul 2, 2023

The shift key can be held to select a range of assets.

Screencast.from.2023-07-02.19-15-27.webm

Fixes: #2862

@vercel
Copy link

vercel bot commented Jul 2, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

1 Ignored Deployment
Name Status Preview Comments Updated (UTC)
immich ⬜️ Ignored (Inspect) Jul 3, 2023 9:54am

@uhthomas

This comment was marked as outdated.

@uhthomas uhthomas force-pushed the 2862 branch 3 times, most recently from d21597d to 1e8a13d Compare July 2, 2023 19:16
@alextran1502
Copy link
Contributor

This unfortunately does not work across time buckets, but thought it would be good to have this rather than nothing at all.

I think if we implement the feature, it will have to work across the time bucket, otherwise people will get confused

@uhthomas uhthomas force-pushed the 2862 branch 2 times, most recently from b7b3134 to 3697288 Compare July 2, 2023 22:58
@uhthomas
Copy link
Member Author

uhthomas commented Jul 2, 2023

This unfortunately does not work across time buckets, but thought it would be good to have this rather than nothing at all.

I think if we implement the feature, it will have to work across the time bucket, otherwise people will get confused

Done.

Screencast.from.2023-07-02.23-58-53.webm

@uhthomas uhthomas force-pushed the 2862 branch 7 times, most recently from 37ec32c to 3851d9e Compare July 3, 2023 01:12
Copy link
Contributor

@alextran1502 alextran1502 left a comment

Choose a reason for hiding this comment

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

Looks good, I've tested and it works very well! Thank you. I only have one question addressed above about the implementation, other than that, feel free to merge if you feel like this is good to go

selectAssetCandidates(lastAssetMouseEvent);
}

const getLastSelectedAsset = () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you help explaning this method?

Copy link
Member Author

Choose a reason for hiding this comment

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

So, I wanted the selection to start from the most recently selected asset. There is no "proper" way to get the most recently added item from a set, and so we have to essentially convert it to an array and get the last element. This function is equivalent to:

const s = new Set();
[...s].pop();

Though, this implementation is much quicker and uses much less memory.

The shift key can be held to select a range of assets.

Fixes: #2862
@uhthomas uhthomas enabled auto-merge (squash) July 3, 2023 09:55
@uhthomas uhthomas merged commit 8fd4edb into main Jul 3, 2023
19 checks passed
@uhthomas uhthomas deleted the 2862 branch July 3, 2023 09:57
@friki67
Copy link

friki67 commented Jul 7, 2023

Hello! Is this planned for "Explore" modes too?

@uhthomas
Copy link
Member Author

uhthomas commented Jul 7, 2023

Hello! Is this planned for "Explore" modes too?

I believe basically everything will use the timeline view at so point and consequently inherit this.

@gljames24
Copy link

It's not working in Archive for me. I'm on v1.70.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

immich should allow a range of images to be selected by holding shift
4 participants