From f843c628b13044bfb0a606eaa5c7c36ea0daffee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jindra=20Pet=C5=99=C3=ADk?= Date: Sat, 19 Apr 2025 20:14:59 +0200 Subject: [PATCH] Fixed: #2400 Transforming - buttons must use hittest frame outline --- CHANGELOG.md | 2 ++ .../decompiler/flash/timeline/Timeline.java | 3 +++ .../jpexs/decompiler/flash/gui/ImagePanel.java | 17 +++++++++++++++-- 3 files changed, 20 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 576ffb6c8..1daf0eb0c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -21,6 +21,7 @@ All notable changes to this project will be documented in this file. - [#2416] FLA export - shape fixing in some cases - [#2394] FLA export - shape tweens in some cases - Not reseting timeline after shape tag type conversion +- [#2400] Transforming - buttons must use hittest frame outline ## [22.0.2] - 2025-01-17 ### Added @@ -3719,6 +3720,7 @@ Major version of SWF to XML export changed to 2. [#2425]: https://www.free-decompiler.com/flash/issues/2425 [#2416]: https://www.free-decompiler.com/flash/issues/2416 [#2394]: https://www.free-decompiler.com/flash/issues/2394 +[#2400]: https://www.free-decompiler.com/flash/issues/2400 [#2375]: https://www.free-decompiler.com/flash/issues/2375 [#2374]: https://www.free-decompiler.com/flash/issues/2374 [#2389]: https://www.free-decompiler.com/flash/issues/2389 diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/timeline/Timeline.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/timeline/Timeline.java index f8581687c..85fb25481 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/timeline/Timeline.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/timeline/Timeline.java @@ -1296,6 +1296,9 @@ public class Timeline { renderContext.stateUnderCursor.add(layer); } } else if (absMat.transform(new ExportRectangle(boundRect)).contains(cursorPositionInView)) { + if ((drawable instanceof ButtonTag) && !renderContext.enableButtons) { + dframe = ButtonTag.FRAME_HITTEST; + } Shape shape = drawable.getOutline(true, dframe, dtime, layer.ratio, renderContext, absMat, true, viewRect, unzoom); if (shape.contains(cursorPositionInView)) { renderContext.stateUnderCursor.add(layer); diff --git a/src/com/jpexs/decompiler/flash/gui/ImagePanel.java b/src/com/jpexs/decompiler/flash/gui/ImagePanel.java index b1476eb52..5c0fb13bf 100644 --- a/src/com/jpexs/decompiler/flash/gui/ImagePanel.java +++ b/src/com/jpexs/decompiler/flash/gui/ImagePanel.java @@ -698,6 +698,10 @@ public final class ImagePanel extends JPanel implements MediaDisplay { if (drawableFrameCount == 0) { drawableFrameCount = 1; } + + if (dt instanceof ButtonTag) { + dframe = ButtonTag.FRAME_HITTEST; + } transform = new Matrix(ds.matrix); @@ -1363,7 +1367,7 @@ public final class ImagePanel extends JPanel implements MediaDisplay { int drawableFrameCount = dt.getNumFrames(); if (drawableFrameCount == 0) { drawableFrameCount = 1; - } + } double zoomDouble = zoom.fit ? getZoomToFit() : zoom.value; if (lowQuality) { @@ -1372,7 +1376,6 @@ public final class ImagePanel extends JPanel implements MediaDisplay { Matrix m = new Matrix(); m.translate(-_viewRect.xMin * zoomDouble, -_viewRect.yMin * zoomDouble); m.scale(zoomDouble); - int dframe = 0; Matrix transformation = Matrix.getScaleInstance(1 / SWF.unitDivisor).concatenate(m.concatenate(new Matrix(ds.matrix))); RECT dtRect = dt.getRect(); Rectangle2D dtRect2D = new Rectangle2D.Double(dtRect.Xmin, dtRect.Ymin, dtRect.getWidth(), dtRect.getHeight()); @@ -3339,6 +3342,11 @@ public final class ImagePanel extends JPanel implements MediaDisplay { } int dframe = time % drawableFrameCount; + + if (cht instanceof ButtonTag) { + dframe = ButtonTag.FRAME_HITTEST; + } + //Matrix finalMatrix = Matrix.getScaleInstance(1 / SWF.unitDivisor).concatenate(m).concatenate(new Matrix(ds.matrix)); Matrix transform2 = transform; @@ -4402,6 +4410,11 @@ public final class ImagePanel extends JPanel implements MediaDisplay { Matrix b = newMatrix; //getParentMatrix().concatenate(newMatrix); //.concatenate(new Matrix(ds.matrix).inverse()); int dframe = time % drawableFrameCount; + + if (cht instanceof ButtonTag) { + dframe = ButtonTag.FRAME_HITTEST; + } + double zoomDouble = zoom.fit ? getZoomToFit() : zoom.value; if (lowQuality) { zoomDouble /= LQ_FACTOR;