Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@t-wallet
Copy link
Contributor

Hi!

For my use case I would like to know whether shift was pressed when a SceneMouseEvent happened, but the docs gave me no indication of such a function. By reading the source code I found out that I could grab them via the mouse_event attribute, but I figure it's not supposed to be accessed directly because it's not marked as a property. This PR thus exposes the modifiers as a property of SceneMouseEvent.

@djhoese
Copy link
Member

djhoese commented Sep 15, 2025

Hm interesting. It almost makes me wonder if you are meant to access it via the .mouse_event attribute. Do you happen to know what the type of mouse_event is? Either way, it seems like there should be a better long term solution, but this solution seems good enough for me. Thanks!

@t-wallet
Copy link
Contributor Author

A quick search around the codebase indicates it is probably a MouseEvent (decl. in vispy.app.canvas). I don't think the original author intended mouse_event to be accessed directly, as they added a bunch of getters for various other MouseEvent attributes (buttons, etc). If it was intended to be accessed directly, those getters would be superfluous.

@djhoese
Copy link
Member

djhoese commented Sep 15, 2025

Yeah, good point.

@brisvag brisvag closed this Dec 8, 2025
@brisvag brisvag reopened this Dec 8, 2025
@brisvag
Copy link
Collaborator

brisvag commented Dec 8, 2025

Oops, sorry for closing, I thought I was on the issue for #2713 🤦

@brisvag
Copy link
Collaborator

brisvag commented Dec 8, 2025

Just to make sure @t-wallet, this is complementary to #2713 and still useful for you?

@t-wallet
Copy link
Contributor Author

t-wallet commented Dec 8, 2025

Just to make sure @t-wallet, this is complementary to #2713 and still useful for you?

Yes, definitely still useful. Thanks for the reviews!

@brisvag
Copy link
Collaborator

brisvag commented Dec 8, 2025

Alright, then let's get this in too! Thank you for the PRs :)

@brisvag brisvag merged commit 47e7e33 into vispy:main Dec 8, 2025
31 of 32 checks passed
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.

3 participants