@next2d/player 1.14.16 → 1.14.17

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,8 @@
1
+ export interface PropertyBitmapDataMessageImpl {
2
+ command: string;
3
+ sourceId: number;
4
+ width: number;
5
+ height: number;
6
+ matrix?: Float32Array;
7
+ colorTransform?: Float32Array;
8
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -2,7 +2,7 @@
2
2
  import { $currentPlayer, $initialize, $isSafari, $rendererWorker } from "./util/Util";
3
3
  import { Next2D } from "./player/Next2D";
4
4
  if (!("next2d" in window)) {
5
- console.log("%c Next2D Player %c 1.14.16 %c https://next2d.app", "color: #fff; background: #5f5f5f", "color: #fff; background: #4bc729", "");
5
+ console.log("%c Next2D Player %c 1.14.17 %c https://next2d.app", "color: #fff; background: #5f5f5f", "color: #fff; background: #4bc729", "");
6
6
  // @ts-ignore
7
7
  window.next2d = new Next2D([new Promise((resolve) => {
8
8
  if (document.readyState === "loading") {
@@ -214,8 +214,12 @@ export class BitmapData {
214
214
  if (!context) {
215
215
  throw new Error("the context is null.");
216
216
  }
217
- // @ts-ignore
218
- context.drawImage(this._$image || this._$canvas, 0, 0);
217
+ if (this._$image) {
218
+ context.drawImage(this._$image, 0, 0);
219
+ }
220
+ if (this._$canvas) {
221
+ context.drawImage(this._$canvas, 0, 0);
222
+ }
219
223
  bitmapData.canvas = canvas;
220
224
  }
221
225
  else if (this._$buffer !== null) {
@@ -444,12 +444,6 @@ export declare class DisplayObject extends EventDispatcher {
444
444
  * @private
445
445
  */
446
446
  _$getPlaceObject(): PlaceObjectImpl | null;
447
- /**
448
- * @return {object}
449
- * @method
450
- * @private
451
- */
452
- _$sync(): any;
453
447
  /**
454
448
  * @param {object} tag
455
449
  * @param {DisplayObjectContainer} parent
@@ -3,8 +3,7 @@ import { EventDispatcher } from "../events/EventDispatcher";
3
3
  import { Transform } from "../geom/Transform";
4
4
  import { Rectangle } from "../geom/Rectangle";
5
5
  import { Point } from "../geom/Point";
6
- import { $window } from "../../util/Shortcut";
7
- import { $doUpdated, $getCurrentLoaderInfo, $getEvent, $getInstanceId } from "../../util/Global";
6
+ import { $doUpdated, $getEvent, $getInstanceId } from "../../util/Global";
8
7
  import { $currentMousePoint, $currentPlayer, $poolColorTransform, $rendererWorker, $poolMatrix, $hitContext, $variables } from "../../util/Util";
9
8
  import { $clamp, $getArray, $boundsMatrix, $Math, $poolBoundsObject, $Infinity, $getBoundsObject, $isNaN, $Deg2Rad, $Number, $Rad2Deg, $SHORT_INT_MIN, $SHORT_INT_MAX, $MATRIX_ARRAY_IDENTITY, $multiplicationMatrix, $poolFloat32Array6, $getMap, $poolMap, $getFloat32Array6 } from "../../util/RenderUtil";
10
9
  /**
@@ -1216,35 +1215,6 @@ export class DisplayObject extends EventDispatcher {
1216
1215
  }
1217
1216
  return this._$placeObject;
1218
1217
  }
1219
- /**
1220
- * @return {object}
1221
- * @method
1222
- * @private
1223
- */
1224
- _$sync() {
1225
- const name = this.namespace;
1226
- let loaderInfo = null;
1227
- if ($window.next2d.fw && $window.next2d.fw.loaderInfo.has(name)) {
1228
- loaderInfo = $window.next2d.fw.loaderInfo.get(name)._$loaderInfo;
1229
- }
1230
- if (!loaderInfo) {
1231
- loaderInfo = this._$loaderInfo || $getCurrentLoaderInfo();
1232
- }
1233
- if (!loaderInfo || !loaderInfo._$data) {
1234
- return null;
1235
- }
1236
- const characterId = loaderInfo._$data.symbols.get(name);
1237
- if (!characterId) {
1238
- return null;
1239
- }
1240
- const character = loaderInfo._$data.characters[characterId];
1241
- if (!character) {
1242
- return null;
1243
- }
1244
- this._$characterId = characterId;
1245
- this._$loaderInfo = loaderInfo;
1246
- return character;
1247
- }
1248
1218
  /**
1249
1219
  * @param {object} tag
1250
1220
  * @param {DisplayObjectContainer} parent
@@ -2,7 +2,7 @@ import { InteractiveObject } from "./InteractiveObject";
2
2
  import { Event as Next2DEvent } from "../events/Event";
3
3
  import { Rectangle } from "../geom/Rectangle";
4
4
  import { $doUpdated } from "../../util/Global";
5
- import { $currentPlayer, $getClass, $hitContext, $isTouch, $MATRIX_HIT_ARRAY_IDENTITY, $rendererWorker } from "../../util/Util";
5
+ import { $createInstance, $currentPlayer, $hitContext, $isTouch, $MATRIX_HIT_ARRAY_IDENTITY, $rendererWorker } from "../../util/Util";
6
6
  import { $boundsMatrix, $clamp, $getArray, $getBoundsObject, $getFloat32Array6, $getFloat32Array8, $getMap, $getPreObject, $Math, $COLOR_ARRAY_IDENTITY, $MATRIX_ARRAY_IDENTITY, $multiplicationColor, $multiplicationMatrix, $Number, $poolArray, $poolBoundsObject, $poolFloat32Array6, $poolFloat32Array8, $poolMap, $poolPreObject } from "../../util/RenderUtil";
7
7
  /**
8
8
  * DisplayObjectContainer クラスは、表示リストで表示オブジェクトコンテナとして機能するすべてのオブジェクトの基本クラスです。
@@ -1632,12 +1632,7 @@ export class DisplayObjectContainer extends InteractiveObject {
1632
1632
  }
1633
1633
  const character = loaderInfo._$data.characters[tag.characterId];
1634
1634
  // symbol class
1635
- if (!character.class) {
1636
- character.class = character.symbol
1637
- ? $getClass(character.symbol) || $getClass(character.extends)
1638
- : $getClass(character.extends);
1639
- }
1640
- const instance = new character.class();
1635
+ const instance = $createInstance(character.extends);
1641
1636
  instance._$build(tag, this);
1642
1637
  instance._$id = index;
1643
1638
  return instance;
@@ -5,7 +5,7 @@ import { IOErrorEvent } from "../events/IOErrorEvent";
5
5
  import { Event } from "../events/Event";
6
6
  import { ProgressEvent as Next2DProgressEvent } from "../events/ProgressEvent";
7
7
  import { HTTPStatusEvent } from "../events/HTTPStatusEvent";
8
- import { $ajax, $headerToArray, $unzipQueues, $updateUnzipWorkerStatus, $getUnzipWorker, $getClass, $currentPlayer, $useUnzipWorker } from "../../util/Util";
8
+ import { $ajax, $headerToArray, $unzipQueues, $updateUnzipWorkerStatus, $getUnzipWorker, $currentPlayer, $useUnzipWorker } from "../../util/Util";
9
9
  import { $getMap } from "../../util/RenderUtil";
10
10
  /**
11
11
  * Loader クラスは、JSON ファイルまたはイメージ(JPEG、PNG、または GIF)ファイルを読み込むために使用します。
@@ -273,14 +273,10 @@ export class Loader extends DisplayObjectContainer {
273
273
  if (!loaderInfo) {
274
274
  return;
275
275
  }
276
- let rootSymbol = null;
277
276
  const symbols = $getMap();
278
277
  if (object.symbols.length) {
279
278
  for (let idx = 0; idx < object.symbols.length; ++idx) {
280
279
  const values = object.symbols[idx];
281
- if (values[1] === 0) {
282
- rootSymbol = values[0];
283
- }
284
280
  symbols.set(values[0], values[1]);
285
281
  }
286
282
  }
@@ -290,15 +286,7 @@ export class Loader extends DisplayObjectContainer {
290
286
  "symbols": symbols
291
287
  };
292
288
  // setup
293
- if (rootSymbol) {
294
- // TODO
295
- const SymbolClass = $getClass(rootSymbol) || MovieClip;
296
- // @ts-ignore
297
- loaderInfo._$content = new SymbolClass();
298
- }
299
- else {
300
- loaderInfo._$content = new MovieClip();
301
- }
289
+ loaderInfo._$content = new MovieClip();
302
290
  // build root
303
291
  const root = object.characters[0];
304
292
  loaderInfo._$content._$build({
@@ -5,6 +5,7 @@ import type { LoopConfigImpl } from "../../../interface/LoopConfigImpl";
5
5
  import type { ParentImpl } from "../../../interface/ParentImpl";
6
6
  import type { MovieClipCharacterImpl } from "../../../interface/MovieClipCharacterImpl";
7
7
  import type { DictionaryTagImpl } from "../../../interface/DictionaryTagImpl";
8
+ import type { Character } from "../../../interface/Character";
8
9
  /**
9
10
  * MovieClip クラスは、Sprite、DisplayObjectContainer、InteractiveObject、DisplayObject
10
11
  * および EventDispatcher クラスを継承します。
@@ -290,11 +291,12 @@ export declare class MovieClip extends Sprite {
290
291
  */
291
292
  _$buildCharacter(character: MovieClipCharacterImpl): void;
292
293
  /**
293
- * @return {object}
294
+ * @param {object} character
295
+ * @return {void}
294
296
  * @method
295
297
  * @private
296
298
  */
297
- _$sync(): any;
299
+ _$sync(character: Character<MovieClipCharacterImpl>): void;
298
300
  /**
299
301
  * @param {object} tag
300
302
  * @param {DisplayObjectContainer} parent
@@ -901,16 +901,14 @@ export class MovieClip extends Sprite {
901
901
  this._$totalFrames = character.totalFrame || 1;
902
902
  }
903
903
  /**
904
- * @return {object}
904
+ * @param {object} character
905
+ * @return {void}
905
906
  * @method
906
907
  * @private
907
908
  */
908
- _$sync() {
909
- const character = super._$sync();
910
- if (character) {
911
- this._$buildCharacter(character);
912
- }
913
- return character;
909
+ _$sync(character) {
910
+ super._$sync(character);
911
+ this._$buildCharacter(character);
914
912
  }
915
913
  /**
916
914
  * @param {object} tag
@@ -7,6 +7,7 @@ import type { ParentImpl } from "../../../interface/ParentImpl";
7
7
  import type { DictionaryTagImpl } from "../../../interface/DictionaryTagImpl";
8
8
  import type { CanvasToWebGLContext } from "../../../webgl/CanvasToWebGLContext";
9
9
  import type { PlayerHitObjectImpl } from "../../../interface/PlayerHitObjectImpl";
10
+ import type { Character } from "../../../interface/Character";
10
11
  /**
11
12
  * Shape クラスには、Graphics クラスからメソッドにアクセスできる graphics プロパティがあります。
12
13
  *
@@ -94,7 +95,7 @@ export declare class Shape extends DisplayObject {
94
95
  * @method
95
96
  * @private
96
97
  */
97
- _$buildCharacter(character: ShapeCharacterImpl, loaderInfo: LoaderInfo): void;
98
+ _$buildCharacter(character: Character<ShapeCharacterImpl>, loaderInfo: LoaderInfo): void;
98
99
  /**
99
100
  * @return {void}
100
101
  * @method
@@ -102,11 +103,12 @@ export declare class Shape extends DisplayObject {
102
103
  */
103
104
  _$createWorkerInstance(): void;
104
105
  /**
105
- * @return {object}
106
+ * @param {object} character
107
+ * @return {void}
106
108
  * @method
107
109
  * @protected
108
110
  */
109
- _$sync(): ShapeCharacterImpl;
111
+ _$sync(character: ShapeCharacterImpl): void;
110
112
  /**
111
113
  * @param {object} tag
112
114
  * @param {DisplayObjectContainer} parent
@@ -309,16 +309,15 @@ export class Shape extends DisplayObject {
309
309
  $rendererWorker.postMessage(message, options);
310
310
  }
311
311
  /**
312
- * @return {object}
312
+ * @param {object} character
313
+ * @return {void}
313
314
  * @method
314
315
  * @protected
315
316
  */
316
- _$sync() {
317
- const character = super._$sync();
318
- if (character && this._$loaderInfo) {
317
+ _$sync(character) {
318
+ if (this._$loaderInfo) {
319
319
  this._$buildCharacter(character, this._$loaderInfo);
320
320
  }
321
- return character;
322
321
  }
323
322
  /**
324
323
  * @param {object} tag
@@ -152,11 +152,12 @@ export declare class Sprite extends DisplayObjectContainer {
152
152
  */
153
153
  stopDrag(): void;
154
154
  /**
155
- * @return {object}
155
+ * @param {object} character
156
+ * @return {void}
156
157
  * @method
157
158
  * @private
158
159
  */
159
- _$sync(): any;
160
+ _$sync(character: MovieClipCharacterImpl): void;
160
161
  /**
161
162
  * @param {object} tag
162
163
  * @param {DisplayObjectContainer} parent
@@ -239,22 +239,19 @@ export class Sprite extends DisplayObjectContainer {
239
239
  $dragRules.bounds = null;
240
240
  }
241
241
  /**
242
- * @return {object}
242
+ * @param {object} character
243
+ * @return {void}
243
244
  * @method
244
245
  * @private
245
246
  */
246
- _$sync() {
247
- const character = super._$sync();
247
+ _$sync(character) {
248
248
  if ($rendererWorker && this._$stage) {
249
249
  this._$createWorkerInstance();
250
250
  }
251
- if (character) {
252
- this._$controller = character.controller;
253
- this._$dictionary = character.dictionary;
254
- this._$placeMap = character.placeMap;
255
- this._$placeObjects = character.placeObjects;
256
- }
257
- return character;
251
+ this._$controller = character.controller;
252
+ this._$dictionary = character.dictionary;
253
+ this._$placeMap = character.placeMap;
254
+ this._$placeObjects = character.placeObjects;
258
255
  }
259
256
  /**
260
257
  * @param {object} tag
@@ -5,6 +5,7 @@ import type { DictionaryTagImpl } from "../../../interface/DictionaryTagImpl";
5
5
  import type { ParentImpl } from "../../../interface/ParentImpl";
6
6
  import type { CanvasToWebGLContext } from "../../../webgl/CanvasToWebGLContext";
7
7
  import type { PlayerHitObjectImpl } from "../../../interface/PlayerHitObjectImpl";
8
+ import type { Character } from "../../../interface/Character";
8
9
  /**
9
10
  * サーバーまたはローカルに保存された録画済みビデオファイルを再生する Video オブジェクトです。
10
11
  * ビデオストリームを再生するには、attachNetStream() を使用して、ビデオを Video オブジェクトに関連付けます。
@@ -257,13 +258,14 @@ export declare class Video extends DisplayObject {
257
258
  * @method
258
259
  * @private
259
260
  */
260
- _$buildCharacter(character: VideoCharacterImpl): void;
261
+ _$buildCharacter(character: Character<VideoCharacterImpl>): void;
261
262
  /**
262
- * @return {object}
263
+ * @param {object} character
264
+ * @return {void}
263
265
  * @method
264
266
  * @private
265
267
  */
266
- _$sync(): any;
268
+ _$sync(character: VideoCharacterImpl): void;
267
269
  /**
268
270
  * @param {object} tag
269
271
  * @param {DisplayObjectContainer} parent
@@ -532,16 +532,13 @@ export class Video extends DisplayObject {
532
532
  }
533
533
  }
534
534
  /**
535
- * @return {object}
535
+ * @param {object} character
536
+ * @return {void}
536
537
  * @method
537
538
  * @private
538
539
  */
539
- _$sync() {
540
- const character = super._$sync();
541
- if (character) {
542
- this._$buildCharacter(character);
543
- }
544
- return character;
540
+ _$sync(character) {
541
+ this._$buildCharacter(character);
545
542
  }
546
543
  /**
547
544
  * @param {object} tag
@@ -10,6 +10,7 @@ import type { DictionaryTagImpl } from "../../../interface/DictionaryTagImpl";
10
10
  import type { TextCharacterImpl } from "../../../interface/TextCharacterImpl";
11
11
  import type { CanvasToWebGLContext } from "../../../webgl/CanvasToWebGLContext";
12
12
  import type { PlayerHitObjectImpl } from "../../../interface/PlayerHitObjectImpl";
13
+ import type { Character } from "../../../interface/Character";
13
14
  /**
14
15
  * TextField クラスは、テキストの表示と入力用の表示オブジェクトを作成するために使用されます。
15
16
  * プロパティインスペクターを使用して、テキストフィールドにインスタンス名を付けることができます。
@@ -560,13 +561,14 @@ export declare class TextField extends InteractiveObject {
560
561
  * @method
561
562
  * @private
562
563
  */
563
- _$buildCharacter(character: TextCharacterImpl): void;
564
+ _$buildCharacter(character: Character<TextCharacterImpl>): void;
564
565
  /**
565
- * @return {object}
566
+ * @param {object} character
567
+ * @return {void}
566
568
  * @method
567
569
  * @private
568
570
  */
569
- _$sync(): any;
571
+ _$sync(character: TextCharacterImpl): void;
570
572
  /**
571
573
  * @param {object} tag
572
574
  * @param {DisplayObjectContainer} parent
@@ -1956,16 +1956,13 @@ export class TextField extends InteractiveObject {
1956
1956
  }
1957
1957
  }
1958
1958
  /**
1959
- * @return {object}
1959
+ * @param {object} character
1960
+ * @return {void}
1960
1961
  * @method
1961
1962
  * @private
1962
1963
  */
1963
- _$sync() {
1964
- const character = super._$sync();
1965
- if (character) {
1966
- this._$buildCharacter(character);
1967
- }
1968
- return character;
1964
+ _$sync(character) {
1965
+ this._$buildCharacter(character);
1969
1966
  }
1970
1967
  /**
1971
1968
  * @param {object} tag
@@ -3,6 +3,7 @@ import { ColorTransform } from "../next2d/geom/ColorTransform";
3
3
  import { URLRequestHeader } from "../next2d/net/URLRequestHeader";
4
4
  import { Player } from "../player/Player";
5
5
  import { Point } from "../next2d/geom/Point";
6
+ import type { DisplayObjectImpl } from "../../interface/DisplayObjectImpl";
6
7
  import type { Sound } from "../next2d/media/Sound";
7
8
  import type { DragRulesImpl } from "../../interface/DragRulesImpl";
8
9
  import type { AjaxOptionImpl } from "../../interface/AjaxOptionImpl";
@@ -294,12 +295,12 @@ export declare const $ajax: (option: AjaxOptionImpl) => void;
294
295
  */
295
296
  export declare const $headerToArray: (header: string) => URLRequestHeader[];
296
297
  /**
297
- * @param {string} symbol
298
- * @return {function}
298
+ * @param {string} character_extends
299
+ * @return {DisplayObject}
299
300
  * @method
300
- * @static
301
+ * @public
301
302
  */
302
- export declare const $getClass: (symbol: string) => Window | null;
303
+ export declare const $createInstance: (character_extends: string) => DisplayObjectImpl<any>;
303
304
  /**
304
305
  * @type {Worker|null}
305
306
  */
@@ -4,6 +4,11 @@ import { URLRequestHeader } from "../next2d/net/URLRequestHeader";
4
4
  import { Player } from "../player/Player";
5
5
  import { Point } from "../next2d/geom/Point";
6
6
  import { Event as Next2DEvent } from "../next2d/events/Event";
7
+ import { Sprite } from "../next2d/display/Sprite";
8
+ import { MovieClip } from "../next2d/display/MovieClip";
9
+ import { TextField } from "../next2d/text/TextField";
10
+ import { Video } from "../next2d/media/Video";
11
+ import { Shape } from "../next2d/display/Shape";
7
12
  import { $getEvent } from "./Global";
8
13
  import { $document, $window, $devicePixelRatio } from "./Shortcut";
9
14
  import { $getArray, $poolArray, $Math, $clearTimeout, $setTimeout } from "./RenderUtil";
@@ -633,23 +638,24 @@ export const $headerToArray = (header) => {
633
638
  return results;
634
639
  };
635
640
  /**
636
- * @param {string} symbol
637
- * @return {function}
641
+ * @param {string} character_extends
642
+ * @return {DisplayObject}
638
643
  * @method
639
- * @static
644
+ * @public
640
645
  */
641
- export const $getClass = (symbol) => {
642
- const names = symbol.split(".");
643
- let object = $window;
644
- for (let idx = 0; idx < names.length; ++idx) {
645
- const name = names[idx];
646
- if (!(name in object)) {
647
- return null;
648
- }
649
- // @ts-ignore
650
- object = object[name];
646
+ export const $createInstance = (character_extends) => {
647
+ switch (character_extends) {
648
+ case MovieClip.namespace:
649
+ return new MovieClip;
650
+ case Shape.namespace:
651
+ return new Shape;
652
+ case TextField.namespace:
653
+ return new TextField();
654
+ case Sprite.namespace:
655
+ return new Sprite;
656
+ case Video.namespace:
657
+ return new Video();
651
658
  }
652
- return object;
653
659
  };
654
660
  /**
655
661
  * @type {Worker|null}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@next2d/player",
3
- "version": "1.14.16",
3
+ "version": "1.14.17",
4
4
  "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.",
5
5
  "author": "Toshiyuki Ienaga<ienaga@tvon.jp>",
6
6
  "license": "MIT",