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 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?
from my sub-class of AdjustableSpeedScrollPane (parentMap is set in the constructor):
[code] viewport.addMouseWheelListener(new MouseWheelListener() {
public void mouseWheelMoved(MouseWheelEvent e) {
if (e.getScrollAmount() == 0) return;
if (parentMap == null) return;
Zoomer mapZoomer = parentMap.getZoomer();
if (mapZoomer == null) return;
if (e.getScrollType() == MouseWheelEvent.WHEEL_UNIT_SCROLL) {
if (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()
);
}
}
}
});
[/code]