mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-07-18 03:18:08 +00:00
improved internal viewer timeline
This commit is contained in:
@@ -46,6 +46,7 @@ public class ImagePanel extends JPanel implements ActionListener, FlashDisplay {
|
||||
private SWF swf;
|
||||
private HashMap<Integer, CharacterTag> characters;
|
||||
private int frameRate;
|
||||
private boolean loaded;
|
||||
|
||||
@Override
|
||||
public void setBackground(Color bg) {
|
||||
@@ -97,15 +98,18 @@ public class ImagePanel extends JPanel implements ActionListener, FlashDisplay {
|
||||
if (timer != null) {
|
||||
timer.cancel();
|
||||
}
|
||||
drawable = null;
|
||||
loaded = true;
|
||||
ImageIcon icon = new ImageIcon(data);
|
||||
label.setIcon(icon);
|
||||
}
|
||||
|
||||
public void setDrawable(final DrawableTag drawable, final SWF swf, final HashMap<Integer, CharacterTag> characters, int frameRate) {
|
||||
pause();
|
||||
pause();
|
||||
this.drawable = drawable;
|
||||
this.swf = swf;
|
||||
this.characters = characters;
|
||||
loaded = true;
|
||||
|
||||
if (drawable.getNumFrames() == 0) {
|
||||
label.setIcon(null);
|
||||
@@ -124,6 +128,8 @@ public class ImagePanel extends JPanel implements ActionListener, FlashDisplay {
|
||||
if (timer != null) {
|
||||
timer.cancel();
|
||||
}
|
||||
drawable = null;
|
||||
loaded = true;
|
||||
ImageIcon icon = new ImageIcon(image);
|
||||
label.setIcon(icon);
|
||||
}
|
||||
@@ -133,7 +139,11 @@ public class ImagePanel extends JPanel implements ActionListener, FlashDisplay {
|
||||
if (drawable == null) {
|
||||
return 0;
|
||||
}
|
||||
return percent * drawable.getNumFrames() / 100;
|
||||
int ret=(int)Math.ceil(percent * drawable.getNumFrames() / 100.0);
|
||||
if(ret==0){
|
||||
ret = 1;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -218,6 +228,6 @@ public class ImagePanel extends JPanel implements ActionListener, FlashDisplay {
|
||||
|
||||
@Override
|
||||
public boolean isLoaded() {
|
||||
return drawable != null;
|
||||
return loaded;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -81,7 +81,7 @@ public class PlayerControls extends JPanel implements ActionListener {
|
||||
progress.addMouseListener(new MouseAdapter() {
|
||||
@Override
|
||||
public void mousePressed(MouseEvent e) {
|
||||
int frame = e.getX() * display.getTotalFrames() / progress.getWidth();
|
||||
int frame = 1+(int)Math.floor(e.getX() * display.getTotalFrames() / (double)progress.getWidth());
|
||||
boolean p = paused;
|
||||
display.gotoFrame(frame);
|
||||
if (!p) {
|
||||
@@ -132,7 +132,7 @@ public class PlayerControls extends JPanel implements ActionListener {
|
||||
progress.setIndeterminate(true);
|
||||
} else {
|
||||
progress.setMaximum(totalFrames);
|
||||
progress.setMinimum(0);
|
||||
progress.setMinimum(1);
|
||||
progress.setValue(currentFrame);
|
||||
progress.setIndeterminate(false);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user