Skip to content

Commit df71c4c

Browse files
committed
回転のバグを改修
1 parent 5cda29d commit df71c4c

File tree

1 file changed

+22
-41
lines changed

1 file changed

+22
-41
lines changed

swf2js.js

Lines changed: 22 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*jshint bitwise: false*/
22
/**
3-
* swf2js (version 0.7.21)
3+
* swf2js (version 0.7.22)
44
* Develop: https://github.com/ienaga/swf2js
55
* ReadMe: https://github.com/ienaga/swf2js/blob/master/README.md
66
* Web: https://swf2js.wordpress.com
@@ -15127,6 +15127,7 @@ if (!("swf2js" in window)){(function(window)
1512715127
_this._matrix = null;
1512815128
_this._colorTransform = null;
1512915129
_this._extend = false;
15130+
_this._viewRotation = null;
1513015131

1513115132
// avm2
1513215133
_this.avm2 = null;
@@ -16129,6 +16130,10 @@ if (!("swf2js" in window)){(function(window)
1612916130
*/
1613016131
DisplayObject.prototype.getXScale = function ()
1613116132
{
16133+
if (this._viewXScale !== null) {
16134+
return this._viewXScale;
16135+
}
16136+
1613216137
var matrix = this.getMatrix();
1613316138
var xScale = _sqrt(matrix[0] * matrix[0] + matrix[1] * matrix[1]) * 100;
1613416139
if (0 > matrix[0]) {
@@ -16144,24 +16149,14 @@ if (!("swf2js" in window)){(function(window)
1614416149
{
1614516150
xscale = +xscale;
1614616151
if (!_isNaN(xscale)) {
16147-
if (!xscale) {
16148-
try {
16149-
throw new Error("xscale 0");
16150-
} catch (e) {
16151-
console.log(e);
16152-
}
16153-
}
1615416152
var _this = this;
1615516153
var _matrix = _this.getMatrix();
1615616154
var matrix = _this.cloneArray(_matrix);
16157-
var adjustment = 1;
16158-
if (0 > matrix[0]) {
16159-
adjustment = -1;
16160-
}
1616116155
var radianX = _atan2(matrix[1], matrix[0]);
16156+
this._viewXScale = xscale;
1616216157
xscale /= 100;
16163-
matrix[0] = xscale * _cos(radianX) * adjustment;
16164-
matrix[1] = xscale * _sin(radianX) * adjustment;
16158+
matrix[0] = xscale * _cos(radianX);
16159+
matrix[1] = xscale * _sin(radianX);
1616516160
_this.setMatrix(matrix);
1616616161
}
1616716162
};
@@ -16171,6 +16166,10 @@ if (!("swf2js" in window)){(function(window)
1617116166
*/
1617216167
DisplayObject.prototype.getYScale = function ()
1617316168
{
16169+
if (this._viewYScale !== null) {
16170+
return this._viewYScale;
16171+
}
16172+
1617416173
var matrix = this.getMatrix();
1617516174
var yScale = _sqrt(matrix[2] * matrix[2] + matrix[3] * matrix[3]) * 100;
1617616175
if (0 > matrix[3]) {
@@ -16186,24 +16185,14 @@ if (!("swf2js" in window)){(function(window)
1618616185
{
1618716186
yscale = +yscale;
1618816187
if (!_isNaN(yscale)) {
16189-
if (!yscale) {
16190-
try {
16191-
throw new Error("yscale 0");
16192-
} catch (e) {
16193-
console.log(e);
16194-
}
16195-
}
1619616188
var _this = this;
1619716189
var _matrix = _this.getMatrix();
1619816190
var matrix = _this.cloneArray(_matrix);
16199-
var adjustment = 1;
16200-
if (0 > matrix[3]) {
16201-
adjustment = -1;
16202-
}
1620316191
var radianY = _atan2(-matrix[2], matrix[3]);
16192+
this._viewYScale = yscale;
1620416193
yscale /= 100;
16205-
matrix[2] = -yscale * _sin(radianY) * adjustment;
16206-
matrix[3] = yscale * _cos(radianY) * adjustment;
16194+
matrix[2] = -yscale * _sin(radianY);
16195+
matrix[3] = yscale * _cos(radianY);
1620716196
_this.setMatrix(matrix);
1620816197
}
1620916198
};
@@ -16301,6 +16290,10 @@ if (!("swf2js" in window)){(function(window)
1630116290
*/
1630216291
DisplayObject.prototype.getRotation = function ()
1630316292
{
16293+
if (this._viewRotation !== null) {
16294+
return this._viewRotation * 180 / _PI;
16295+
}
16296+
1630416297
var matrix = this.getMatrix();
1630516298
var rotation = _atan2(matrix[1], matrix[0]) * 180 / _PI;
1630616299
switch (rotation) {
@@ -16335,7 +16328,9 @@ if (!("swf2js" in window)){(function(window)
1633516328
matrix[1] = ScaleX * _sin(radianX);
1633616329
matrix[2] = -ScaleY * _sin(radianY);
1633716330
matrix[3] = ScaleY * _cos(radianY);
16331+
1633816332
_this.setMatrix(matrix);
16333+
this._viewRotation = rotation;
1633916334
}
1634016335
};
1634116336

@@ -16357,13 +16352,6 @@ if (!("swf2js" in window)){(function(window)
1635716352
{
1635816353
width = +width;
1635916354
if (!_isNaN(width)) {
16360-
if (!width) {
16361-
try {
16362-
throw new Error("width 0");
16363-
} catch (e) {
16364-
console.log(e);
16365-
}
16366-
}
1636716355
var _this = this;
1636816356
var _matrix = _this.getOriginMatrix();
1636916357
var bounds = _this.getBounds(_matrix);
@@ -16397,13 +16385,6 @@ if (!("swf2js" in window)){(function(window)
1639716385
{
1639816386
height = +height;
1639916387
if (!_isNaN(height)) {
16400-
if (!height) {
16401-
try {
16402-
throw new Error("height 0");
16403-
} catch (e) {
16404-
console.log(e);
16405-
}
16406-
}
1640716388
var _this = this;
1640816389
var _matrix = _this.getOriginMatrix();
1640916390
var bounds = _this.getBounds(_matrix);

0 commit comments

Comments
 (0)