fix drag-zoom visual

This commit is contained in:
Eyck Jentzsch 2020-03-14 15:31:51 +01:00
parent f5a4e3c39e
commit e87e1791c3
2 changed files with 6 additions and 3 deletions

View File

@ -235,6 +235,7 @@ public class WaveformCanvas extends Canvas{
public void setZoomLevel(int level, long centerTime) {
long oldScaleFactor=scaleFactor;
if(level<0) level = 0;
if(level<Constants.unitMultiplier.length*Constants.unitString.length){
this.level = level;
this.scaleFactor = (long) Math.pow(10, level/2);

View File

@ -180,9 +180,11 @@ public class WaveformViewer implements IWaveformViewer {
GC gc = e.gc;
gc.setAlpha(128);
int minX = Math.min(start.x, end.x);
int maxX = Math.max(start.x, end.x);
int width = maxX - minX;
gc.fillRectangle(minX, 0, width, e.height);
int width = Math.max(start.x, end.x) - minX;
Point origin = waveformCanvas.getOrigin();
int y_top = waveformCanvas.getRulerHeight()- origin.y;
int y_bottom = waveformCanvas.getSize().y;
gc.fillRectangle(minX, y_top, width,y_bottom);
}
}