You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
31 lines
862 B
31 lines
862 B
package com.fr.design.mainframe; |
|
|
|
import java.awt.event.MouseWheelEvent; |
|
import java.awt.event.MouseWheelListener; |
|
|
|
/** |
|
* @author Starryi |
|
* @version 1.0 |
|
* Created by Starryi on 2021/9/23 |
|
*/ |
|
public class DesignerScaleMouseWheelHandler implements MouseWheelListener { |
|
private final ScalePane scalePane; |
|
private final int step; |
|
|
|
public DesignerScaleMouseWheelHandler(ScalePane scalePane, int step) { |
|
this.scalePane = scalePane; |
|
this.step = step; |
|
} |
|
|
|
@Override |
|
public void mouseWheelMoved(MouseWheelEvent e) { |
|
int dir = e.getWheelRotation(); |
|
JFormSliderPane slidePane = this.scalePane.getSlidePane(); |
|
int old_resolution = slidePane.getShowValue(); |
|
slidePane.setShowValue(old_resolution - (dir * step)); |
|
} |
|
|
|
public interface ScalePane { |
|
JFormSliderPane getSlidePane(); |
|
} |
|
}
|
|
|