Create account / Log in

Mouse-Wheel Behavior

Suggestions for additional features for the module editor and Vassal engine.

Moderators: uckelman, Tim M

Mouse-Wheel Behavior

Postby bdgza » October 12th, 2010, 11:34 am

I probably posted in the wrong forum, I'll try here.

I have written some custom sub-classes for my module to change the mouse-wheel behavior. I understand the default VASSAL is:
mouse-wheel = scrolling vertical
CTRL+mouse-wheel = scrolling horizontal

I changed it for my module to:
mouse-wheel = scrolling vertical
SHIFT+mouse-wheel = scrolling horizontal (the default MacOS X method)
CTRL+mouse-wheel = zoom in/out

Is there any reason why this should not be the standard VASSAL way of using the mouse-wheel in all modules? Implementing this as standard (at least in the MacOS X) version will allow my 2-axis scroll-wheel to scroll horizontal as Logitech picks up the SHIFT+mouse-wheel automatically. I never even knew about the CTRL+mouse-wheel for horizontal scrolling until I looked into making these sub-classes, I simply thought horizontal scrolling in VASSAL was broken.

---
from my sub-class of AdjustableSpeedScrollPane (parentMap is set in the constructor):

Code: Select all
viewport.addMouseWheelListener(new MouseWheelListener() {
            public void mouseWheelMoved(MouseWheelEvent e) {
               if (e.getScrollAmount() == 0) return;
               
               Zoomer mapZoomer = null;
                 
               if (parentMap != null)
                  mapZoomer =  parentMap.getZoomer();
               
               if (e.getScrollType() == MouseWheelEvent.WHEEL_UNIT_SCROLL) {
                  if ((mapZoomer != null) && (e.isControlDown())) {
                     // zoom
                     int notches = e.getWheelRotation();
                     int amount = e.getScrollAmount();

                     for (int i = 0; i < amount; i++) {
                        if (e.getScrollType() == MouseWheelEvent.WHEEL_UNIT_SCROLL) {
                           if (notches < 0) {
                              //UP
                              mapZoomer.zoomIn();
                           } else {
                              //DOWN
                              mapZoomer.zoomOut();
                           }
                        }
                     }

                  } else {
                     JScrollBar bar = e.isShiftDown() ?
                           horizontalScrollBar :
                              verticalScrollBar;
                     if (bar == null || !bar.isVisible()) return;

                     bar.setValue(
                           bar.getValue() +
                           e.getUnitsToScroll() *
                           bar.getUnitIncrement()
                     );
                  }
               }
            }
         });
bdgza
 
Posts: 311
Joined: February 26th, 2010, 10:51 am

Re: [messages] [Feature Requests] Mouse-Wheel Behavior

Postby uckelman » October 12th, 2010, 11:55 am

Thus spake bdgza:
> I probably posted in the wrong forum, I'll try here.
>
> I have written some custom sub-classes for my module to change the
> mouse-wheel behavior. I understand the default VASSAL is:
> mouse-wheel = scrolling vertical
> CTRL+mouse-wheel = scrolling horizontal
>
> I changed it for my module to:
> mouse-wheel = scrolling vertical
> SHIFT+mouse-wheel = scrolling horizontal (the default MacOS X method)
> CTRL+mouse-wheel = zoom in/out
>
> Is there any reason why this should not be the standard VASSAL way of
> using the mouse-wheel in all modules? Implementing this as standard (at
> least in the MacOS X) version will allow my 2-axis scroll-wheel to
> scroll horizontal as Logitech picks up the SHIFT+mouse-wheel
> automatically. I never even knew about the CTRL+mouse-wheel for
> horizontal scrolling until I looked into making these sub-classes, I
> simply thought horizontal scrolling in VASSAL was broken.
>

One reason I can think of for not doing this now is that at some point,
we're going to switch to the standard navigation controls that you have
in various games and also in Google Maps:

* drag = scroll
* mousewheel = zoom
* some keys = rotate

I have my doubts that changing this now, and then changing it again in
about a year is a good idea.

What I think would be a better solution would be to make all of the key
and mouse bindings user configurable in the preferences. That way, if
you want CTRL+wheel to zoom, you can, or if you want something else, you
can have that, too.

Is this something you'd be interested in working on? If so, I can show
you how to get started with the new Preferences code for 3.2.

--
J.
User avatar
uckelman
Site Admin
 
Posts: 8797
Joined: December 10th, 2007, 9:48 am
Location: Durham, England

Re: Mouse-Wheel Behavior

