From e38fad027155c9c2ddb62270bf6d120487de3ed7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jindra=20Pet=C5=99=C3=ADk?= Date: Sat, 17 May 2025 19:19:42 +0200 Subject: [PATCH] Fixed: Snap align and snap to objects incorrect position when editing nested layers --- CHANGELOG.md | 1 + src/com/jpexs/decompiler/flash/gui/ImagePanel.java | 9 +++++---- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 68f597009..b52137631 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ All notable changes to this project will be documented in this file. ### Fixed - [#2456] FLA export - NullPointer exception while exporting to CS4 or lower via commandline +- Snap align and snap to objects incorrect position when editing nested layers ### Fixed - Resize export dialogs labels to match localized strings diff --git a/src/com/jpexs/decompiler/flash/gui/ImagePanel.java b/src/com/jpexs/decompiler/flash/gui/ImagePanel.java index bd2024099..c33dad0c6 100644 --- a/src/com/jpexs/decompiler/flash/gui/ImagePanel.java +++ b/src/com/jpexs/decompiler/flash/gui/ImagePanel.java @@ -1956,13 +1956,12 @@ public final class ImagePanel extends JPanel implements MediaDisplay { Double snapOffsetY = null; double zoomDouble = getRealZoom(); + Matrix parentMatrix = getParentMatrix(); if (Configuration.snapAlign.get() && timelined != null && points == null && transform != null) { Frame fr = timelined.getTimeline().getFrame(frame); if (fr != null) { - Timeline timeline = timelined.getTimeline(); - - Matrix parentMatrix = getParentMatrix(); + Timeline timeline = timelined.getTimeline(); Point2D mouseTransPoint = toTransformPoint(new Point2D.Double(e.getX(), e.getY())); double ex = mouseTransPoint.getX(); @@ -2141,8 +2140,9 @@ public final class ImagePanel extends JPanel implements MediaDisplay { Matrix dsMatrix = new Matrix(); if (ds.matrix != null) { - dsMatrix = new Matrix(ds.matrix); + dsMatrix = new Matrix(ds.matrix); } + dsMatrix = dsMatrix.concatenate(parentMatrix); Rectangle2D bounds = dsMatrix.transform(new Rectangle2D.Double(rect.Xmin, rect.Ymin, rect.Xmax - rect.Xmin, rect.Ymax - rect.Ymin)); bounds = new Rectangle2D.Double( @@ -2304,6 +2304,7 @@ public final class ImagePanel extends JPanel implements MediaDisplay { if (depthStateUnderCursor.matrix != null) { matrix = matrix.preConcatenate(new Matrix(depthStateUnderCursor.matrix)); } + matrix = matrix.concatenate(parentMatrix); Matrix scaleMatrix = Matrix.getScaleInstance(zoomDouble / SWF.unitDivisor);