From 30a58d8c8ec516a41e627a0b09104a8799bc1734 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jindra=20Pet=C5=99=C3=ADk?= Date: Sun, 23 Oct 2022 17:06:23 +0200 Subject: [PATCH] Fixed debug info label position/content on the top of flash viewer to avoid unwanted initial scroll --- CHANGELOG.md | 1 + .../jpexs/decompiler/flash/gui/ImagePanel.java | 15 +++++++++++---- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ca06e951a..ba226084e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,7 @@ All notable changes to this project will be documented in this file. - [#1838] AS3 - Properly handling of long unsigned values, hex values, default uint values etc. - [#1847] shape viewer and PDF exporter - correct drawing of pure vertical/horizontal shapes (zero width/height) - Slow zooming/redrawing on action when SWF has low framerate +- Correct debug info label position/content on the top of flash viewer to avoid unwanted initial scroll ### Changed - AS3 integer values are internally (e.g. in the lib) handled as java int type instead of long. diff --git a/src/com/jpexs/decompiler/flash/gui/ImagePanel.java b/src/com/jpexs/decompiler/flash/gui/ImagePanel.java index f1992c30b..5a5963618 100644 --- a/src/com/jpexs/decompiler/flash/gui/ImagePanel.java +++ b/src/com/jpexs/decompiler/flash/gui/ImagePanel.java @@ -133,7 +133,9 @@ public final class ImagePanel extends JPanel implements MediaDisplay { private int mouseButton; - private final JLabel debugLabel = new JLabel("-"); + private static final String DEFAULT_DEBUG_LABEL_TEXT = " - "; + + private final JLabel debugLabel = new JLabel(DEFAULT_DEBUG_LABEL_TEXT); private Point cursorPosition = null; @@ -1288,7 +1290,7 @@ public final class ImagePanel extends JPanel implements MediaDisplay { if (selectedDepth > -1) { showSelectedName(); } else { - debugLabel.setText(" - "); + debugLabel.setText(DEFAULT_DEBUG_LABEL_TEXT); } } @@ -2230,7 +2232,7 @@ public final class ImagePanel extends JPanel implements MediaDisplay { } if (first) { - ret.append(" - "); + ret.append(DEFAULT_DEBUG_LABEL_TEXT); } } @@ -2240,7 +2242,12 @@ public final class ImagePanel extends JPanel implements MediaDisplay { iconPanel.setImg(img); lastMouseOverButton = iconPanel.mouseOverButton; iconPanel.mouseOverButton = renderContext.mouseOverButton; - debugLabel.setText(ret.toString()); + if (ret.isEmpty()) { + debugLabel.setText(DEFAULT_DEBUG_LABEL_TEXT); + } else { + debugLabel.setText(ret.toString()); + } + if (freeTransformDepth == -1) { if (handCursor) { iconPanel.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));