-
-
Notifications
You must be signed in to change notification settings - Fork 380
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
ModelSpinner - use middle mouse button to spin model #5594
ModelSpinner - use middle mouse button to spin model #5594
Conversation
Also, in my opinion there is a problem with this patch - what to do for people like me - without the middle button (touchpad only) - in other places there is either the ability to twist it with the numpad, or there is a button on the panel for this. |
Would an option in the settings work? 'No middle button present' |
Tried it out and it seem to work well. There is now a setting option that will set the mousebutton to '0', the old value, instead. I've been wrestling with the compiler for a couple of hours which is reflected in the variable names. I'll clean that up should this function be wanted. |
@zonkmachine I like the option idea, but I think the option is very global, and it seems that it should somehow affect other places as well - Sector Map, System Map, World View. For example, a person who has a middle button activates this checkbox, but his middle button will still work, which seems odd? |
The other MMB rotation screens have a "left click and hold"-button [to rotate], no? |
@impaktor WorldView no. |
Yes, I just picked the ones mentioned in the issue to try it out. I think I got a better grip of the issue now and I've pushed similar changes for the places you mention here. I don't know if there is an instance of rotation that I've missed. |
I tested the last commit and it seems to work well, I would definitely enable this option for myself. What do you think about it, @impaktor? |
So if no middle mouse button (option is selected), you rotate with some other mouse button? Or how does this work? What's the trade off? Also, are there no tooltip for the other control options in the settings menu? (If there are, then this should also have, explaining it changes how to rotate ships and maps) |
No trade off. If you don't have a middle mouse button you go back to the old way with the left mouse button. Now also implemented so all spin actions work the same, with either middle mouse button or left mouse button.
I haven't seen any for the other options. |
But left mouse button does other things in some of the screens, right? Like in the maps? (Pardon me being too lazy to read the source, or start the game or test the PR) |
Yes but we already test for hover on. Pioneer knows if you, for instance in the Sector View where you can grab the scene and spin it, or use the button on the right side and grab that and spin it. Left mouse button both times.
I think that's the way to go. Grabbing something and manipulating it with a mouse is a complex thing to do. It's easy to see what the PR does when you test it and compare to how it is today. |
dc9de9c
to
4a194a4
Compare
Fixed up variable names and strings. Squashed and ready for review. Tested and works like a charm... :P |
@@ -245,6 +248,7 @@ class Input::Manager { | |||
|
|||
bool joystickEnabled; | |||
bool mouseYInvert; | |||
bool noMiddleMouseButton; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I adopted to surrounding code here but shouldn't they be member variables, m_mouseYInvert, m_noMiddleMouseButton... etc?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Technically yes, they're this way for legacy reasons. Let me review the PR further before I make a decision as to whether it's worth converting them.
The "best" way to handle this IMO is to have this checkbox toggle on an additional code-path which looks for e.g. alt-LMB / ctrl-LMB and handles that as a middle-mouse press in all screens. The choice of key should most likely be configurable by the user as a binding, and all callsites which use MMB pan/rotate should be updated for this option. I believe this is how Mac software usually handles pan/rotate when both left+right mouse button have semantic actions already (though without the configurable modifier key). The advantage to this approach is it allows screens with already-heavily overloaded mouse actions (e.g. WorldView) to support interaction without MMB while not sacrificing the ability of the user to quickly perform important actions in combat or flight. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are several regressions with this option enabled:
- You can no longer left-click on systems in the Sector map to select them.
- Every time you pan in the System map you deselect the current selected object (changes tree visibility in the outliner and hides the info window).
- Same with the System atlas map, panning deselects the currently selected object.
- As mentioned in a separate comment, it becomes impossible to aim while firing in combat.
src/ship/ShipViewController.cpp
Outdated
const int mouseButton = (Pi::input->IsMiddleMouseButton() ? SDL_BUTTON_LEFT : SDL_BUTTON_MIDDLE); | ||
bool mouse_down = Pi::input->MouseButtonState(mouseButton); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm unwilling to accept this as-is, given that the left-mouse button is overloaded to fire weapons while rotating the ship (in PlayerShipController IIRC). This means that as soon as the player starts firing in combat, their view is going to rotate wildly with every correction of the mouse while aiming.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can probably be a problem if you have a mouse without a middle button or wheel, but in the case of a touchpad, it is pretty convenient to shoot with a spacebar.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Certainly, but the expectation for most people playing on desktop is they fire with a mouse button click. Spacebar for most people is mentally associated with "go up" rather than "shoot", especially in 6-DOF style games.
EDIT: either way, the feedback here would not affect the ability to fire with spacebar, but rather mentioning that the current version of the PR accidentally removes the ability to shoot with a mouse.
I think the aim of this PR is great: to unify MMB for spinning, and an checkbox option for those without MMB, to then use modifier-key + LMB, for instance. But as noted in the three last posts above, there's more to do before this PR is ready for review. Hope @zonkmachine finds time for this again at some point & rebase to prevent bitrot. |
Sorry for the late reply. I'm busy with real world stuff and won't have time to look into this anytime soon. I unfortunately failed to rebase it on current master. If someone want's to pick up this PR they are most welcome. |
* Make grab/spin action consistent and default to middle mouse button. * Option to use left mouse button in cases where no middle mouse button is available such as on a laptop.
4a194a4
to
fe53e62
Compare
Done. I'm looking into the feedback from the review. |
Maybe activate this only when landed/docked? |
Having just read my way through this (although not tested yet, sorry), how about: + <some mouse-button (left or right)> : rotate ie, no need for a separate setting; the middle-mouse-button, if a user has one, is simply an additional alternative for the standard modifier+button option. I guess Mac users have it even worse in that they don't even have a RMB.. (always found that a bit weird - "let's make it easier for users and remove the confusing right-mouse-button. Oh, hmm, we actually need more button functionality on the mouse so let's make them press a key on the keyboard to emulate a RMB instead..") Eventually I guess the mouse needs to become a "first class citizen" input device and be configurable in the key bindings just like keys/joysticks can be, with sane defaults. For example, swapping LMB/RMB for left-handed users (unless the framework already takes care of that with OS settings?) |
If you want to adopt this PR, or close it with another solution, please do. My computer broke down and I'm busy with life in general so I may not touch this in along time. 😉 |
That sucks :( But yeah, I can try to finish this PR.. I guess the main question to all is : how do we want to unify spinning things in Pioneer? A quick bit of research indicates the MMB is used by most CAD software to rotate. However, they usually don't have a fallback. In this case, we'd like a fallback using, probably, a modifier and the LMB (to cater for Mac users), although I guess it ought to be user-configurable. So we have 2 types of spinny things - ones in which the LMB already does something (Sector View, World View), and where it doesn't (the various displays allowing the user to spin the ship model). Do we really want to require a modifier for spinning the ship model as well? Also, some of the views could do with using additional mouse buttons to "do" things, mainly the map screens could use mouse buttons (possibly with modifiers) in order to drag the view, not just spin it. Summary of current spinny things: Ship model spinning (New Game, Info View, Station View) LMB (hold) - spin ship World View: MMB - move view Sector View: LMB (click) - select system System View: Orrery: LMB (click) - select object Details: LMB (click) - select object |
I wouldn't cater to Mac users frankly. Why put limitations in because some manufacturer of overpriced hardware who can't put in the effort to design a proper mouse? (especially since they were instrumental in popularizing it in the olden times) Or for users who won't buy one. Sorry, I'm a bit salty about that, but I really dislike that kind of needless oversimplification, which hurts a lot of users because of a few. I agree that ideally it is user configurable. But how complicated that would be? |
Ah, I didn't realise we no longer have Mac builds.. figured Mac was basically Linux from a dev perspective.
I wasn't proposing limitations, just additional functionality. Ie: MMB - spin stuff Modifier + LMB - also spin stuff - useful for people without MMB in gerneral, which just so happens to cater to Mac users as well. No need for a "don't have a MMB" option. And probably much easier to get right than trying to detect if the mouse is currently over a selectable screen object or an "empty" space.
Not very.. our general input system already has an optional user-configurable secondary binding for every action. |
.. ok, so I was looking at unifying all spinning by adding a I guess for now I can duplicate the |
Added some fixes and changes and made a new PR as I can't push to the original branch.. Please continue discussion in #5981 |
Closed this one. Superseded by #5981 |
Use middle mouse button in model spinner.
Fixes #5544