Skip to content

Feature: Added setting to select files and folders on mouse hover #9977

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

Conversation

ferrariofilippo
Copy link
Contributor

Resolved / Related Issues
Items resolved / related issues by this PR.

Validation
How did you test these changes?

  • Built and ran the app

@yaira2
Copy link
Member

yaira2 commented Sep 12, 2022

Left some comments regarding spaces and property names but code looks code.

@yaira2 yaira2 changed the title Feature: setting to select files and folders when hovering over them Feature: Added setting to select files and folders on mouse hover Sep 12, 2022
@yaira2 yaira2 added the changes requested Changes are needed for this pull request label Sep 12, 2022
@ferrariofilippo ferrariofilippo force-pushed the Select_Item_On_Hover_#3682 branch from f5ded36 to 5ed553f Compare September 12, 2022 11:40
@yaira2 yaira2 self-requested a review September 12, 2022 14:04
@yaira2 yaira2 added needs - code review and removed changes requested Changes are needed for this pull request labels Sep 12, 2022
yaira2
yaira2 previously approved these changes Sep 12, 2022
Copy link
Member

@yaira2 yaira2 left a comment

Choose a reason for hiding this comment

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

LGTM

I did notice some issues where the items weren't selected but let's wait for the update ListView styles from WinUI before making this an issue.

@yaira2
Copy link
Member

yaira2 commented Sep 12, 2022

@gave92 do you want to look this over before I merge it?

@gave92
Copy link
Member

gave92 commented Sep 12, 2022

Ok, I should be able to go over it later today.

@gave92
Copy link
Member

gave92 commented Sep 12, 2022

Sorry @ferrariofilippo I've pushed more changes than I wanted to. I'm gonna revert most of them shortly.

Aside from that the functionality works well. Possible improvements:

  • Selection does not work when hovering over "empty" spaces of an element (noticeable in Tiles view)

  • To match explorer hover selection should consider whether Control or Shift key are pressed in order to extend the selection

@gave92 gave92 self-requested a review September 12, 2022 23:07
gave92
gave92 previously approved these changes Sep 12, 2022
@yaira2
Copy link
Member

yaira2 commented Sep 12, 2022

Selection does not work when hovering over "empty" spaces of an element (noticeable in Tiles view)

I think we should fix this before merging

@ferrariofilippo
Copy link
Contributor Author

  • Selection does not work when hovering over "empty" spaces of an element (noticeable in Tiles view)

It's a problem of DetailsLayout too.
I'll fix that

@ferrariofilippo
Copy link
Contributor Author

I find out there's a problem when hovering an element's borders: PointerOver style is applied but PointerEntering event isn't raised

@yaira2
Copy link
Member

yaira2 commented Sep 14, 2022

I find out there's a problem when hovering an element's borders

This seems to happen pretty often 🤔

@ferrariofilippo
Copy link
Contributor Author

I read MS (Windows.UI.Xaml.Controls) ListView docs, and I learnt it doesn't support any ItemHovered event: you can only set a style for hovered items. Because of this, you have to use PointerEntered event of child items, which gets invoked only when known limits.

@yaira2
Copy link
Member

yaira2 commented Sep 14, 2022

Can this be solved by adding a border control to the ListView item and adding the PointerEntered event on that? I don't think it'll have that big of a performance hit but we should check the difference on a large directory like system32.

@ferrariofilippo
Copy link
Contributor Author

I'll try that

@ferrariofilippo
Copy link
Contributor Author

I found a way of fixing PointerEntered area for TilesLayout. Now I'm working on DetailsLayout.
Other layouts are fine

@gave92
Copy link
Member

gave92 commented Sep 16, 2022

I've pushed feee91f to propose a fix for hover on elements "empty space". It should work for all layout modes, with no need to change the xaml. Idea is to subscribe the pointer events on the ListViewItem container. What do you think?

@ferrariofilippo
Copy link
Contributor Author

I think it's great. Thank you for the fix!
It works perfectly

Copy link
Member

@yaira2 yaira2 left a comment

Choose a reason for hiding this comment

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

LGTM

@yaira2 yaira2 merged commit 41c8b37 into files-community:main Sep 16, 2022
@yaira2 yaira2 added ready to merge Pull requests that are approved and ready to merge and removed needs - code review labels Sep 16, 2022
container.PointerPressed += FileListItem_PointerPressed;
if (UserSettingsService.PreferencesSettingsService.SelectFilesOnHover)
Copy link
Member

Choose a reason for hiding this comment

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

It appears that we need to listen when this property changes as well, otherwise the user needs to restart the app for the setting to take effect.

Copy link
Member

Choose a reason for hiding this comment

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

True. Refreshing the file list should be enough though.

Copy link
Member

Choose a reason for hiding this comment

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

Can probably do the same thing we do when users change the setting to show hidden items.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ready to merge Pull requests that are approved and ready to merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Feature: Add setting to select files and folders when hovering over them with the mouse
3 participants