Fixed filter bounds

This commit is contained in:
Jindra Petřík
2022-12-24 13:05:44 +01:00
parent 166e8d7298
commit 0c4adb7d1a
5 changed files with 13 additions and 29 deletions

View File

@@ -752,36 +752,20 @@ public class Timeline {
// calculate size after applying the filters
double deltaXMax = 0;
double deltaYMax = 0;
double deltaXMin = Integer.MAX_VALUE;
double deltaYMin = Integer.MAX_VALUE;
for (FILTER filter : filters) {
double x = filter.getDeltaX();
double y = filter.getDeltaY();
deltaXMax = Math.max(x, deltaXMax);
deltaYMax = Math.max(y, deltaYMax);
deltaXMin = Math.min(x, deltaXMin);
deltaYMin = Math.min(y, deltaYMin);
deltaYMax = Math.max(y, deltaYMax);
}
if (deltaXMin > 0) {
deltaXMin = 0;
}
if (deltaYMin > 0) {
deltaYMin = 0;
}
if (deltaXMax < 0) {
deltaXMax = 0;
}
if (deltaYMax < 0) {
deltaYMax = 0;
}
rect.xMin += deltaXMin * unzoom * SWF.unitDivisor;
rect.xMin -= deltaXMax * unzoom * SWF.unitDivisor;
rect.xMax += deltaXMax * unzoom * SWF.unitDivisor;
rect.yMin += deltaYMin * unzoom * SWF.unitDivisor;
rect.yMin -= deltaXMax * unzoom * SWF.unitDivisor;
rect.yMax += deltaYMax * unzoom * SWF.unitDivisor;
viewRect2.xMin -= deltaXMax * SWF.unitDivisor;
viewRect2.xMax += deltaXMax * SWF.unitDivisor;
viewRect2.yMin -= deltaXMax * SWF.unitDivisor;
viewRect2.yMax += deltaXMax * SWF.unitDivisor;
viewRect2.yMin -= deltaYMax * SWF.unitDivisor;
viewRect2.yMax += deltaYMax * SWF.unitDivisor;
}
rect.xMin -= SWF.unitDivisor;

View File

@@ -114,11 +114,11 @@ public class BEVELFILTER extends FILTER {
@Override
public double getDeltaX() {
return blurX + (distance * Math.cos(angle));
return blurX + Math.abs(distance * Math.cos(angle));
}
@Override
public double getDeltaY() {
return blurY + (distance * Math.sin(angle));
return blurY + Math.abs(distance * Math.sin(angle));
}
}

View File

@@ -98,11 +98,11 @@ public class DROPSHADOWFILTER extends FILTER {
@Override
public double getDeltaX() {
return blurX + (distance * Math.cos(angle));
return blurX + Math.abs(distance * Math.cos(angle));
}
@Override
public double getDeltaY() {
return blurY + (distance * Math.sin(angle));
return blurY + Math.abs(distance * Math.sin(angle));
}
}

View File

@@ -132,11 +132,11 @@ public class GRADIENTBEVELFILTER extends FILTER {
@Override
public double getDeltaX() {
return blurX + (distance * Math.cos(angle));
return blurX + Math.abs(distance * Math.cos(angle));
}
@Override
public double getDeltaY() {
return blurY + (distance * Math.sin(angle));
return blurY + Math.abs(distance * Math.sin(angle));
}
}

View File

@@ -133,11 +133,11 @@ public class GRADIENTGLOWFILTER extends FILTER {
@Override
public double getDeltaX() {
return blurX + (distance * Math.cos(angle));
return blurX + Math.abs(distance * Math.cos(angle));
}
@Override
public double getDeltaY() {
return blurY + (distance * Math.sin(angle));
return blurY + Math.abs(distance * Math.sin(angle));
}
}