Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Develop #133

Merged
merged 13 commits into from
Sep 14, 2023
6 changes: 5 additions & 1 deletion jest.setup.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,11 @@ globalThis.window = {
},
"childNodes": [],
"children": [],
"style": {}
"style": {},
"addEventListener": () =>
{
return undefined;
}
};
}
},
Expand Down
2 changes: 1 addition & 1 deletion next2d.js

Large diffs are not rendered by default.

18 changes: 9 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
{
"name": "@next2d/player",
"version": "1.17.5",
"version": "1.18.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@tvon.jp> (https://github.com/ienaga/)",
"license": "MIT",
"homepage": "https://next2d.app",
"bugs": "https://github.com/Next2D/Player/issues",
"main": "index.js",
"bundle": "dist/next2d.min.js",
"bundle": "next2d.min.js",
"keywords": [
"Next2D",
"Next2D Player"
Expand Down Expand Up @@ -36,17 +36,17 @@
"htmlparser2": "^9.0.0"
},
"devDependencies": {
"@babel/core": "^7.22.11",
"@babel/plugin-transform-modules-commonjs": "^7.22.11",
"@babel/preset-env": "^7.22.14",
"@babel/core": "^7.22.19",
"@babel/plugin-transform-modules-commonjs": "^7.22.15",
"@babel/preset-env": "^7.22.15",
"@next2d/jsdoc-template": "^1.0.7",
"@types/jest": "^29.5.4",
"@typescript-eslint/eslint-plugin": "^6.5.0",
"@typescript-eslint/parser": "^6.5.0",
"eslint": "^8.48.0",
"@typescript-eslint/eslint-plugin": "^6.7.0",
"@typescript-eslint/parser": "^6.7.0",
"eslint": "^8.49.0",
"eslint-webpack-plugin": "^4.0.1",
"fflate": "^0.8.0",
"jest": "^29.6.4",
"jest": "^29.7.0",
"jsdoc": "^4.0.2",
"ts-jest": "^29.1.1",
"ts-loader": "^9.4.4",
Expand Down
61 changes: 32 additions & 29 deletions packages/core/src/Player.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,8 @@ import {
$getEventType,
$getRenderBufferArray,
$getRenderMessageObject,
$poolRenderMessageObject
$poolRenderMessageObject,
$textArea
} from "@next2d/util";
import {
$Math,
Expand Down Expand Up @@ -105,6 +106,7 @@ export class Player
public _$scale: number;
public _$state: "up" | "down";
public _$attachment: AttachmentImpl | null;
public _$textField: TextField | null;
public readonly _$videos: Video[];
public readonly _$sources: Sound[];
private _$mode: PlayerModeImpl;
Expand All @@ -126,7 +128,6 @@ export class Player
private _$bgColor: string;
private _$base: string;
private _$fullScreen: boolean;
private _$textField: TextField | null;
private _$timerId: number;
private _$loadId: number;
private _$deltaX: number;
Expand Down Expand Up @@ -833,6 +834,7 @@ export class Player

// append canvas
element.appendChild(this._$canvas);
element.appendChild($textArea);

// stage init action
this._$stage._$prepareActions();
Expand Down Expand Up @@ -2188,6 +2190,7 @@ export class Player
if (this._$clickTarget
&& "_$text" in this._$clickTarget
&& this._$clickTarget.scrollEnabled
&& this._$clickTarget.selectIndex === -1
) {
const deltaX: number = this._$deltaX - pageX;
const deltaY: number = this._$deltaY - pageY;
Expand Down Expand Up @@ -2277,28 +2280,21 @@ export class Player

case $TOUCH_START:
case $MOUSE_DOWN:
if (this._$textField && "focus" in this._$textField) {
this._$textField.focus = false;
this._$textField = null;
}

if (this._$stage.hasEventListener(Next2DMouseEvent.MOUSE_DOWN)) {
this._$stage.dispatchEvent(new Next2DMouseEvent(
Next2DMouseEvent.MOUSE_DOWN, true, false
));
}

// TextField focus out
if (this._$textField) {
this._$textField.focus = false;
this._$textField = null;
}
break;

case $TOUCH_END:
case $MOUSE_UP:

// TextField focus out
if (this._$textField) {
this._$textField.focus = false;
this._$textField = null;
}

if (this._$stage.hasEventListener(Next2DMouseEvent.CLICK)) {
this._$stage.dispatchEvent(new Next2DMouseEvent(
Next2DMouseEvent.CLICK, true, false
Expand Down Expand Up @@ -2473,6 +2469,10 @@ export class Player
// click reset
if (this._$state === "up") {
this._$clickTarget = null;
} else {
if (this._$textField) {
this._$textField._$setIndex(stageX, stageY);
}
}

break;
Expand All @@ -2481,6 +2481,24 @@ export class Player
case $TOUCH_START:
case $MOUSE_DOWN:

if (this._$textField
&& instance !== this._$textField
) {
this._$textField.focus = false;
this._$textField = null;
}

// TextField focus out
if ("_$text" in instance) {
instance.focus = true;
instance._$setIndex(stageX, stageY);
this._$textField = instance;

// move text area element
$textArea.style.left = `${pageX}px`;
$textArea.style.top = `${pageY}px`;
}

// (3) mouseDown
if (instance.willTrigger(Next2DMouseEvent.MOUSE_DOWN)) {
instance.dispatchEvent(new Next2DMouseEvent(
Expand All @@ -2497,21 +2515,6 @@ export class Player
case $TOUCH_END:
case $MOUSE_UP:

// TextField focus out
if (this._$textField
&& instance !== this._$textField
&& "_$text" in this._$textField
) {
this._$textField.focus = false;
this._$textField = null;
}

// TextField focus out
if ("_$text" in instance) {
instance.focus = true;
this._$textField = instance;
}

// (1) mouseUp
if (instance.willTrigger(Next2DMouseEvent.MOUSE_UP)) {
instance.dispatchEvent(new Next2DMouseEvent(
Expand Down
10 changes: 6 additions & 4 deletions packages/display/src/Graphics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ import {
$getBoundsObject,
$Float32Array,
$getFloat32Array4,
$getInt32Array4,
$linearGradientXY
} from "@next2d/share";

Expand Down Expand Up @@ -101,7 +102,7 @@ export class Graphics
private _$lines: any[] | null;
private _$uniqueKey: string;
private _$cacheKeys: string[];
private _$cacheParams: number[];
private readonly _$cacheParams: number[];
public _$bitmapId: number;
public _$mode: ShapeModeImpl;
public _$posted: boolean;
Expand Down Expand Up @@ -730,7 +731,8 @@ export class Graphics
beginGradientFill (
type: GradientTypeImpl,
colors: number[] | string[],
alphas: number[], ratios: number[],
alphas: number[],
ratios: number[],
matrix: Matrix | null = null,
spread_method: SpreadMethodImpl = "pad",
interpolation_method: InterpolationMethodImpl = "rgb",
Expand Down Expand Up @@ -3085,7 +3087,7 @@ export class Graphics
}
}

css.addColorStop(color.ratio, $getFloat32Array4(
css.addColorStop(color.ratio, $getInt32Array4(
color.R, color.G, color.B, alpha
));

Expand Down Expand Up @@ -3162,7 +3164,7 @@ export class Graphics
}
}

css.addColorStop(color.ratio, $getFloat32Array4(
css.addColorStop(color.ratio, $getInt32Array4(
color.R, color.G, color.B, alpha
));

Expand Down
3 changes: 2 additions & 1 deletion packages/display/src/GraphicsGradientFill.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@ export class GraphicsGradientFill
constructor (
type: GradientTypeImpl,
colors: number[] | string[],
alphas: number[], ratios: number[],
alphas: number[],
ratios: number[],
matrix: Matrix | null = null,
spread_method: SpreadMethodImpl = "pad",
interpolation_method: InterpolationMethodImpl = "rgb",
Expand Down
Loading