Postby bdgza » October 12th, 2010, 12:57 pm

With help to get started I wouldn't mind giving it a go.
bdgza
 
Posts: 311
Joined: February 26th, 2010, 10:51 am

Re: [messages] [Feature Requests] Re: Mouse-Wheel Behavior

Postby uckelman » October 12th, 2010, 1:08 pm

Thus spake bdgza:
> With help to get started I wouldn't mind giving it a go.
>

The first thing to do would be to locate all the places in the code where
we set hotkeys or mouse controls. Things to look for would be uses of the
KeyStroke and KeyEvent clases, MouseWheelEvent, and MouseWheelListener.
Possibly also these: MouseEvent, MouseListener, MouseMotionEvent,
MouseMotionListener. From that, make a list of what hotkeys and mouse
controls we already have.

Can you do that?

--
J.
User avatar
uckelman
Site Admin
 
Posts: 8797
Joined: December 10th, 2007, 9:48 am
Location: Durham, England

Re: Mouse-Wheel Behavior

Postby bdgza » October 12th, 2010, 1:09 pm

I'll get on it and report back.
bdgza
 
Posts: 311
Joined: February 26th, 2010, 10:51 am

Re: Mouse-Wheel Behavior

Postby bdgza » October 17th, 2010, 10:45 am

I had a rough week and not much time to look into this again earlier.

When you say "where we set hotkeys or mouse controls" you mean user operation of controls, like toolbar, maps, boards, etc? Not every listener/adapter everywhere? You want me to list that SplashScreen adds a MouseAdapter to listen for a mouseReleased event?

Remember that I am not very familiar with the VASSAL code.

Cleaned up list of references to Mouse controls:
...

I tried to make a similar list of cleaned up Key references, but this turns out to be difficult. "Key" is used in more ways than keyboard keys, Keys as in IDs:
...

The full lists didn't fit in the post, so I will post just the filenames. Mouse:

Inventory
GridEditor
PolygonEditor
RegionGrid
CounterDetailViewer
GlobalMap
HidePiecesButton
HighlightLastMoved
KeyBufferer
LOS_Thread
MapCenterer
MenuDisplayer
PieceMover
SetupStack
StackExpander
Map
MultiRoll
PlayerHand
PrivateMap
TurnTracker
HtmlChart
PieceSlot
ServerAddressBook
ChatServerControls
RoomInteractionControlsInitializer
ChooseComponentDialog
ConfigureTree
ExtensionTree
ActionButton
DragBuffer
FreeRotator
ImagePicker
PieceDefiner
PropertySheet
TranslateWindow
ModuleManagerWindow
ADC2Module
ScrollPane
SplashScreen
AboutWindow

Keys:

WizardDisplayerImpl
GameModule
BasicCommandEncoder
BasicLogger
ChartWindow
Chatter
DiceButton
DoActionButton
TextItem
GlobalKeyCommand
GlobalOptions
Inventory
GridEditor
HexGridNumbering
PolygonEditor
RegionGrid
CounterDetailViewer
DeckGlobalKeyCommand
DrawPile
ForwardToChatter
ForwardToKeyBuffer
GlobalMap
HidePiecesButton
ImageSaver
KeyBufferer
LayerControl
LOS_Thread
MapShader
MassKeyCommand
MenuDisplayer
PieceMover
PieceRecenterer
Scroller
SetupStack
StackExpander
StackMetrics
TextSaver
Zoomer
Map
MultiRoll
NotesWindow
PieceWindow
PrivateMap
ChangePropertyButton
SpecialDiceButton
ToolbarMenu
TurnGlobalHotkey
TurnTracker
PieceSlot
PrivMsgCommand
SoundEncoder
ChatServerControls
VASSAL
SendSoundAction
RemovePiece
AutoConfigurer
BeanShellExpressionConfigurer
Configurer
ConfigureTree
HotKeyConfigurer
KeyModifiersConfigurer
KeyStrokeArrayConfigurer
NamedHotKeyConfigurer
NamedKeyStrokeArrayConfigurer
StringConfigurer
TextConfigurer
ActionButton
AreaOfEffect
BasicPiece
CalculatedProperty
Clone
CounterGlobalKeyCommand
Deck
Decorator
Delete
DynamicProperty
Embellishment
Footprint
FreeRotator
GamePiece
GlobalCommand
GlobalHotKey
Hideable
Immobilized
KeyBuffer
KeyCommand
KeyCommandSubMenu
KeySpecifier
Labeler
Marker
MovementMarkable
MultiImagePicker
NonRectangular
Obscurable
PieceDefiner
Pivot
PlaceMarker
PlaySound
Properties
PropertySheet
Replace
ReportState
RestrictCommands
Restricted
ReturnToDeck
SendToLocation
SetGlobalProperty
Stack
SubMenu
TableInfo
Translate
TriggerAction
UsePrototype
Localization
Resources
TranslatableAttribute
TranslateVassalWindow
TranslateWindow
VassalTranslation
BasicModule
EditorWindow
ModuleEditorWindow
Prefs
AbstractInterpreter
JavaNameConfigurer
HotkeySpecifier
ImageUtils
RenderingClues
SVGRenderer
org
AbstractOpImpl
ADC2Module
SymbolSet
KeyStrokeListener
KeyStrokeSource
LaunchButton
MacOSXMenuManager
MenuManager
NamedKeyManager
NamedKeyStroke
NamedKeyStrokeListener
Op
OpCache
SequenceEncoder
bdgza
 
