Skip to content

Commit 0a34cf0

Browse files
committed
#95 viewer scrolling speed via scrollbar adapted to zoom level
1 parent e4d1066 commit 0a34cf0

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

readxplorer-ui/src/main/java/de/cebitec/readxplorer/ui/datavisualisation/basepanel/AdjustmentPanel.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,7 @@ public void setCurrentScrollValue( int value ) {
119119
public void setCurrentZoomValue( int value ) {
120120
if( slider != null ) {
121121
slider.setCurrentZoomValue( value );
122+
scrollbar.setCurrentZoomValue( value );
122123
}
123124
}
124125

readxplorer-ui/src/main/java/de/cebitec/readxplorer/ui/datavisualisation/basepanel/ExtendedScroller.java

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,16 +35,20 @@ public class ExtendedScroller extends JScrollBar implements SynchronousNavigator
3535

3636
private static final long serialVersionUID = 7416234;
3737

38+
private static final int BLOCK_INCREMENT = 1000;
39+
private static final int UNIT_INCREMENT = 10;
3840
private int currentValue;
41+
private int currentZoomValue;
3942
private final List<AdjustmentPanelListenerI> listeners;
4043

4144

4245
public ExtendedScroller( int min, int max, int init ) {
4346
super( JSlider.HORIZONTAL, init, 0, min, max );
44-
this.setBlockIncrement( 1000 );
45-
this.setUnitIncrement( 10 );
47+
setBlockIncrement( BLOCK_INCREMENT );
48+
setUnitIncrement( UNIT_INCREMENT );
4649

47-
this.currentValue = init;
50+
currentValue = init;
51+
currentZoomValue = 1;
4852
listeners = new ArrayList<>();
4953
this.addAdjustmentListener( new AdjustmentListener() {
5054

@@ -100,7 +104,9 @@ public void setCurrentScrollValue( int value ) {
100104

101105
@Override
102106
public void setCurrentZoomValue( int value ) {
103-
107+
currentZoomValue = value;
108+
setBlockIncrement( BLOCK_INCREMENT * currentZoomValue / 10 );
109+
setUnitIncrement( UNIT_INCREMENT * currentZoomValue / 10 );
104110
}
105111

106112

0 commit comments

Comments
 (0)