@next2d/display 1.16.0 → 1.17.1

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.
@@ -546,6 +546,14 @@ export declare class DisplayObject extends EventDispatcher {
546
546
  * @private
547
547
  */
548
548
  _$removeWorkerInstance(): void;
549
+ /**
550
+ * @param {Float32Array} buffer
551
+ * @param {number} [index = 0]
552
+ * @return {void}
553
+ * @method
554
+ * @private
555
+ */
556
+ _$registerProperty(buffer: Float32Array, index?: number): void;
549
557
  /**
550
558
  * @return {object}
551
559
  * @method
@@ -1,6 +1,6 @@
1
1
  import { Event as Next2DEvent, EventDispatcher } from "@next2d/events";
2
2
  import { Transform, Rectangle, Point } from "@next2d/geom";
3
- import { $getEvent, $getInstanceId, $currentMousePoint, $poolColorTransform, $rendererWorker, $poolMatrix, $hitContext, $variables } from "@next2d/util";
3
+ import { $getEvent, $getInstanceId, $currentMousePoint, $poolColorTransform, $rendererWorker, $poolMatrix, $hitContext, $variables, $blendToNumber } from "@next2d/util";
4
4
  import { $doUpdated, $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, $devicePixelRatio, $poolArray, $cacheStore } from "@next2d/share";
5
5
  /**
6
6
  * DisplayObject クラスは、表示リストに含めることのできるすべてのオブジェクトに関する基本クラスです。
@@ -1599,6 +1599,86 @@ export class DisplayObject extends EventDispatcher {
1599
1599
  });
1600
1600
  }
1601
1601
  }
1602
+ /**
1603
+ * @param {Float32Array} buffer
1604
+ * @param {number} [index = 0]
1605
+ * @return {void}
1606
+ * @method
1607
+ * @private
1608
+ */
1609
+ _$registerProperty(buffer, index = 0) {
1610
+ // visible
1611
+ buffer[index++] = +this._$visible;
1612
+ // depth
1613
+ buffer[index++] = this._$placeId;
1614
+ // clip depth
1615
+ buffer[index++] = this._$clipDepth;
1616
+ // isMask
1617
+ buffer[index++] = +this._$isMask;
1618
+ const mask = this._$mask;
1619
+ buffer[index++] = +(mask !== null);
1620
+ if (mask) {
1621
+ // mask id
1622
+ buffer[index++] = mask._$instanceId;
1623
+ let maskMatrix = $MATRIX_ARRAY_IDENTITY;
1624
+ let parent = mask._$parent;
1625
+ while (parent) {
1626
+ maskMatrix = $multiplicationMatrix(parent._$transform._$rawMatrix(), maskMatrix);
1627
+ parent = parent._$parent;
1628
+ }
1629
+ // mask matrix
1630
+ buffer[index++] = maskMatrix[0];
1631
+ buffer[index++] = maskMatrix[1];
1632
+ buffer[index++] = maskMatrix[2];
1633
+ buffer[index++] = maskMatrix[3];
1634
+ buffer[index++] = maskMatrix[4];
1635
+ buffer[index++] = maskMatrix[5];
1636
+ }
1637
+ else {
1638
+ index += 7;
1639
+ }
1640
+ if (this._$visible) {
1641
+ const transform = this._$transform;
1642
+ // matrix
1643
+ const matrix = transform._$rawMatrix();
1644
+ buffer[index++] = matrix[0];
1645
+ buffer[index++] = matrix[1];
1646
+ buffer[index++] = matrix[2];
1647
+ buffer[index++] = matrix[3];
1648
+ buffer[index++] = matrix[4];
1649
+ buffer[index++] = matrix[5];
1650
+ // colorTransform
1651
+ const colorTransform = transform._$rawColorTransform();
1652
+ buffer[index++] = colorTransform[0];
1653
+ buffer[index++] = colorTransform[1];
1654
+ buffer[index++] = colorTransform[2];
1655
+ buffer[index++] = colorTransform[3];
1656
+ buffer[index++] = colorTransform[4];
1657
+ buffer[index++] = colorTransform[5];
1658
+ buffer[index++] = colorTransform[6];
1659
+ buffer[index++] = colorTransform[7];
1660
+ }
1661
+ else {
1662
+ index += 6; // matrix
1663
+ index += 8; // colorTransform
1664
+ }
1665
+ // blend mode
1666
+ const blendMode = this._$blendMode || this.blendMode;
1667
+ buffer[index++] = $blendToNumber(blendMode);
1668
+ // scale9Grid
1669
+ const scale9Grid = this._$scale9Grid;
1670
+ buffer[index++] = +(scale9Grid !== null);
1671
+ if (scale9Grid) {
1672
+ buffer[index++] = scale9Grid.x;
1673
+ buffer[index++] = scale9Grid.y;
1674
+ buffer[index++] = scale9Grid.width;
1675
+ buffer[index++] = scale9Grid.height;
1676
+ }
1677
+ else {
1678
+ index += 4;
1679
+ }
1680
+ // filter
1681
+ }
1602
1682
  /**
1603
1683
  * @return {object}
1604
1684
  * @method
@@ -1607,6 +1687,7 @@ export class DisplayObject extends EventDispatcher {
1607
1687
  _$createMessage() {
1608
1688
  const message = {
1609
1689
  "command": "setProperty",
1690
+ "buffer": new Float32Array(),
1610
1691
  "instanceId": this._$instanceId,
1611
1692
  "parentId": this._$parent ? this._$parent._$instanceId : -1,
1612
1693
  "visible": this._$visible
@@ -331,7 +331,7 @@ export declare class DisplayObjectContainer extends InteractiveObject {
331
331
  */
332
332
  _$createWorkerInstance(): void;
333
333
  /**
334
- * @return {object}
334
+ * @return {void}
335
335
  * @method
336
336
  * @private
337
337
  */
@@ -1,6 +1,6 @@
1
1
  import { InteractiveObject } from "./InteractiveObject";
2
2
  import { Event as Next2DEvent } from "@next2d/events";
3
- import { $createInstance, $currentPlayer, $hitContext, $isTouch, $MATRIX_HIT_ARRAY_IDENTITY, $rendererWorker } from "@next2d/util";
3
+ import { $createInstance, $currentPlayer, $getRenderBufferArray, $getRenderMessageObject, $hitContext, $isTouch, $MATRIX_HIT_ARRAY_IDENTITY, $poolRenderMessageObject, $rendererWorker } from "@next2d/util";
4
4
  import { $cacheStore, $doUpdated, $boundsMatrix, $clamp, $getArray, $getBoundsObject, $getFloat32Array6, $getFloat32Array8, $getMap, $getPreObject, $Math, $COLOR_ARRAY_IDENTITY, $MATRIX_ARRAY_IDENTITY, $multiplicationColor, $multiplicationMatrix, $Number, $poolArray, $poolBoundsObject, $poolFloat32Array6, $poolFloat32Array8, $poolMap, $poolPreObject, $devicePixelRatio } from "@next2d/share";
5
5
  /**
6
6
  * DisplayObjectContainer クラスは、表示リストで表示オブジェクトコンテナとして機能するすべてのオブジェクトの基本クラスです。
@@ -384,14 +384,11 @@ export class DisplayObjectContainer extends InteractiveObject {
384
384
  multiMatrix = $multiplicationMatrix(matrix, rawMatrix);
385
385
  }
386
386
  }
387
- const graphics = "_$graphics" in this
388
- ? this._$graphics
389
- : null;
390
387
  const children = this._$needsChildren
391
388
  ? this._$getChildren()
392
389
  : this._$children;
393
390
  // size zero
394
- if (!children.length && !graphics) {
391
+ if (!children.length) {
395
392
  const bounds = $getBoundsObject(multiMatrix[4], -multiMatrix[4], multiMatrix[5], -multiMatrix[5]);
396
393
  if (matrix && multiMatrix !== matrix) {
397
394
  $poolFloat32Array6(multiMatrix);
@@ -404,16 +401,6 @@ export class DisplayObjectContainer extends InteractiveObject {
404
401
  let xMax = -no;
405
402
  let yMin = no;
406
403
  let yMax = -no;
407
- if (graphics) {
408
- const baseBounds = graphics._$getBounds();
409
- const bounds = $boundsMatrix(baseBounds, multiMatrix);
410
- $poolBoundsObject(baseBounds);
411
- xMin = bounds.xMin;
412
- xMax = bounds.xMax;
413
- yMin = bounds.yMin;
414
- yMax = bounds.yMax;
415
- $poolBoundsObject(bounds);
416
- }
417
404
  for (let idx = 0; idx < children.length; ++idx) {
418
405
  const bounds = children[idx]._$getBounds(multiMatrix);
419
406
  xMin = $Math.min(xMin, bounds.xMin);
@@ -434,14 +421,11 @@ export class DisplayObjectContainer extends InteractiveObject {
434
421
  * @private
435
422
  */
436
423
  _$getLayerBounds(multi_matrix) {
437
- const graphics = "_$graphics" in this
438
- ? this._$graphics
439
- : null;
440
424
  const children = this._$needsChildren
441
425
  ? this._$getChildren()
442
426
  : this._$children;
443
427
  // size zero
444
- if (!children.length && !graphics) {
428
+ if (!children.length) {
445
429
  return $getBoundsObject(0, 0, 0, 0);
446
430
  }
447
431
  // data init
@@ -450,16 +434,6 @@ export class DisplayObjectContainer extends InteractiveObject {
450
434
  let xMax = -no;
451
435
  let yMin = no;
452
436
  let yMax = -no;
453
- if (graphics) {
454
- const baseBounds = graphics._$getBounds();
455
- const bounds = $boundsMatrix(baseBounds, multi_matrix);
456
- $poolBoundsObject(baseBounds);
457
- xMin = +bounds.xMin;
458
- xMax = +bounds.xMax;
459
- yMin = +bounds.yMin;
460
- yMax = +bounds.yMax;
461
- $poolBoundsObject(bounds);
462
- }
463
437
  for (let idx = 0; idx < children.length; ++idx) {
464
438
  const instance = children[idx];
465
439
  let multiMatrix = multi_matrix;
@@ -592,7 +566,7 @@ export class DisplayObjectContainer extends InteractiveObject {
592
566
  $cacheStore.setRemoveTimer(`${instance._$loaderInfo._$id}@${instance._$characterId}`);
593
567
  }
594
568
  if (instance._$graphics) {
595
- $cacheStore.setRemoveTimer(instance._$graphics._$cacheKey);
569
+ $cacheStore.setRemoveTimer(instance._$graphics._$uniqueKey);
596
570
  }
597
571
  // remove event
598
572
  if (instance.willTrigger(Next2DEvent.REMOVED)) {
@@ -695,7 +669,6 @@ export class DisplayObjectContainer extends InteractiveObject {
695
669
  }
696
670
  if ($rendererWorker) {
697
671
  child._$createWorkerInstance();
698
- child._$postProperty();
699
672
  this._$postChildrenIds();
700
673
  }
701
674
  }
@@ -743,7 +716,6 @@ export class DisplayObjectContainer extends InteractiveObject {
743
716
  if (!instance._$addedStage) {
744
717
  if ($rendererWorker) {
745
718
  instance._$createWorkerInstance();
746
- instance._$postProperty();
747
719
  }
748
720
  if (instance.willTrigger(Next2DEvent.ADDED_TO_STAGE)) {
749
721
  instance.dispatchEvent(new Next2DEvent(Next2DEvent.ADDED_TO_STAGE));
@@ -823,7 +795,7 @@ export class DisplayObjectContainer extends InteractiveObject {
823
795
  $cacheStore.setRemoveTimer(`${child._$loaderInfo._$id}@${child._$characterId}`);
824
796
  }
825
797
  if (child._$graphics) {
826
- $cacheStore.setRemoveTimer(child._$graphics._$cacheKey);
798
+ $cacheStore.setRemoveTimer(child._$graphics._$uniqueKey);
827
799
  }
828
800
  // reset params
829
801
  if (child instanceof DisplayObjectContainer) {
@@ -889,7 +861,7 @@ export class DisplayObjectContainer extends InteractiveObject {
889
861
  $cacheStore.setRemoveTimer(`${instance._$loaderInfo._$id}@${instance._$characterId}`);
890
862
  }
891
863
  if (instance._$graphics) {
892
- $cacheStore.setRemoveTimer(instance._$graphics._$cacheKey);
864
+ $cacheStore.setRemoveTimer(instance._$graphics._$uniqueKey);
893
865
  }
894
866
  if (instance instanceof DisplayObjectContainer) {
895
867
  instance._$removeParentAndStage();
@@ -969,12 +941,6 @@ export class DisplayObjectContainer extends InteractiveObject {
969
941
  || rawMatrix[4] !== 0 || rawMatrix[5] !== 0) {
970
942
  multiMatrix = $multiplicationMatrix(matrix, rawMatrix);
971
943
  }
972
- const graphics = "_$graphics" in this
973
- ? this._$graphics
974
- : null;
975
- if (graphics && graphics._$canDraw) {
976
- graphics._$clip(context, multiMatrix);
977
- }
978
944
  const children = this._$getChildren();
979
945
  for (let idx = 0; idx < children.length; ++idx) {
980
946
  const instance = children[idx];
@@ -1224,10 +1190,7 @@ export class DisplayObjectContainer extends InteractiveObject {
1224
1190
  // not draw
1225
1191
  const children = this._$getChildren();
1226
1192
  const length = children.length;
1227
- const graphics = "_$graphics" in this
1228
- ? this._$graphics
1229
- : null;
1230
- if (!length && (!graphics || !graphics._$canDraw)) {
1193
+ if (!length) {
1231
1194
  return;
1232
1195
  }
1233
1196
  // pre data
@@ -1244,10 +1207,6 @@ export class DisplayObjectContainer extends InteractiveObject {
1244
1207
  const preColorTransform = preObject.isLayer && preObject.color
1245
1208
  ? preObject.color
1246
1209
  : multiColor;
1247
- // if graphics draw
1248
- if (graphics && graphics._$canDraw) {
1249
- graphics._$draw(context, preMatrix, preColorTransform);
1250
- }
1251
1210
  // init clip params
1252
1211
  let shouldClip = true;
1253
1212
  let clipDepth = 0;
@@ -1486,15 +1445,6 @@ export class DisplayObjectContainer extends InteractiveObject {
1486
1445
  $poolArray(clips);
1487
1446
  $poolArray(targets);
1488
1447
  $poolMap(clipIndexes);
1489
- // graphics
1490
- if (!hit) {
1491
- const graphics = "_$graphics" in this
1492
- ? this._$graphics
1493
- : null;
1494
- if (graphics) {
1495
- hit = graphics._$hit(context, multiMatrix, options);
1496
- }
1497
- }
1498
1448
  if (multiMatrix !== matrix) {
1499
1449
  $poolFloat32Array6(multiMatrix);
1500
1450
  }
@@ -1526,17 +1476,10 @@ export class DisplayObjectContainer extends InteractiveObject {
1526
1476
  return true;
1527
1477
  }
1528
1478
  }
1529
- let hit = false;
1530
- const graphics = "_$graphics" in this
1531
- ? this._$graphics
1532
- : null;
1533
- if (graphics) {
1534
- hit = graphics._$hit(context, multiMatrix, options);
1535
- }
1536
1479
  if (multiMatrix !== matrix) {
1537
1480
  $poolFloat32Array6(multiMatrix);
1538
1481
  }
1539
- return hit;
1482
+ return false;
1540
1483
  }
1541
1484
  /**
1542
1485
  * @param {number} index
@@ -1595,30 +1538,24 @@ export class DisplayObjectContainer extends InteractiveObject {
1595
1538
  return;
1596
1539
  }
1597
1540
  this._$created = true;
1598
- const options = $getArray();
1599
- const message = {
1600
- "command": "createDisplayObjectContainer",
1601
- "instanceId": this._$instanceId,
1602
- "parentId": this._$parent ? this._$parent._$instanceId : -1
1603
- };
1604
- const graphics = "_$graphics" in this
1605
- ? this._$graphics
1606
- : null;
1607
- if (graphics) {
1608
- const recodes = graphics._$getRecodes();
1609
- options.push(recodes.buffer);
1610
- message.recodes = recodes;
1611
- message.maxAlpha = graphics._$maxAlpha;
1612
- message.canDraw = graphics._$canDraw;
1613
- message.xMin = graphics._$xMin;
1614
- message.yMin = graphics._$yMin;
1615
- message.xMax = graphics._$xMax;
1616
- message.yMax = graphics._$yMax;
1617
- }
1541
+ this._$posted = true;
1542
+ this._$updated = false;
1543
+ let index = 0;
1544
+ const buffer = $getRenderBufferArray();
1545
+ buffer[index++] = this._$instanceId;
1546
+ buffer[index++] = this._$parent ? this._$parent._$instanceId : -1;
1547
+ this._$registerProperty(buffer, index);
1548
+ const message = $getRenderMessageObject();
1549
+ message.command = "createDisplayObjectContainer";
1550
+ message.buffer = buffer;
1551
+ const options = $getArray(buffer.buffer);
1618
1552
  $rendererWorker.postMessage(message, options);
1553
+ $poolRenderMessageObject(message);
1554
+ $poolArray(options);
1555
+ this._$postChildrenIds();
1619
1556
  }
1620
1557
  /**
1621
- * @return {object}
1558
+ * @return {void}
1622
1559
  * @method
1623
1560
  * @private
1624
1561
  */
@@ -1629,21 +1566,6 @@ export class DisplayObjectContainer extends InteractiveObject {
1629
1566
  this._$postChildrenIds();
1630
1567
  const options = $getArray();
1631
1568
  const message = this._$createMessage();
1632
- const graphics = "_$graphics" in this
1633
- ? this._$graphics
1634
- : null;
1635
- if (graphics && !graphics._$buffer) {
1636
- message.maxAlpha = graphics._$maxAlpha;
1637
- message.canDraw = graphics._$canDraw;
1638
- const recodes = graphics._$getRecodes();
1639
- message.recodes = recodes;
1640
- options.push(recodes.buffer);
1641
- const bounds = this._$getBounds();
1642
- message.xMin = bounds.xMin;
1643
- message.yMin = bounds.yMin;
1644
- message.xMax = bounds.xMax;
1645
- message.yMax = bounds.yMax;
1646
- }
1647
1569
  $rendererWorker
1648
1570
  .postMessage(message, options);
1649
1571
  $poolArray(options);
@@ -1657,28 +1579,30 @@ export class DisplayObjectContainer extends InteractiveObject {
1657
1579
  * @private
1658
1580
  */
1659
1581
  _$postChildrenIds(childrenIds = null) {
1660
- if (!$rendererWorker) {
1582
+ if (!$rendererWorker || !this._$created) {
1661
1583
  return;
1662
1584
  }
1585
+ let poolIds = false;
1663
1586
  if (!childrenIds) {
1664
1587
  const children = this._$getChildren();
1665
1588
  childrenIds = $getArray();
1666
1589
  for (let idx = 0; idx < children.length; ++idx) {
1667
1590
  childrenIds.push(children[idx]._$instanceId);
1668
1591
  }
1669
- $rendererWorker.postMessage({
1670
- "command": "setChildren",
1671
- "instanceId": this._$instanceId,
1672
- "children": childrenIds
1673
- });
1674
- $poolArray(childrenIds);
1592
+ poolIds = true;
1675
1593
  }
1676
- else {
1677
- $rendererWorker.postMessage({
1678
- "command": "setChildren",
1679
- "instanceId": this._$instanceId,
1680
- "children": childrenIds
1681
- });
1594
+ const buffer = new Int32Array(childrenIds.length + 1);
1595
+ buffer[0] = this._$instanceId;
1596
+ buffer.set(childrenIds, 1);
1597
+ const message = $getRenderMessageObject();
1598
+ message.command = "setChildren";
1599
+ message.buffer = buffer;
1600
+ const options = $getArray(buffer.buffer);
1601
+ $rendererWorker.postMessage(message, options);
1602
+ $poolRenderMessageObject(message);
1603
+ $poolArray(options);
1604
+ if (poolIds) {
1605
+ $poolArray(childrenIds);
1682
1606
  }
1683
1607
  }
1684
1608
  }
@@ -56,6 +56,7 @@ export declare class Graphics {
56
56
  private _$cacheParams;
57
57
  _$bitmapId: number;
58
58
  _$mode: ShapeModeImpl;
59
+ _$posted: boolean;
59
60
  /**
60
61
  * @param {DisplayObject} src
61
62
  *
package/dist/Graphics.js CHANGED
@@ -246,6 +246,12 @@ export class Graphics {
246
246
  * @private
247
247
  */
248
248
  this._$mode = "shape";
249
+ /**
250
+ * @type {boolean}
251
+ * @default false
252
+ * @private
253
+ */
254
+ this._$posted = false;
249
255
  }
250
256
  /**
251
257
  * @description 指定されたクラスのストリングを返します。
@@ -568,6 +574,7 @@ export class Graphics {
568
574
  this._$canDraw = false;
569
575
  this._$bitmapId = 0;
570
576
  this._$mode = "shape";
577
+ this._$posted = false;
571
578
  // fill
572
579
  this._$fillType = 0;
573
580
  this._$fillGradient = null;
@@ -1376,8 +1383,8 @@ export class Graphics {
1376
1383
  ._$transform
1377
1384
  .concatenatedMatrix
1378
1385
  ._$matrix;
1379
- $poolFloat32Array6(aMatrixBase);
1380
1386
  const aMatrix = $getFloat32Array6(aMatrixBase[0], aMatrixBase[1], aMatrixBase[2], aMatrixBase[3], aMatrixBase[4] * mScale - xMin, aMatrixBase[5] * mScale - yMin);
1387
+ $poolFloat32Array6(aMatrixBase);
1381
1388
  const apMatrix = $multiplicationMatrix(aMatrix, pMatrix);
1382
1389
  const aOffsetX = apMatrix[4] - (matrix[4] - xMin);
1383
1390
  const aOffsetY = apMatrix[5] - (matrix[5] - yMin);
@@ -1390,7 +1397,14 @@ export class Graphics {
1390
1397
  const parentWidth = $Math.ceil($Math.abs(parentXMax - parentXMin));
1391
1398
  const parentHeight = $Math.ceil($Math.abs(parentYMax - parentYMin));
1392
1399
  $poolBoundsObject(parentBounds);
1393
- context.grid.enable(parentXMin, parentYMin, parentWidth, parentHeight, baseBounds, displayObject._$scale9Grid, mScale, pMatrix[0], pMatrix[1], pMatrix[2], pMatrix[3], pMatrix[4], pMatrix[5], aMatrix[0], aMatrix[1], aMatrix[2], aMatrix[3], aMatrix[4] - aOffsetX, aMatrix[5] - aOffsetY);
1400
+ const scale9Grid = displayObject._$scale9Grid;
1401
+ const grid = {
1402
+ "x": scale9Grid.x,
1403
+ "y": scale9Grid.y,
1404
+ "w": scale9Grid.width,
1405
+ "h": scale9Grid.height
1406
+ };
1407
+ context.grid.enable(parentXMin, parentYMin, parentWidth, parentHeight, baseBounds, grid, mScale, pMatrix[0], pMatrix[1], pMatrix[2], pMatrix[3], pMatrix[4], pMatrix[5], aMatrix[0], aMatrix[1], aMatrix[2], aMatrix[3], aMatrix[4] - aOffsetX, aMatrix[5] - aOffsetY);
1394
1408
  $poolFloat32Array6(pMatrix);
1395
1409
  $poolFloat32Array6(aMatrix);
1396
1410
  }
package/dist/Loader.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { DisplayObjectContainer } from "./DisplayObjectContainer";
2
2
  import { LoaderInfo } from "./LoaderInfo";
3
3
  import { URLRequest } from "@next2d/net";
4
- import type { NoCodeDataImpl, ParentImpl } from "@next2d/interface";
4
+ import type { NoCodeDataZlibImpl, NoCodeDataImpl, ParentImpl } from "@next2d/interface";
5
5
  /**
6
6
  * Loader クラスは、JSON ファイルまたはイメージ(JPEG、PNG、または GIF)ファイルを読み込むために使用します。
7
7
  * 読み込みを開始するには load() メソッドを使用します。
@@ -92,6 +92,16 @@ export declare class Loader extends DisplayObjectContainer {
92
92
  * @public
93
93
  */
94
94
  load(request: URLRequest): void;
95
+ /**
96
+ * @description NoCodeToolのJSONを直接読み込む
97
+ * Read JSON directly from NoCodeTool
98
+ *
99
+ * @param {string} json
100
+ * @return {void}
101
+ * @method
102
+ * @public
103
+ */
104
+ loadJSON(json: NoCodeDataZlibImpl | NoCodeDataImpl): void;
95
105
  /**
96
106
  * @param {ProgressEvent} event
97
107
  * @return {void}
package/dist/Loader.js CHANGED
@@ -139,6 +139,33 @@ export class Loader extends DisplayObjectContainer {
139
139
  }
140
140
  });
141
141
  }
142
+ /**
143
+ * @description NoCodeToolのJSONを直接読み込む
144
+ * Read JSON directly from NoCodeTool
145
+ *
146
+ * @param {string} json
147
+ * @return {void}
148
+ * @method
149
+ * @public
150
+ */
151
+ loadJSON(json) {
152
+ if (json.type === "zlib") {
153
+ if ($useUnzipWorker()) {
154
+ $unzipQueues.push(json);
155
+ return;
156
+ }
157
+ $updateUnzipWorkerStatus(true);
158
+ const unzipWorker = $getUnzipWorker();
159
+ const buffer = new Uint8Array(json.buffer);
160
+ unzipWorker.onmessage = (event) => {
161
+ this._$unzipHandler(event);
162
+ };
163
+ unzipWorker.postMessage(buffer, [buffer.buffer]);
164
+ }
165
+ else {
166
+ this._$build(json);
167
+ }
168
+ }
142
169
  /**
143
170
  * @param {ProgressEvent} event
144
171
  * @return {void}
@@ -165,23 +192,7 @@ export class Loader extends DisplayObjectContainer {
165
192
  }
166
193
  if (199 < target.status && 400 > target.status) {
167
194
  if (loaderInfo.format === "json") {
168
- const json = target.response;
169
- if (json.type === "zlib") {
170
- if ($useUnzipWorker()) {
171
- $unzipQueues.push(json);
172
- return;
173
- }
174
- $updateUnzipWorkerStatus(true);
175
- const unzipWorker = $getUnzipWorker();
176
- const buffer = new Uint8Array(json.buffer);
177
- unzipWorker.onmessage = (event) => {
178
- this._$unzipHandler(event);
179
- };
180
- unzipWorker.postMessage(buffer, [buffer.buffer]);
181
- }
182
- else {
183
- this._$build(json);
184
- }
195
+ this.loadJSON(target.response);
185
196
  }
186
197
  else {
187
198
  if (loaderInfo.willTrigger(IOErrorEvent.IO_ERROR)) {
package/dist/Shape.d.ts CHANGED
@@ -89,12 +89,6 @@ export declare class Shape extends DisplayObject {
89
89
  * @private
90
90
  */
91
91
  _$buildCharacter(character: Character<ShapeCharacterImpl>, loaderInfo: LoaderInfo): void;
92
- /**
93
- * @return {void}
94
- * @method
95
- * @private
96
- */
97
- _$createWorkerInstance(): void;
98
92
  /**
99
93
  * @param {object} character
100
94
  * @return {void}
@@ -153,6 +147,12 @@ export declare class Shape extends DisplayObject {
153
147
  * @private
154
148
  */
155
149
  _$hit(context: CanvasRenderingContext2D, matrix: Float32Array, options: PlayerHitObjectImpl, is_clip?: boolean): boolean;
150
+ /**
151
+ * @return {void}
152
+ * @method
153
+ * @private
154
+ */
155
+ _$createWorkerInstance(): void;
156
156
  /**
157
157
  * @return {void}
158
158
  * @method