@next2d/core 1.14.24 → 1.16.0
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.
- package/dist/Player.d.ts +7 -10
- package/dist/Player.js +29 -42
- package/package.json +12 -12
package/dist/Player.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { CacheStore } from "@next2d/share";
|
|
2
1
|
import { Stage, MovieClip } from "@next2d/display";
|
|
3
2
|
import { Event as Next2DEvent } from "@next2d/events";
|
|
4
3
|
import { Video, Sound } from "@next2d/media";
|
|
5
4
|
import { CanvasToWebGLContext } from "@next2d/webgl";
|
|
6
5
|
import { PlayerOptionsImpl, PlayerModeImpl, AttachmentImpl, EventListenerImpl, EventDispatcherImpl } from "@next2d/interface";
|
|
6
|
+
import { CacheStore } from "@next2d/share";
|
|
7
7
|
/**
|
|
8
8
|
* 描画のイベントや設定やコントロールの管理クラス
|
|
9
9
|
* Management classes for drawing events, settings and controls
|
|
@@ -12,7 +12,6 @@ import { PlayerOptionsImpl, PlayerModeImpl, AttachmentImpl, EventListenerImpl, E
|
|
|
12
12
|
*/
|
|
13
13
|
export declare class Player {
|
|
14
14
|
private readonly _$stage;
|
|
15
|
-
private readonly _$cacheStore;
|
|
16
15
|
private _$mode;
|
|
17
16
|
_$actionOffset: number;
|
|
18
17
|
_$actions: MovieClip[];
|
|
@@ -26,7 +25,6 @@ export declare class Player {
|
|
|
26
25
|
_$stopFlag: boolean;
|
|
27
26
|
private _$startTime;
|
|
28
27
|
private _$fps;
|
|
29
|
-
private _$isLoad;
|
|
30
28
|
_$loadStatus: number;
|
|
31
29
|
_$width: number;
|
|
32
30
|
_$height: number;
|
|
@@ -80,24 +78,23 @@ export declare class Player {
|
|
|
80
78
|
*/
|
|
81
79
|
static get LOAD_END(): number;
|
|
82
80
|
/**
|
|
83
|
-
* @
|
|
81
|
+
* @return {CacheStore}
|
|
84
82
|
* @readonly
|
|
85
83
|
* @public
|
|
86
84
|
*/
|
|
87
|
-
get
|
|
85
|
+
get cacheStore(): CacheStore;
|
|
88
86
|
/**
|
|
89
|
-
* @
|
|
87
|
+
* @type {HTMLCanvasElement}
|
|
90
88
|
* @readonly
|
|
91
89
|
* @public
|
|
92
90
|
*/
|
|
93
|
-
get
|
|
91
|
+
get canvas(): HTMLCanvasElement;
|
|
94
92
|
/**
|
|
95
|
-
* @
|
|
96
|
-
* @return {CacheStore}
|
|
93
|
+
* @return {Map}
|
|
97
94
|
* @readonly
|
|
98
95
|
* @public
|
|
99
96
|
*/
|
|
100
|
-
get
|
|
97
|
+
get broadcastEvents(): Map<string, EventListenerImpl[]>;
|
|
101
98
|
/**
|
|
102
99
|
* @member {CanvasToWebGLContext|null}
|
|
103
100
|
* @default null
|
package/dist/Player.js
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import { CacheStore } from "@next2d/share";
|
|
2
1
|
import { Stage } from "@next2d/display";
|
|
3
2
|
import { Event as Next2DEvent, MouseEvent as Next2DMouseEvent, EventPhase } from "@next2d/events";
|
|
4
3
|
import { SoundMixer } from "@next2d/media";
|
|
5
4
|
import { CanvasToWebGLContext } from "@next2d/webgl";
|
|
6
|
-
import { $
|
|
7
|
-
import { $Math, $performance, $COLOR_ARRAY_IDENTITY, $doUpdated, $isUpdated, $getArray, $getFloat32Array6, $getMap, $uintToRGBA, $toColorInt, $requestAnimationFrame, $cancelAnimationFrame, $poolArray, $clamp } from "@next2d/share";
|
|
5
|
+
import { $document, $window, $rendererWorker, $PREFIX, $audioContext, $TOUCH_START, $TOUCH_MOVE, $TOUCH_END, $MOUSE_DOWN, $MOUSE_MOVE, $MOUSE_UP, $MOUSE_WHEEL, $DOUBLE_CLICK, $MOUSE_LEAVE, $loadAudioData, $MATRIX_HIT_ARRAY_IDENTITY, $hitContext, $isTouch, $dropTarget, $dragRules, $isSafari, $getEvent, $setEvent, $setEventType, $setCurrentLoaderInfo, $getEventType } from "@next2d/util";
|
|
6
|
+
import { $Math, $performance, $COLOR_ARRAY_IDENTITY, $doUpdated, $isUpdated, $getArray, $getFloat32Array6, $getMap, $uintToRGBA, $toColorInt, $requestAnimationFrame, $cancelAnimationFrame, $poolArray, $clamp, $devicePixelRatio, $setDevicePixelRatio, $cacheStore } from "@next2d/share";
|
|
8
7
|
/**
|
|
9
8
|
* 描画のイベントや設定やコントロールの管理クラス
|
|
10
9
|
* Management classes for drawing events, settings and controls
|
|
@@ -17,17 +16,14 @@ export class Player {
|
|
|
17
16
|
* @public
|
|
18
17
|
*/
|
|
19
18
|
constructor() {
|
|
19
|
+
// init
|
|
20
|
+
$setDevicePixelRatio(window.devicePixelRatio);
|
|
20
21
|
/**
|
|
21
22
|
* @type {Stage}
|
|
22
23
|
* @private
|
|
23
24
|
*/
|
|
24
25
|
this._$stage = new Stage();
|
|
25
26
|
this._$stage._$player = this;
|
|
26
|
-
/**
|
|
27
|
-
* @type {CacheStore}
|
|
28
|
-
* @private
|
|
29
|
-
*/
|
|
30
|
-
this._$cacheStore = new CacheStore();
|
|
31
27
|
/**
|
|
32
28
|
* @type {string}
|
|
33
29
|
* @private
|
|
@@ -98,12 +94,6 @@ export class Player {
|
|
|
98
94
|
* @private
|
|
99
95
|
*/
|
|
100
96
|
this._$fps = 16;
|
|
101
|
-
/**
|
|
102
|
-
* @type {boolean}
|
|
103
|
-
* @default false
|
|
104
|
-
* @private
|
|
105
|
-
*/
|
|
106
|
-
this._$isLoad = false;
|
|
107
97
|
/**
|
|
108
98
|
* @type {number}
|
|
109
99
|
* @default 0
|
|
@@ -322,6 +312,14 @@ export class Player {
|
|
|
322
312
|
static get LOAD_END() {
|
|
323
313
|
return 2;
|
|
324
314
|
}
|
|
315
|
+
/**
|
|
316
|
+
* @return {CacheStore}
|
|
317
|
+
* @readonly
|
|
318
|
+
* @public
|
|
319
|
+
*/
|
|
320
|
+
get cacheStore() {
|
|
321
|
+
return $cacheStore;
|
|
322
|
+
}
|
|
325
323
|
/**
|
|
326
324
|
* @type {HTMLCanvasElement}
|
|
327
325
|
* @readonly
|
|
@@ -338,15 +336,6 @@ export class Player {
|
|
|
338
336
|
get broadcastEvents() {
|
|
339
337
|
return this._$broadcastEvents;
|
|
340
338
|
}
|
|
341
|
-
/**
|
|
342
|
-
* @member {CacheStore}
|
|
343
|
-
* @return {CacheStore}
|
|
344
|
-
* @readonly
|
|
345
|
-
* @public
|
|
346
|
-
*/
|
|
347
|
-
get cacheStore() {
|
|
348
|
-
return this._$cacheStore;
|
|
349
|
-
}
|
|
350
339
|
/**
|
|
351
340
|
* @member {CanvasToWebGLContext|null}
|
|
352
341
|
* @default null
|
|
@@ -507,7 +496,7 @@ export class Player {
|
|
|
507
496
|
this._$stopFlag = true;
|
|
508
497
|
this._$timerId = -1;
|
|
509
498
|
SoundMixer.stopAll();
|
|
510
|
-
|
|
499
|
+
$cacheStore.reset();
|
|
511
500
|
if ($rendererWorker) {
|
|
512
501
|
$rendererWorker.postMessage({
|
|
513
502
|
"command": "stop"
|
|
@@ -521,7 +510,7 @@ export class Player {
|
|
|
521
510
|
* @public
|
|
522
511
|
*/
|
|
523
512
|
removeCache(id) {
|
|
524
|
-
|
|
513
|
+
$cacheStore.removeCache(id);
|
|
525
514
|
if ($rendererWorker) {
|
|
526
515
|
$rendererWorker.postMessage({
|
|
527
516
|
"command": "removeCache",
|
|
@@ -819,7 +808,7 @@ export class Player {
|
|
|
819
808
|
});
|
|
820
809
|
if (gl) {
|
|
821
810
|
this._$context = new CanvasToWebGLContext(gl, this._$getSamples());
|
|
822
|
-
|
|
811
|
+
$cacheStore.context = this._$context;
|
|
823
812
|
}
|
|
824
813
|
else {
|
|
825
814
|
alert("WebGL setting is off. Please turn the setting on.");
|
|
@@ -941,9 +930,6 @@ export class Player {
|
|
|
941
930
|
const div = $document
|
|
942
931
|
.getElementById(this.contentElementId);
|
|
943
932
|
if (div) {
|
|
944
|
-
// cache reset
|
|
945
|
-
this._$stage._$doChanged();
|
|
946
|
-
this._$cacheStore.reset();
|
|
947
933
|
const parent = div.parentElement;
|
|
948
934
|
if (!parent) {
|
|
949
935
|
throw new Error("the parentElement is null.");
|
|
@@ -982,6 +968,13 @@ export class Player {
|
|
|
982
968
|
: `${screenWidth / 2 - width / 2}px`;
|
|
983
969
|
width *= $devicePixelRatio;
|
|
984
970
|
height *= $devicePixelRatio;
|
|
971
|
+
// no resize
|
|
972
|
+
if (this._$width === width && this._$height === height) {
|
|
973
|
+
return;
|
|
974
|
+
}
|
|
975
|
+
// cache reset
|
|
976
|
+
this._$stage._$doChanged();
|
|
977
|
+
$cacheStore.reset();
|
|
985
978
|
// params
|
|
986
979
|
this._$scale = scale;
|
|
987
980
|
this._$width = width;
|
|
@@ -1067,6 +1060,7 @@ export class Player {
|
|
|
1067
1060
|
if (!context) { // unit test
|
|
1068
1061
|
return;
|
|
1069
1062
|
}
|
|
1063
|
+
context.clearInstacedArray();
|
|
1070
1064
|
this._$canvas.width = width;
|
|
1071
1065
|
this._$canvas.height = height;
|
|
1072
1066
|
context._$gl.viewport(0, 0, width, height);
|
|
@@ -1076,9 +1070,10 @@ export class Player {
|
|
|
1076
1070
|
manager.releaseAttachment(this._$attachment, true);
|
|
1077
1071
|
}
|
|
1078
1072
|
this._$attachment = manager
|
|
1079
|
-
.createCacheAttachment(width, height,
|
|
1073
|
+
.createCacheAttachment(width, height, true);
|
|
1080
1074
|
// update cache max size
|
|
1081
1075
|
context.setMaxSize(width, height);
|
|
1076
|
+
context._$bind(this._$attachment);
|
|
1082
1077
|
}
|
|
1083
1078
|
}
|
|
1084
1079
|
/**
|
|
@@ -1424,7 +1419,6 @@ export class Player {
|
|
|
1424
1419
|
if (!context) {
|
|
1425
1420
|
return;
|
|
1426
1421
|
}
|
|
1427
|
-
context._$bind(this._$attachment);
|
|
1428
1422
|
// reset
|
|
1429
1423
|
context.reset();
|
|
1430
1424
|
context.setTransform(1, 0, 0, 1, 0, 0);
|
|
@@ -1433,17 +1427,10 @@ export class Player {
|
|
|
1433
1427
|
this._$stage._$draw(context, this._$matrix, $COLOR_ARRAY_IDENTITY);
|
|
1434
1428
|
// stage end
|
|
1435
1429
|
this._$stage._$updated = false;
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
.
|
|
1439
|
-
|
|
1440
|
-
// reset and draw to main canvas
|
|
1441
|
-
context.reset();
|
|
1442
|
-
context.setTransform(1, 0, 0, 1, 0, 0);
|
|
1443
|
-
context.clearRect(0, 0, this._$width, this._$height);
|
|
1444
|
-
context.drawImage(texture, 0, 0, this._$width, this._$height);
|
|
1445
|
-
// re bind
|
|
1446
|
-
context._$bind(this._$attachment);
|
|
1430
|
+
context.drawInstacedArray();
|
|
1431
|
+
context
|
|
1432
|
+
.frameBuffer
|
|
1433
|
+
.transferToMainTexture();
|
|
1447
1434
|
}
|
|
1448
1435
|
/**
|
|
1449
1436
|
* @return {void}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@next2d/core",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.16.0",
|
|
4
4
|
"description": "Next2D Core Packages",
|
|
5
5
|
"author": "Toshiyuki Ienaga<ienaga@tvon.jp> (https://github.com/ienaga/)",
|
|
6
6
|
"license": "MIT",
|
|
@@ -32,16 +32,16 @@
|
|
|
32
32
|
"url": "git+https://github.com/Next2D/Player.git"
|
|
33
33
|
},
|
|
34
34
|
"peerDependencies": {
|
|
35
|
-
"@next2d/interface": "1.
|
|
36
|
-
"@next2d/webgl": "1.
|
|
37
|
-
"@next2d/display": "1.
|
|
38
|
-
"@next2d/core": "1.
|
|
39
|
-
"@next2d/net": "1.
|
|
40
|
-
"@next2d/share": "1.
|
|
41
|
-
"@next2d/events": "1.
|
|
42
|
-
"@next2d/media": "1.
|
|
43
|
-
"@next2d/text": "1.
|
|
44
|
-
"@next2d/geom": "1.
|
|
45
|
-
"@next2d/util": "1.
|
|
35
|
+
"@next2d/interface": "1.16.0",
|
|
36
|
+
"@next2d/webgl": "1.16.0",
|
|
37
|
+
"@next2d/display": "1.16.0",
|
|
38
|
+
"@next2d/core": "1.16.0",
|
|
39
|
+
"@next2d/net": "1.16.0",
|
|
40
|
+
"@next2d/share": "1.16.0",
|
|
41
|
+
"@next2d/events": "1.16.0",
|
|
42
|
+
"@next2d/media": "1.16.0",
|
|
43
|
+
"@next2d/text": "1.16.0",
|
|
44
|
+
"@next2d/geom": "1.16.0",
|
|
45
|
+
"@next2d/util": "1.16.0"
|
|
46
46
|
}
|
|
47
47
|
}
|