Skip to content

Commit

Permalink
#154 ディレクトリ構成を変更
Browse files Browse the repository at this point in the history
  • Loading branch information
ienaga committed Aug 3, 2024
1 parent fd2d652 commit 7386627
Show file tree
Hide file tree
Showing 76 changed files with 302 additions and 611 deletions.
6 changes: 5 additions & 1 deletion packages/core/src/Next2D/LoadService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,12 @@ export const execute = async (url: string, options: PlayerOptionsImpl | null = n
// resize
playerResizeEventService();

// load complete
// remove loading
playerRemoveLoadingElementService();

// append canvas
playerAppendCanvasElementService();

// TODO: ready complete
playerReadyCompleteService();
};
21 changes: 1 addition & 20 deletions packages/display/src/BlendMode.test.ts
Original file line number Diff line number Diff line change
@@ -1,30 +1,11 @@
import { BlendMode } from "./BlendMode";
import { describe, expect, it } from "vitest";

describe("BlendMode.js toString test", () =>
{
it("toString test case1", () =>
{
const blendMode = new BlendMode();
expect(blendMode.toString())
.toBe("[object BlendMode]");
});
});

describe("BlendMode.js static toString test", () =>
{
it("static toString test", () =>
{
expect(BlendMode.toString()).toBe("[class BlendMode]");
});
});

