WIP: Double click to item on timeline edits item in place

This commit is contained in:
Jindra Petřík
2024-10-29 16:40:10 +01:00
parent 32fb583fcb
commit 19151edaef
10 changed files with 282 additions and 106 deletions

View File

@@ -4890,7 +4890,7 @@ public final class SWF implements SWFContainerItem, Timelined, Openable {
renderContext.cursorPosition = cursorPosition;
renderContext.mouseButton = mouseButton;
ExportRectangle viewRect = new ExportRectangle(rect);
timeline.toImage(frame, time, renderContext, image, image, false, m, new Matrix(), m, colorTransform, zoom, true, viewRect, m, true, Timeline.DRAW_MODE_ALL, 0, canUseSmoothing);
timeline.toImage(frame, time, renderContext, image, image, false, m, new Matrix(), m, colorTransform, zoom, true, viewRect, m, true, Timeline.DRAW_MODE_ALL, 0, canUseSmoothing, new ArrayList<>());
return image;
}

View File

@@ -609,7 +609,7 @@ public class FrameExporter {
renderContext.stateUnderCursor = new ArrayList<>();
try {
tim.toImage(fframe, fframe, renderContext, image, image, false, m, new Matrix(), m, null, zoom, true, new ExportRectangle(rect), m, true, Timeline.DRAW_MODE_ALL, 0, true);
tim.toImage(fframe, fframe, renderContext, image, image, false, m, new Matrix(), m, null, zoom, true, new ExportRectangle(rect), m, true, Timeline.DRAW_MODE_ALL, 0, true, new ArrayList<>());
} catch (Exception ex) {
ex.printStackTrace();
}

View File

@@ -19,6 +19,7 @@ package com.jpexs.decompiler.flash.exporters.commonshape;
import com.jpexs.decompiler.flash.types.MATRIX;
import java.awt.geom.AffineTransform;
import java.awt.geom.Point2D;
import java.awt.geom.Rectangle2D;
/**
* Matrix class, used in shape export.
@@ -92,6 +93,15 @@ public final class Matrix implements Cloneable {
scaleY = 1;
}
public Matrix(double scaleX, double scaleY, double rotateSkew0, double rotateSkew1, double translateX, double translateY) {
this.scaleX = scaleX;
this.scaleY = scaleY;
this.rotateSkew0 = rotateSkew0;
this.rotateSkew1 = rotateSkew1;
this.translateX = translateX;
this.translateY = translateY;
}
public Matrix(MATRIX matrix) {
if (matrix == null) {
matrix = new MATRIX();
@@ -170,6 +180,11 @@ public final class Matrix implements Cloneable {
return new Point2D.Double(p.x, p.y);
}
public Rectangle2D transform(Rectangle2D rect) {
ExportRectangle er = transform(new ExportRectangle(rect));
return new Rectangle2D.Double(er.xMin, er.yMin, er.getWidth(), er.getHeight());
}
public ExportRectangle transform(ExportRectangle rect) {
double minX = Double.MAX_VALUE;
double minY = Double.MAX_VALUE;

View File

@@ -415,7 +415,7 @@ public class DefineSpriteTag extends DrawableTag implements Timelined {
@Override
public void toImage(int frame, int time, int ratio, RenderContext renderContext, SerializableImage image, SerializableImage fullImage, boolean isClip, Matrix transformation, Matrix strokeTransformation, Matrix absoluteTransformation, Matrix fullTransformation, ColorTransform colorTransform, double unzoom, boolean sameImage, ExportRectangle viewRect, boolean scaleStrokes, int drawMode, int blendMode, boolean canUseSmoothing) {
getTimeline().toImage(frame, time, renderContext, image, fullImage, isClip, transformation, strokeTransformation, absoluteTransformation, colorTransform, unzoom, sameImage, viewRect, fullTransformation, scaleStrokes, drawMode, blendMode, canUseSmoothing);
getTimeline().toImage(frame, time, renderContext, image, fullImage, isClip, transformation, strokeTransformation, absoluteTransformation, colorTransform, unzoom, sameImage, viewRect, fullTransformation, scaleStrokes, drawMode, blendMode, canUseSmoothing, new ArrayList<>());
}
@Override

View File

@@ -32,6 +32,7 @@ import com.jpexs.helpers.ByteArrayRange;
import com.jpexs.helpers.SerializableImage;
import java.awt.Shape;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
@@ -123,7 +124,7 @@ public abstract class ButtonTag extends DrawableTag implements Timelined {
@Override
public void toImage(int frame, int time, int ratio, RenderContext renderContext, SerializableImage image, SerializableImage fullImage, boolean isClip, Matrix transformation, Matrix strokeTransformation, Matrix absoluteTransformation, Matrix fullTransformation, ColorTransform colorTransform, double unzoom, boolean sameImage, ExportRectangle viewRect, boolean scaleStrokes, int drawMode, int blendMode, boolean canUseSmoothing) {
getTimeline().toImage(frame, time, renderContext, image, fullImage, isClip, transformation, strokeTransformation, absoluteTransformation, colorTransform, unzoom, sameImage, viewRect, fullTransformation, scaleStrokes, drawMode, blendMode, canUseSmoothing);
getTimeline().toImage(frame, time, renderContext, image, fullImage, isClip, transformation, strokeTransformation, absoluteTransformation, colorTransform, unzoom, sameImage, viewRect, fullTransformation, scaleStrokes, drawMode, blendMode, canUseSmoothing, new ArrayList<>());
}
@Override

View File

@@ -1363,8 +1363,9 @@ public class Timeline {
* @param drawMode Draw mode
* @param blendMode Blend mode
* @param canUseSmoothing Can use smoothing
* @param ignoreDepths Ignore these depths when drawing
*/
public void toImage(int frame, int time, RenderContext renderContext, SerializableImage image, SerializableImage fullImage, boolean isClip, Matrix transformation, Matrix strokeTransformation, Matrix absoluteTransformation, ColorTransform colorTransform, double unzoom, boolean sameImage, ExportRectangle viewRect, Matrix fullTransformation, boolean scaleStrokes, int drawMode, int blendMode, boolean canUseSmoothing) {
public void toImage(int frame, int time, RenderContext renderContext, SerializableImage image, SerializableImage fullImage, boolean isClip, Matrix transformation, Matrix strokeTransformation, Matrix absoluteTransformation, ColorTransform colorTransform, double unzoom, boolean sameImage, ExportRectangle viewRect, Matrix fullTransformation, boolean scaleStrokes, int drawMode, int blendMode, boolean canUseSmoothing, List<Integer> ignoreDepths) {
if (getFrameCount() <= frame) {
return;
}
@@ -1385,7 +1386,7 @@ public class Timeline {
int maxDepth = getMaxDepth();
int clipCount = 0;
for (int i = 0; i <= maxDepth; i++) {
for (int i = 0; i <= maxDepth; i++) {
boolean clipChanged = clipCount != clips.size();
for (int c = 0; c < clips.size(); c++) {
if (clips.get(c).depth < i) {
@@ -1448,6 +1449,11 @@ public class Timeline {
if (drawMode != DRAW_MODE_ALL && drawMode != DRAW_MODE_SHAPES && (character instanceof ShapeTag)) {
continue;
}
if (ignoreDepths.contains(i)) {
continue;
}
if (character instanceof DrawableTag) {
RECT scalingRect = null;