Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
701 changes: 376 additions & 325 deletions package-lock.json

Large diffs are not rendered by default.

22 changes: 11 additions & 11 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@next2d/player",
"version": "2.2.2",
"version": "2.3.0",
"description": "Experience the fast and beautiful anti-aliased rendering of WebGL. You can create rich, interactive graphics, cross-platform applications and games without worrying about browser or device compatibility.",
"author": "Toshiyuki Ienaga<ienaga@next2d.app> (https://github.com/ienaga/)",
"license": "MIT",
Expand Down Expand Up @@ -46,24 +46,24 @@
},
"devDependencies": {
"@eslint/eslintrc": "^3.3.1",
"@eslint/js": "^9.25.1",
"@eslint/js": "^9.28.0",
"@rollup/plugin-commonjs": "^28.0.3",
"@rollup/plugin-node-resolve": "^16.0.1",
"@rollup/plugin-terser": "^0.4.4",
"@rollup/plugin-typescript": "^12.1.2",
"@types/node": "^22.15.3",
"@typescript-eslint/eslint-plugin": "^8.31.1",
"@typescript-eslint/parser": "^8.31.1",
"@vitest/web-worker": "^3.1.2",
"eslint": "^9.25.1",
"@types/node": "^22.15.29",
"@typescript-eslint/eslint-plugin": "^8.33.0",
"@typescript-eslint/parser": "^8.33.0",
"@vitest/web-worker": "^3.1.4",
"eslint": "^9.28.0",
"eslint-plugin-unused-imports": "^4.1.4",
"globals": "^16.0.0",
"globals": "^16.2.0",
"jsdom": "^26.1.0",
"rollup": "^4.40.1",
"rollup": "^4.41.1",
"tslib": "^2.8.1",
"typescript": "^5.8.3",
"vite": "^6.3.4",
"vitest": "^3.1.2",
"vite": "^6.3.5",
"vitest": "^3.1.4",
"vitest-webgl-canvas-mock": "^1.1.0"
},
"peerDependencies": {
Expand Down
6 changes: 4 additions & 2 deletions packages/core/src/Next2D/usecase/CaptureToCanvasUseCase.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,8 @@ export const execute = async <D extends DisplayObject> (
? opstions.colorTransform.rawData
: $COLOR_ARRAY_IDENTITY;

const rectangle = display_object.getBounds();
const translateMatrix = new Float32Array([
1, 0, 0, 1, -rectangle.x, -rectangle.y
1, 0, 0, 1, -display_object.width / 2, -display_object.height / 2
]);

const tMatrix = opstions && opstions.matrix
Expand All @@ -68,6 +67,9 @@ export const execute = async <D extends DisplayObject> (
return transferredCanvas;
}

tMatrix[4] += width / 2;
tMatrix[5] += height / 2;

// resize canvas
transferredCanvas.width = width;
transferredCanvas.height = height;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,13 @@ describe("DisplayObjectGetRotationUseCase.js test", () =>
};
expect(execute(displayObject)).toBe(45);
});

it("execute test case4", () =>
{
const displayObject = new DisplayObject();
displayObject.placeObject = {
matrix: [-1, 0, 0, 1, 0, 0]
};
expect(execute(displayObject)).toBe(0);
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,5 @@ export const execute = <D extends DisplayObject>(display_object: D): number =>
? display_object.$matrix.rawData
: displayObjectGetRawMatrixUseCase(display_object);

return matrix ? Math.atan2(matrix[1], matrix[0]) * $Rad2Deg : 0;
return matrix ? Math.atan2(matrix[1], Math.abs(matrix[0])) * $Rad2Deg : 0;
};
Original file line number Diff line number Diff line change
Expand Up @@ -20,20 +20,10 @@ export const execute = <D extends DisplayObject>(display_object: D): number =>
return 1;
}

let xScale = Math.sqrt(
const xScale = Math.round(Math.sqrt(
matrix[0] * matrix[0]
+ matrix[1] * matrix[1]
);

if (!Number.isInteger(xScale)) {
const value: string = xScale.toString();
const index: number = value.indexOf("e");
if (index !== -1) {
xScale = +value.slice(0, index);
}

xScale = Math.round(xScale * 100) / 100;
}
) * 10000) / 10000;