Posts: 311
Joined: February 26th, 2010, 10:51 am

Re: Mouse-Wheel Behavior

Postby blackice » February 2nd, 2011, 12:40 pm

Hi!

Further on mouse-wheel behaviour: Is there a way to scroll horizontally on a Mac? I tried combining CTRL, SHIFT, ALT and COMMAND with the mouse wheel, but nothing produces horizontal scrolling.

Ideally, of course, the horizontal scrolling on the Mighty Mouse would produce horizontal scrolling in VASSAL.

Any suggestions on what I can do already are most welcome.

Otherwise, please add to the list of request for future features.

Thanks,

Martin
User avatar
blackice
 
Posts: 41
Joined: August 13th, 2010, 7:21 pm
Location: Vancouver, BC, Canada

Re: Mouse-Wheel Behavior

Postby DrNostromo » February 2nd, 2011, 3:40 pm

I don't know about a Mac but on a PC, if you hold the mouse pointer over the horizontal scroll bar at the bottom of the map, the wheel will then scroll the map horizontally.
User avatar
DrNostromo
 
Posts: 1061
Joined: December 21st, 2007, 3:54 am
Location: Wine Country, Cal. USA

Re: [messages] [Feature Requests] Re: Mouse-Wheel Behavior

Postby pgeerkens » February 2nd, 2011, 3:57 pm

That's cool!

But does it bother others that the horizontal mouse-wheel scrolling is
backwards, with up equated to left instead of right? It drives me batty.

Pieter

-----Original Message-----
From: messages-bounces@vassalengine.org
[mailto:messages-bounces@vassalengine.org] On Behalf Of DrNostromo
Sent: Wednesday, February 02, 2011 10:41 AM
To: messages@vassalengine.org
Subject: [messages] [Feature Requests] Re: Mouse-Wheel Behavior

I don't know about a Mac but on a PC, if you hold the mouse pointer over
the horizontal scroll bar at the bottom of the map, the wheel will then
scroll the map horizontally.

_______________________________________________
Read this topic online here:
viewtopic.php?p=21697#p21697
Pieter
-----------------------------------------
"Even on the attack, I found the spade [to be] the equal of the rifle."
Erwin Rommel, Infantry Attacks
User avatar
pgeerkens
 
Posts: 228
Joined: September 12th, 2010, 4:33 am
Location: Hamilton, Ontario, Canada

Re: Mouse-Wheel Behavior

Postby blackice » February 3rd, 2011, 8:52 am

DrNostromo wrote:I don't know about a Mac but on a PC, if you hold the mouse pointer over the horizontal scroll bar at the bottom of the map, the wheel will then scroll the map horizontally.


Thanks, that works on a Mac, too!

Requires a little extra "mousing" compared to the maximum comfort solution but is a big improvement already.

Cheers,

Martin
User avatar
blackice
 
Posts: 41
Joined: August 13th, 2010, 7:21 pm
Location: Vancouver, BC, Canada

Re: [messages] [Feature Requests] Re: Mouse-Wheel Behavior

Postby blackice » February 3rd, 2011, 8:54 am

pgeerkens wrote:But does it bother others that the horizontal mouse-wheel scrolling is
backwards, with up equated to left instead of right? It drives me batty.


On the Mac, the Mighty Mouse ball can be scrolled left-right when hovering over the bar – and the map moves horizontally!

Nice.
User avatar
blackice
 
Posts: 41
Joined: August 13th, 2010, 7:21 pm
Location: Vancouver, BC, Canada


Return to Feature Requests

Who is online

Users browsing this forum: No registered users and 0 guests