describe("BlendMode.js namespace test", () =>
{
it("namespace test public", () =>
{
const blendMode = new BlendMode();
expect(blendMode.namespace).toBe("next2d.display.BlendMode");
expect(new BlendMode().namespace).toBe("next2d.display.BlendMode");
});

it("namespace test static", () =>
Expand Down
31 changes: 1 addition & 30 deletions packages/display/src/BlendMode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,6 @@
*/
export class BlendMode
{

/**
* @description 指定されたクラスのストリングを返します。
* Returns the string representation of the specified class.
*
* @return {string}
* @default "[class BlendMode]"
* @method
* @static
*/
static toString (): string
{
return "[class BlendMode]";
}

/**
* @description 指定されたクラスの空間名を返します。
* Returns the space name of the specified class.
Expand All @@ -38,20 +23,6 @@ export class BlendMode
return "next2d.display.BlendMode";
}

/**
* @description 指定されたオブジェクトのストリングを返します。
* Returns the string representation of the specified object.
*
* @return {string}
* @default "[object BlendMode]"
* @method
* @public
*/
toString (): string
{
return "[object BlendMode]";
}

/**
* @description 指定されたオブジェクトの空間名を返します。
* Returns the space name of the specified object.
Expand Down Expand Up @@ -268,4 +239,4 @@ export class BlendMode
{
return "subtract";
}
}
}
37 changes: 35 additions & 2 deletions packages/display/src/DisplayObject.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@ import type { Stage } from "./Stage";
import type { LoaderInfo } from "./LoaderInfo";
import type { Sprite } from "./Sprite";
import type { ParentImpl } from "./interface/ParentImpl";

import type { CharacterImpl } from "./interface/CharacterImpl";
import type { DisplayObjectContainer } from "./DisplayObjectContainer";
import type { DictionaryTagImpl } from "./interface/DictionaryTagImpl";
import {
Event as Next2DEvent,
EventDispatcher
Expand All @@ -22,7 +24,6 @@ import {
$getInstanceId
} from "./DisplayObjectUtil";


/**
* @description DisplayObject クラスは、表示リストに含めることのできるすべてのオブジェクトに関する基本クラスです。
* DisplayObject クラス自体は、画面上でのコンテンツの描画のための API を含みません。
Expand Down Expand Up @@ -2125,4 +2126,36 @@ export class DisplayObject extends EventDispatcher
// return true;
// }

/**
* @description 指定されたタグ情報を元に、表示オブジェクトを構築します。
* Based on the specified tag information, the display object is constructed.
*
* @param {object} tag
* @param {DisplayObjectContainer} parent
* @return {object}
* @method
* @protected
*/
_$baseBuild<C extends CharacterImpl, P extends DisplayObjectContainer> (tag: DictionaryTagImpl, parent: P): C
{
const loaderInfo = parent._$loaderInfo as LoaderInfo;
if (!loaderInfo || !loaderInfo.data) {
throw new Error("the loaderInfo or data is nul.");
}

// set parent data
this._$parent = parent;
this._$root = parent._$root;
this._$stage = parent._$stage;
this._$loaderInfo = loaderInfo;

// bind tag data
this._$characterId = tag.characterId | 0;
this._$clipDepth = tag.clipDepth | 0;
this._$startFrame = tag.startFrame | 0;
this._$endFrame = tag.endFrame | 0;
this._$name = tag.name || "";

return loaderInfo.data.characters[tag.characterId];
}
}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { DisplayObjectImpl } from "../interface/DisplayObjectImpl";
import type { PlaceObjectImpl } from "../interface/PlaceObjectImpl";
import type { ParentImpl } from "../interface/ParentImpl";
import type { DisplayObjectImpl } from "../../interface/DisplayObjectImpl";
import type { PlaceObjectImpl } from "../../interface/PlaceObjectImpl";
import type { ParentImpl } from "../../interface/ParentImpl";

/**
* @description DisplayObjectのPlaceObjectを返却、存在しない場合はnullを返却
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import type { Matrix } from "@next2d/geom";
import type { PlaceObjectImpl } from "../interface/PlaceObjectImpl";
import type { DisplayObjectImpl } from "../interface/DisplayObjectImpl";
import type { PlaceObjectImpl } from "../../interface/PlaceObjectImpl";
import type { DisplayObjectImpl } from "../../interface/DisplayObjectImpl";
import { execute as displayObjectGetPlaceObjectService } from "./DisplayObjectGetPlaceObjectService";
import { $getFloat32Array6 } from "../DisplayObjectUtil";
import { $getFloat32Array6 } from "../../DisplayObjectUtil";

/**
* @type {Float32Array}
Expand Down
30 changes: 5 additions & 25 deletions packages/display/src/DisplayObjectContainer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -159,11 +159,11 @@ export class DisplayObjectContainer extends InteractiveObject
*/
addChild<T extends DisplayObject> (display_object: T): T
{
// if (child._$parent) {
// child._$parent._$remove(child,
// !(child._$parent._$instanceId === this._$instanceId)
// );
// }
if (display_object._$parent) {
child._$parent._$remove(child,
!(child._$parent._$instanceId === this._$instanceId)
);
}

// this._$getChildren().push(child);

Expand Down Expand Up @@ -1009,26 +1009,6 @@ export class DisplayObjectContainer extends InteractiveObject
// child.removeAllEventListener(Next2DEvent.ENTER_FRAME);
// }

// if (child.hasEventListener(Next2DEvent.EXIT_FRAME)) {
// child.removeAllEventListener(Next2DEvent.EXIT_FRAME);
// }

// if (child.hasEventListener(Next2DEvent.FRAME_CONSTRUCTED)) {
// child.removeAllEventListener(Next2DEvent.FRAME_CONSTRUCTED);
// }

// if (child.hasEventListener(Next2DEvent.RENDER)) {
// child.removeAllEventListener(Next2DEvent.RENDER);
// }

// if (child.hasEventListener(Next2DEvent.ACTIVATE)) {
// child.removeAllEventListener(Next2DEvent.ACTIVATE);
// }

// if (child.hasEventListener(Next2DEvent.DEACTIVATE)) {
// child.removeAllEventListener(Next2DEvent.DEACTIVATE);
// }

// if (child.hasEventListener("keyDown")) {
// child.removeAllEventListener("keyDown");
// }
Expand Down
42 changes: 6 additions & 36 deletions packages/display/src/Loader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ import { LoaderInfo } from "./LoaderInfo";
import { MovieClip } from "./MovieClip";
import { URLRequest } from "@next2d/net";
import { $ajax } from "./DisplayObjectUtil";
import { execute as loaderLoadstartEventService } from "./Loader/LoaderLoadStartEventService";
import { execute as loaderProgressEventService } from "./Loader/LoaderProgressEventService";
import { execute as loaderLoadEndEventService } from "./Loader/LoaderLoadEndEventService";
import { execute as loaderLoadJsonService } from "./Loader/LoaderLoadJsonService";
import { execute as loaderLoadstartEventService } from "./Loader/service/LoaderLoadStartEventService";
import { execute as loaderProgressEventService } from "./Loader/service/LoaderProgressEventService";
import { execute as loaderLoadEndEventService } from "./Loader/service/LoaderLoadEndEventService";
import { execute as loaderLoadJsonService } from "./Loader/service/LoaderLoadJsonService";

/**
* @description Loader クラスは、JSON ファイルを読み込むために使用します。
Expand Down Expand Up @@ -40,26 +40,11 @@ export class Loader extends DisplayObjectContainer
this._$loaderInfo = new LoaderInfo();
}

/**
* @description 指定されたクラスのストリングを返します。
* Returns the string representation of the specified class.
*
* @return {string}
* @default "[class Loader]"
* @method
* @static
*/
static toString (): string
{
return "[class Loader]";
}

/**
* @description 指定されたクラスの空間名を返します。
* Returns the space name of the specified class.
*
* @return {string}
* @default "next2d.display.Loader"
* @return {string}
* @const
* @static
*/
Expand All @@ -68,26 +53,11 @@ export class Loader extends DisplayObjectContainer
return "next2d.display.Loader";
}

/**
* @description 指定されたオブジェクトのストリングを返します。
* Returns the string representation of the specified object.
*
* @return {string}
* @default "[object Loader]"
* @method
* @public
*/
toString (): string
{
return "[object Loader]";
}

/**
* @description 指定されたオブジェクトの空間名を返します。
* Returns the space name of the specified object.
*
* @return {string}
* @default "next2d.display.Loader"
* @return {string}
* @const
* @public
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import type { NoCodeDataImpl } from "../interface/NoCodeDataImpl";
import type { Loader } from "../Loader";
import { MovieClip } from "../MovieClip";
import { execute as movieClipBuildService } from "../MovieClip/MovieClipBuildService";
import type { NoCodeDataImpl } from "../../interface/NoCodeDataImpl";
import type { Loader } from "../../Loader";
import { MovieClip } from "../../MovieClip";

/**
* @description 読み込んだJSONオブジェクトからMovieClipを作成
Expand Down Expand Up @@ -34,7 +33,8 @@ export const execute = async (loader: Loader, object: NoCodeDataImpl): Promise<v

// build root content
const movieClip = new MovieClip();
await movieClipBuildService(movieClip, {

await movieClip._$build<Loader>({
"characterId": 0,
"name": "main",
"clipDepth": 0,
Expand All @@ -44,4 +44,5 @@ export const execute = async (loader: Loader, object: NoCodeDataImpl): Promise<v
}, loader);

loaderInfo.content = movieClip;
console.log(movieClip);
};
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Loader } from "../Loader";
import { Loader } from "../../Loader";
import { execute } from "./LoaderLoadEndEventService";
import {
Event,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Loader } from "../Loader";
import { $headerStringToArray } from "../DisplayObjectUtil";
import { Loader } from "../../Loader";
import { $headerStringToArray } from "../../DisplayObjectUtil";
import { execute as loaderLoadJsonService } from "./LoaderLoadJsonService";
import {
Event,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import type { NoCodeDataImpl } from "../interface/NoCodeDataImpl";
import type { NoCodeDataZlibImpl } from "../interface/NoCodeDataZlibImpl";
import type { Loader } from "../Loader";
import type { NoCodeDataImpl } from "../../interface/NoCodeDataImpl";
import type { NoCodeDataZlibImpl } from "../../interface/NoCodeDataZlibImpl";
import type { Loader } from "../../Loader";
import { execute as loaderBuildService } from "./LoaderBuildService";

// @ts-ignore
import ZlibInflateWorker from "./ZlibInflateWorker?worker&inline";
import ZlibInflateWorker from "../worker/ZlibInflateWorker?worker&inline";

/**
* @type {Worker}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Loader } from "../Loader";
import { Loader } from "../../Loader";
import { execute } from "./LoaderLoadStartEventService";
import {
Event,
Expand Down
Loading

0 comments on commit 7386627

Please sign in to comment.