return 0 > matrix[0] ? xScale * -1 : xScale;
};
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,10 @@ export const execute = <D extends DisplayObject>(display_object: D): number =>
return 1;
}

let yScale = Math.sqrt(
const yScale = Math.round(Math.sqrt(
matrix[2] * matrix[2]
+ matrix[3] * matrix[3]
);
) * 10000) / 10000;

if (!Number.isInteger(yScale)) {
const value: string = yScale.toString();
const index: number = value.indexOf("e");
if (index !== -1) {
yScale = +value.slice(0, index);
}
yScale = Math.round(yScale * 100) / 100;
}

return 0 > matrix[0] ? yScale * -1 : yScale;
return 0 > matrix[3] ? yScale * -1 : yScale;
};
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ describe("DisplayObjectSetHeightUseCase.js test", () =>
expect(rawData[0]).toBe(1);
expect(rawData[1]).toBe(0);
expect(rawData[2]).toBe(0);
expect(rawData[3]).toBe(0.33000001311302185);
expect(rawData[3]).toBe(0.3333333432674408);
expect(rawData[4]).toBe(0);
expect(rawData[5]).toBe(0);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ describe("DisplayObjectSetScaleXUseCase.js test", () =>
expect(displayObject.changed).toBe(false);
expect(displayObject.$scaleX).toBe(null);

execute(displayObject, 2.2001231231005124151);
execute(displayObject, 2.2);

expect(displayObject.changed).toBe(true);
expect(displayObject.$scaleX).toBe(2.2);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,8 @@ export const execute = <D extends DisplayObject>(display_object: D, scale_x: num
{
scale_x = $clamp(scale_x, -Number.MAX_VALUE, Number.MAX_VALUE, 1);

if (!Number.isInteger(scale_x)) {
const value: string = scale_x.toString();
const index: number = value.indexOf("e");
if (index !== -1) {
scale_x = +value.slice(0, index);
}
scale_x = Math.round(scale_x * 100) / 100;
}

if (display_object.$scaleX === scale_x) {
const scaleX = Math.round(scale_x * 10000) / 10000;
if (display_object.$scaleX === scaleX) {
return ;
}

Expand Down Expand Up @@ -55,6 +47,6 @@ export const execute = <D extends DisplayObject>(display_object: D, scale_x: num

}

display_object.$scaleX = scale_x;
display_object.$scaleX = scaleX;
displayObjectApplyChangesService(display_object);
};
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ describe("DisplayObjectSetScaleYUseCase.js test", () =>
expect(displayObject.changed).toBe(false);
expect(displayObject.$scaleY).toBe(null);

execute(displayObject, 2.2001231231005124151);
execute(displayObject, 2.2);

expect(displayObject.changed).toBe(true);
expect(displayObject.$scaleY).toBe(2.2);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,8 @@ export const execute = <D extends DisplayObject>(display_object: D, scale_y: num
{
scale_y = $clamp(scale_y, -Number.MAX_VALUE, Number.MAX_VALUE, 1);

if (!Number.isInteger(scale_y)) {
const value: string = scale_y.toString();
const index: number = value.indexOf("e");
if (index !== -1) {
scale_y = +value.slice(0, index);
}
scale_y = Math.round(scale_y * 100) / 100;
}

if (display_object.$scaleY === scale_y) {
const scaleY = Math.round(scale_y * 10000) / 10000;
if (display_object.$scaleY === scaleY) {
return ;
}

Expand All @@ -54,6 +46,6 @@ export const execute = <D extends DisplayObject>(display_object: D, scale_y: num

}

display_object.$scaleY = scale_y;
display_object.$scaleY = scaleY;
displayObjectApplyChangesService(display_object);
};
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ describe("DisplayObjectSetWidthUseCase.js test", () =>
throw new Error("rawData is null");
}

expect(rawData[0]).toBe(0.44999998807907104);
expect(rawData[0]).toBe(0.4545454680919647);
expect(rawData[1]).toBe(0);
expect(rawData[2]).toBe(0);
expect(rawData[3]).toBe(1);
Expand Down
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import { Next2D } from "@next2d/core";

if (!("next2d" in window)) {
console.log("%c Next2D Player %c 2.2.1 %c https://next2d.app",
console.log("%c Next2D Player %c 2.3.0 %c https://next2d.app",
"color: #fff; background: #5f5f5f",
"color: #fff; background: #4bc729",
"");
Expand Down