From 8b79e66dfb9493e17a0d1ebe66814639fa5134ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jindra=20Pet=C5=99=C3=ADk?= Date: Mon, 29 Nov 2021 14:53:16 +0100 Subject: [PATCH] Fixed AS1/2 - startDrag constaint --- CHANGELOG.md | 1 + .../decompiler/flash/action/model/StartDragActionItem.java | 4 +++- .../decompiler/flash/action/swf4/ActionStartDrag.java | 7 +++++-- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index da2199cf7..c9ac01f6e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -58,6 +58,7 @@ All notable changes to this project will be documented in this file. - AS - direct editation - long integer values - AS1/2 - on keypress key escaping - AS1/2 - stop/play/etc. can be used in expressions, pushing undefined +- AS1/2 - startDrag constaint ## [14.6.0] - 2021-11-22 ### Added diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/StartDragActionItem.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/StartDragActionItem.java index 80afa3eb3..68b6e0182 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/StartDragActionItem.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/StartDragActionItem.java @@ -26,7 +26,9 @@ import com.jpexs.decompiler.graph.GraphSourceItem; import com.jpexs.decompiler.graph.GraphSourceItemPos; import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.SourceGenerator; +import com.jpexs.decompiler.graph.model.FalseItem; import com.jpexs.decompiler.graph.model.LocalData; +import com.jpexs.decompiler.graph.model.TrueItem; import java.util.List; import java.util.Objects; @@ -64,7 +66,7 @@ public class StartDragActionItem extends ActionItem { @Override public GraphTextWriter appendTo(GraphTextWriter writer, LocalData localData) throws InterruptedException { boolean hasConstrains = true; - if (constrain instanceof DirectValueActionItem) { + if ((constrain instanceof DirectValueActionItem) || (constrain instanceof TrueItem) || (constrain instanceof FalseItem)) { if (Double.compare(constrain.getResultAsNumber(), 0) == 0) { hasConstrains = false; } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/swf4/ActionStartDrag.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/swf4/ActionStartDrag.java index d5f3cf27b..b920d1364 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/swf4/ActionStartDrag.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/swf4/ActionStartDrag.java @@ -12,7 +12,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. */ + * License along with this library. + */ package com.jpexs.decompiler.flash.action.swf4; import com.jpexs.decompiler.flash.BaseLocalData; @@ -26,6 +27,8 @@ import com.jpexs.decompiler.graph.GraphSourceItem; import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.SecondPassData; import com.jpexs.decompiler.graph.TranslateStack; +import com.jpexs.decompiler.graph.model.FalseItem; +import com.jpexs.decompiler.graph.model.TrueItem; import java.util.HashMap; import java.util.List; @@ -61,7 +64,7 @@ public class ActionStartDrag extends Action { GraphTargetItem constrain = stack.pop(); boolean hasConstrains = true; - if (constrain instanceof DirectValueActionItem) { + if ((constrain instanceof DirectValueActionItem) || (constrain instanceof TrueItem) || (constrain instanceof FalseItem)) { if (Double.compare(constrain.getResultAsNumber(), 0) == 0) { hasConstrains = false; }