From 4629571779faaa08341fc915fec5b991e30f444b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jindra=20Pet=C5=99=C3=ADk?= Date: Thu, 31 Oct 2024 19:54:24 +0100 Subject: [PATCH] Simple editor - Double click movie clips to edit subobjects --- CHANGELOG.md | 2 +- .../decompiler/flash/gui/ImagePanel.java | 21 +++++++------------ 2 files changed, 8 insertions(+), 15 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index efa4532d3..c5fa2e70d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,7 +6,7 @@ All notable changes to this project will be documented in this file. - Simple editor view - new simplified UI based on timeline view, which resembles Flash Pro UI. Easier moving objects, resizing, adding frames, adding objects to stage. Instance property editation. - Undo / redo feature. WIP + Undo / redo feature. Double click movie clips to edit subobjects. ## [21.1.3] - 2024-10-29 ### Fixed diff --git a/src/com/jpexs/decompiler/flash/gui/ImagePanel.java b/src/com/jpexs/decompiler/flash/gui/ImagePanel.java index f303273b8..1dd9c3732 100644 --- a/src/com/jpexs/decompiler/flash/gui/ImagePanel.java +++ b/src/com/jpexs/decompiler/flash/gui/ImagePanel.java @@ -1179,11 +1179,7 @@ public final class ImagePanel extends JPanel implements MediaDisplay { @Override public void mouseClicked(MouseEvent e) { - if (e.getClickCount() == 2 && selectionMode && !transformSelectionMode) { - - if (true) { //WIP, not yet ready - return; - } + if (e.getClickCount() == 2 && selectionMode && !transformSelectionMode) { DepthState ds = depthStateUnderCursor; if (ds != null) { @@ -1537,29 +1533,25 @@ public final class ImagePanel extends JPanel implements MediaDisplay { if (transform == null) { return; } - Matrix p = getParentMatrix(); + Matrix parentMatrix = getParentMatrix(); Point2D mouseTransPoint = toTransformPoint(new Point2D.Double(e.getX(), e.getY())); - //mouseTransPoint = p.transform(mouseTransPoint); double ex = mouseTransPoint.getX(); double ey = mouseTransPoint.getY(); Point2D dragStartTransPoint = toTransformPoint(dragStart); - //dragStartTransPoint = p.transform(dragStartTransPoint); double dsx = dragStartTransPoint.getX(); double dsy = dragStartTransPoint.getY(); double deltaX = ex - dsx; double deltaY = ey - dsy; - //AffineTransform pt = p.toTransform(); - AffineTransform newTransform = new AffineTransform(transform.toTransform()); - AffineTransform t = new AffineTransform(); + AffineTransform t = parentMatrix.toTransform(); t.translate(deltaX, deltaY); + t.concatenate(parentMatrix.inverse().toTransform()); newTransform.preConcatenate(t); - Point2D newRegistrationPoint = new Point2D.Double(); - t.transform(registrationPoint, newRegistrationPoint); + Point2D newRegistrationPoint = new Matrix(t).preConcatenate(parentMatrix.inverse()).concatenate(parentMatrix).transform(registrationPoint); transformUpdated = newTransform; registrationPointUpdated = newRegistrationPoint; @@ -1836,8 +1828,9 @@ public final class ImagePanel extends JPanel implements MediaDisplay { double deltaY = ey - dsy; AffineTransform newTransform = new AffineTransform(transform.toTransform()); - AffineTransform t = new AffineTransform(); + AffineTransform t = parentMatrix.toTransform(); t.translate(deltaX, deltaY); + t.concatenate(parentMatrix.inverse().toTransform()); newTransform.preConcatenate(t); Point2D newRegistrationPoint = new Matrix(t).preConcatenate(parentMatrix.inverse()).concatenate(parentMatrix).transform(registrationPoint);