@next2d/display 2.13.1 → 3.0.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.
Files changed (27) hide show
  1. package/README.md +372 -5
  2. package/package.json +9 -9
  3. package/src/BitmapData.d.ts +1 -1
  4. package/src/BitmapData.js +1 -16
  5. package/src/DisplayObject/service/DisplayObjectApplyChangesService.js +4 -3
  6. package/src/DisplayObject/service/DisplayObjectGenerateHashService.js +57 -11
  7. package/src/DisplayObject.js +2 -1
  8. package/src/DisplayObjectContainer/usecase/DisplayObjectContainerGenerateRenderQueueUseCase.js +147 -4
  9. package/src/DisplayObjectContainer/usecase/DisplayObjectContainerGetLayerBoundsUseCase.d.ts +14 -0
  10. package/src/DisplayObjectContainer/usecase/DisplayObjectContainerGetLayerBoundsUseCase.js +65 -0
  11. package/src/Graphics/service/GraphicsToNumberArrayService.js +25 -1
  12. package/src/Shape/usecase/ShapeCalcLayerBoundsUseCase.d.ts +12 -0
  13. package/src/Shape/usecase/ShapeCalcLayerBoundsUseCase.js +32 -0
  14. package/src/Shape/usecase/ShapeGenerateRenderQueueUseCase.js +28 -16
  15. package/src/Shape/usecase/ShapeLoadAsyncUseCase.d.ts +12 -0
  16. package/src/Shape/usecase/ShapeLoadAsyncUseCase.js +21 -0
  17. package/src/Shape.d.ts +10 -0
  18. package/src/Shape.js +13 -0
  19. package/src/Sprite.d.ts +2 -5
  20. package/src/Sprite.js +2 -5
  21. package/src/Stage.js +3 -0
  22. package/src/TextField/usecase/TextFieldCalcLayerBoundsUseCase.d.ts +12 -0
  23. package/src/TextField/usecase/TextFieldCalcLayerBoundsUseCase.js +32 -0
  24. package/src/TextField/usecase/TextFieldGenerateRenderQueueUseCase.js +23 -12
  25. package/src/Video/usecase/VideoCalcLayerBoundsUseCase.d.ts +12 -0
  26. package/src/Video/usecase/VideoCalcLayerBoundsUseCase.js +32 -0
  27. package/src/Video/usecase/VideoGenerateRenderQueueUseCase.js +12 -1
package/README.md CHANGED
@@ -1,11 +1,378 @@
1
- @next2d/display
2
- =============
1
+ # @next2d/display
3
2
 
4
- ## Installation
3
+ Display package for Next2D Player - DisplayObject hierarchy, Graphics drawing API, and content loading capabilities.
5
4
 
6
- ```
5
+ Next2D Player の Display パッケージ - DisplayObject 階層、Graphics 描画 API、およびコンテンツ読み込み機能を提供します。
6
+
7
+ ## Overview / 概要
8
+
9
+ The `@next2d/display` package provides the core visual object model for Next2D Player. It implements the complete DisplayObject hierarchy, a powerful vector graphics drawing API, and content loading capabilities.
10
+
11
+ `@next2d/display` パッケージは Next2D Player のコアとなるビジュアルオブジェクトモデルを提供します。完全な DisplayObject 階層、強力なベクターグラフィックス描画 API、およびコンテンツ読み込み機能を実装しています。
12
+
13
+ ### Key Features / 主な機能
14
+
15
+ - **DisplayObject Hierarchy**: Complete implementation of the display list architecture
16
+ - **DisplayObject 階層**: ディスプレイリストアーキテクチャの完全な実装
17
+ - **Graphics API**: Vector drawing capabilities with fills, strokes, and gradients
18
+ - **Graphics API**: 塗り、線、グラデーションを使ったベクター描画機能
19
+ - **Content Loading**: Dynamic loading of external content and assets
20
+ - **コンテンツ読み込み**: 外部コンテンツとアセットの動的読み込み
21
+ - **Timeline Support**: MovieClip with frame-based animation and scripting
22
+ - **タイムラインサポート**: フレームベースのアニメーションとスクリプティングを持つ MovieClip
23
+
24
+ ## Installation / インストール
25
+
26
+ ```bash
7
27
  npm install @next2d/display
8
28
  ```
9
29
 
10
- ## License
30
+ ## Directory Structure / ディレクトリ構造
31
+
32
+ ```
33
+ src/
34
+ ├── DisplayObject.ts # Base class for all display objects / すべての表示オブジェクトの基底クラス
35
+ ├── DisplayObjectContainer.ts # Container for child display objects / 子表示オブジェクトのコンテナ
36
+ ├── InteractiveObject.ts # Base class for interactive objects / インタラクティブオブジェクトの基底クラス
37
+ ├── Sprite.ts # Basic display object container with graphics / グラフィックスを持つ基本的な表示オブジェクトコンテナ
38
+ ├── MovieClip.ts # Timeline-based animation object / タイムラインベースのアニメーションオブジェクト
39
+ ├── Shape.ts # Lightweight graphics display object / 軽量なグラフィックス表示オブジェクト
40
+ ├── Stage.ts # Root display object / ルート表示オブジェクト
41
+
42
+ ├── Graphics.ts # Vector drawing API / ベクター描画 API
43
+ ├── Graphics/ # Graphics implementation details / Graphics 実装の詳細
44
+ │ ├── service/ # Graphics service layer / Graphics サービス層
45
+ │ └── usecase/ # Graphics use cases / Graphics ユースケース
46
+
47
+ ├── Loader.ts # External content loader / 外部コンテンツローダー
48
+ ├── Loader/ # Loader implementation details / Loader 実装の詳細
49
+ │ ├── service/ # Loader service layer / Loader サービス層
50
+ │ ├── usecase/ # Loader use cases / Loader ユースケース
51
+ │ └── worker/ # Loader web workers / Loader ウェブワーカー
52
+
53
+ ├── LoaderInfo.ts # Loader information / ローダー情報
54
+ ├── BitmapData.ts # Bitmap manipulation / ビットマップ操作
55
+ ├── BlendMode.ts # Blend mode constants / ブレンドモード定数
56
+ ├── FrameLabel.ts # Frame label for timeline / タイムライン用フレームラベル
57
+ ├── LoopConfig.ts # Loop configuration / ループ設定
58
+ ├── LoopType.ts # Loop type constants / ループタイプ定数
59
+ ├── DisplayObjectUtil.ts # Display object utilities / 表示オブジェクトユーティリティ
60
+
61
+ ├── GraphicsBitmapFill.ts # Bitmap fill style / ビットマップ塗りスタイル
62
+ ├── GraphicsGradientFill.ts # Gradient fill style / グラデーション塗りスタイル
63
+
64
+ ├── interface/ # TypeScript interfaces / TypeScript インターフェース
65
+ │ ├── IDisplayObject.ts
66
+ │ ├── IBlendMode.ts
67
+ │ ├── IBounds.ts
68
+ │ ├── ICharacter.ts
69
+ │ ├── IMovieClipCharacter.ts
70
+ │ ├── IShapeCharacter.ts
71
+ │ ├── ITextFieldCharacter.ts
72
+ │ ├── IVideoCharacter.ts
73
+ │ ├── ILoaderInfoData.ts
74
+ │ ├── ILoopConfig.ts
75
+ │ ├── ILoopType.ts
76
+ │ ├── IFrameLabel.ts
77
+ │ ├── IPlaceObject.ts
78
+ │ └── ... (40+ interface files)
79
+
80
+ ├── DisplayObject/ # DisplayObject implementation / DisplayObject 実装
81
+ │ ├── service/ # Service layer / サービス層
82
+ │ └── usecase/ # Use case layer / ユースケース層
83
+
84
+ ├── DisplayObjectContainer/ # DisplayObjectContainer implementation / DisplayObjectContainer 実装
85
+ │ ├── service/ # Service layer / サービス層
86
+ │ └── usecase/ # Use case layer / ユースケース層
87
+
88
+ ├── MovieClip/ # MovieClip implementation / MovieClip 実装
89
+ │ ├── service/ # Service layer / サービス層
90
+ │ └── usecase/ # Use case layer / ユースケース層
91
+
92
+ ├── Shape/ # Shape implementation / Shape 実装
93
+ │ └── service/ # Service layer / サービス層
94
+
95
+ ├── Sprite/ # Sprite implementation / Sprite 実装
96
+ │ └── service/ # Service layer / サービス層
97
+
98
+ └── Stage/ # Stage implementation / Stage 実装
99
+ └── usecase/ # Use case layer / ユースケース層
100
+ ```
101
+
102
+ ## Class Hierarchy / クラス階層
103
+
104
+ The display package implements a hierarchical object model where each class extends its parent's functionality.
105
+
106
+ display パッケージは、各クラスが親の機能を拡張する階層的なオブジェクトモデルを実装しています。
107
+
108
+ ```mermaid
109
+ classDiagram
110
+ EventDispatcher <|-- DisplayObject
111
+ DisplayObject <|-- InteractiveObject
112
+ InteractiveObject <|-- DisplayObjectContainer
113
+ DisplayObjectContainer <|-- Sprite
114
+ DisplayObjectContainer <|-- Stage
115
+ Sprite <|-- MovieClip
116
+ DisplayObject <|-- Shape
117
+
118
+ class EventDispatcher {
119
+ +addEventListener()
120
+ +removeEventListener()
121
+ +dispatchEvent()
122
+ }
123
+
124
+ class DisplayObject {
125
+ +x: number
126
+ +y: number
127
+ +width: number
128
+ +height: number
129
+ +rotation: number
130
+ +scaleX: number
131
+ +scaleY: number
132
+ +alpha: number
133
+ +visible: boolean
134
+ +blendMode: IBlendMode
135
+ +filters: IFilterArray
136
+ +parent: DisplayObjectContainer
137
+ +stage: Stage
138
+ +getBounds()
139
+ +hitTestObject()
140
+ +hitTestPoint()
141
+ +globalToLocal()
142
+ +localToGlobal()
143
+ }
144
+
145
+ class InteractiveObject {
146
+ +mouseEnabled: boolean
147
+ +doubleClickEnabled: boolean
148
+ +tabEnabled: boolean
149
+ }
150
+
151
+ class DisplayObjectContainer {
152
+ +children: DisplayObject[]
153
+ +numChildren: number
154
+ +mouseChildren: boolean
155
+ +addChild()
156
+ +addChildAt()
157
+ +removeChild()
158
+ +removeChildAt()
159
+ +removeChildren()
160
+ +getChildAt()
161
+ +getChildByName()
162
+ +getChildIndex()
163
+ +setChildIndex()
164
+ +swapChildren()
165
+ +contains()
166
+ }
167
+
168
+ class Sprite {
169
+ +graphics: Graphics
170
+ +buttonMode: boolean
171
+ +useHandCursor: boolean
172
+ +startDrag()
173
+ +stopDrag()
174
+ }
175
+
176
+ class MovieClip {
177
+ +currentFrame: number
178
+ +totalFrames: number
179
+ +currentLabel: string
180
+ +currentLabels: FrameLabel[]
181
+ +isTimelineEnabled: boolean
182
+ +play()
183
+ +stop()
184
+ +gotoAndPlay()
185
+ +gotoAndStop()
186
+ +nextFrame()
187
+ +prevFrame()
188
+ }
189
+
190
+ class Shape {
191
+ +graphics: Graphics
192
+ }
193
+
194
+ class Stage {
195
+ +stageWidth: number
196
+ +stageHeight: number
197
+ +frameRate: number
198
+ +color: number
199
+ }
200
+ ```
201
+
202
+ ## Graphics API / Graphics API
203
+
204
+ The Graphics class provides a drawing API for creating vector shapes programmatically.
205
+
206
+ Graphics クラスは、ベクター図形をプログラム的に作成するための描画 API を提供します。
207
+
208
+ ### Example Usage / 使用例
209
+
210
+ ```typescript
211
+ import { Sprite, BlendMode } from "@next2d/display";
212
+
213
+ // Create a sprite with graphics
214
+ // グラフィックスを持つスプライトを作成
215
+ const sprite = new Sprite();
216
+
217
+ // Draw a rectangle
218
+ // 矩形を描画
219
+ sprite.graphics.beginFill(0xFF0000);
220
+ sprite.graphics.drawRect(0, 0, 100, 100);
221
+ sprite.graphics.endFill();
222
+
223
+ // Draw a circle with gradient
224
+ // グラデーションを使った円を描画
225
+ sprite.graphics.beginGradientFill(
226
+ "radial",
227
+ [0xFF0000, 0x0000FF],
228
+ [1, 1],
229
+ [0, 255]
230
+ );
231
+ sprite.graphics.drawCircle(50, 50, 40);
232
+ sprite.graphics.endFill();
233
+ ```
234
+
235
+ ### Graphics Methods / Graphics メソッド
236
+
237
+ - **Line Styles / 線スタイル**
238
+ - `lineStyle()` - Set line style / 線スタイルを設定
239
+ - `lineGradientStyle()` - Set gradient line style / グラデーション線スタイルを設定
240
+
241
+ - **Fills / 塗り**
242
+ - `beginFill()` - Begin solid fill / 単色塗りを開始
243
+ - `beginGradientFill()` - Begin gradient fill / グラデーション塗りを開始
244
+ - `beginBitmapFill()` - Begin bitmap fill / ビットマップ塗りを開始
245
+ - `endFill()` - End current fill / 現在の塗りを終了
246
+
247
+ - **Drawing / 描画**
248
+ - `moveTo()` - Move drawing cursor / 描画カーソルを移動
249
+ - `lineTo()` - Draw line / 直線を描画
250
+ - `curveTo()` - Draw quadratic curve / 二次曲線を描画
251
+ - `cubicCurveTo()` - Draw cubic curve / 三次曲線を描画
252
+ - `drawRect()` - Draw rectangle / 矩形を描画
253
+ - `drawRoundRect()` - Draw rounded rectangle / 角丸矩形を描画
254
+ - `drawCircle()` - Draw circle / 円を描画
255
+ - `drawEllipse()` - Draw ellipse / 楕円を描画
256
+ - `clear()` - Clear all graphics / すべてのグラフィックスをクリア
257
+
258
+ ## MovieClip Frame Advance Logic / MovieClip フレーム進行ロジック
259
+
260
+ MovieClip implements timeline-based animation with frame labels, actions, and sounds.
261
+
262
+ MovieClip は、フレームラベル、アクション、サウンドを持つタイムラインベースのアニメーションを実装します。
263
+
264
+ ```mermaid
265
+ flowchart TD
266
+ Start([Start Frame Advance]) --> CheckStop{Stop Flag?}
267
+ CheckStop -->|Yes| End([End - No Advance])
268
+ CheckStop -->|No| CheckWait{Wait Flag?}
269
+ CheckWait -->|Yes| ClearWait[Clear Wait Flag]
270
+ CheckWait -->|No| AdvanceFrame[Increment Current Frame]
271
+
272
+ ClearWait --> ExecuteActions
273
+ AdvanceFrame --> CheckLoop{Current Frame > Total Frames?}
274
+
275
+ CheckLoop -->|Yes| LoopToStart[Current Frame = 1]
276
+ CheckLoop -->|No| ExecuteActions
277
+
278
+ LoopToStart --> ExecuteActions
279
+
280
+ ExecuteActions[Execute Frame Actions] --> PlaySounds[Play Frame Sounds]
281
+ PlaySounds --> UpdateChildren[Update Child Display Objects]
282
+ UpdateChildren --> CheckLabels{Has Frame Label?}
283
+
284
+ CheckLabels -->|Yes| SetLabel[Set Current Label]
285
+ CheckLabels -->|No| CheckStop2
286
+
287
+ SetLabel --> CheckStop2{Check Stop in Actions?}
288
+ CheckStop2 -->|Stop Called| SetStopFlag[Set Stop Flag]
289
+ CheckStop2 -->|Continue| End
290
+
291
+ SetStopFlag --> End
292
+
293
+ style Start fill:#e1f5ff
294
+ style End fill:#e1f5ff
295
+ style AdvanceFrame fill:#ffe1e1
296
+ style ExecuteActions fill:#fff4e1
297
+ style PlaySounds fill:#e1ffe1
298
+ ```
299
+
300
+ ### Frame Control Methods / フレーム制御メソッド
301
+
302
+ - `play()` - Start timeline playback / タイムライン再生を開始
303
+ - `stop()` - Stop timeline playback / タイムライン再生を停止
304
+ - `gotoAndPlay(frame)` - Jump to frame and play / フレームにジャンプして再生
305
+ - `gotoAndStop(frame)` - Jump to frame and stop / フレームにジャンプして停止
306
+ - `nextFrame()` - Advance to next frame / 次のフレームへ進む
307
+ - `prevFrame()` - Go back to previous frame / 前のフレームへ戻る
308
+
309
+ ### Timeline Properties / タイムラインプロパティ
310
+
311
+ - `currentFrame` - Current frame number (1-based) / 現在のフレーム番号(1始まり)
312
+ - `totalFrames` - Total number of frames / フレームの総数
313
+ - `currentLabel` - Current frame label / 現在のフレームラベル
314
+ - `currentLabels` - Array of all frame labels / すべてのフレームラベルの配列
315
+ - `isTimelineEnabled` - Whether timeline is enabled / タイムラインが有効かどうか
316
+
317
+ ## Loader / ローダー
318
+
319
+ The Loader class handles loading JSON files exported from Next2D AnimationTool only. It does not support loading images or other media files directly.
320
+
321
+ Loader クラスは、Next2D AnimationTool で書き出された JSON ファイルの読み込みのみに対応しています。画像やその他のメディアファイルの直接読み込みには対応していません。
322
+
323
+ **Important / 重要:**
324
+ - Only supports JSON files exported from Next2D AnimationTool / Next2D AnimationTool で書き出された JSON ファイルのみ対応
325
+ - Does not support loading images (PNG, JPG, etc.) directly / 画像(PNG、JPGなど)の直接読み込みには非対応
326
+ - Does not support loading videos directly / ビデオの直接読み込みには非対応
327
+
328
+ ```typescript
329
+ import { Loader } from "@next2d/display";
330
+ import { URLRequest } from "@next2d/net";
331
+
332
+ const loader = new Loader();
333
+ loader.contentLoaderInfo.addEventListener("complete", (event) => {
334
+ // JSON content loaded successfully
335
+ // JSONコンテンツの読み込みが成功
336
+ console.log("Loaded:", loader.content);
337
+ });
338
+
339
+ // Load Next2D AnimationTool exported JSON
340
+ // Next2D AnimationTool で書き出した JSON を読み込み
341
+ loader.load(new URLRequest("path/to/animation.json"));
342
+ ```
343
+
344
+ ## Architecture / アーキテクチャ
345
+
346
+ The package follows a clean architecture pattern with separation of concerns:
347
+
348
+ パッケージは、関心の分離を伴うクリーンアーキテクチャパターンに従っています:
349
+
350
+ - **Main Classes** - Public API and core logic / パブリック API とコアロジック
351
+ - **Service Layer** - Reusable business logic / 再利用可能なビジネスロジック
352
+ - **Use Case Layer** - Specific feature implementations / 特定の機能実装
353
+ - **Interface Layer** - TypeScript type definitions / TypeScript 型定義
354
+
355
+ This architecture ensures:
356
+ - Code reusability and maintainability / コードの再利用性と保守性
357
+ - Clear separation between public API and implementation / パブリック API と実装の明確な分離
358
+ - Testability of individual components / 個々のコンポーネントのテスト可能性
359
+
360
+ ## Related Packages / 関連パッケージ
361
+
362
+ - `@next2d/events` - Event system / イベントシステム
363
+ - `@next2d/geom` - Geometric primitives / 幾何プリミティブ
364
+ - `@next2d/filters` - Display filters / 表示フィルター
365
+ - `@next2d/text` - Text rendering (includes TextField) / テキストレンダリング(TextFieldを含む)
366
+ - `@next2d/media` - Media playback (includes Video) / メディア再生(Videoを含む)
367
+ - `@next2d/net` - Network communication / ネットワーク通信
368
+ - `@next2d/ui` - User interface components / ユーザーインターフェースコンポーネント
369
+
370
+ ## License / ライセンス
371
+
11
372
  This project is licensed under the [MIT License](https://opensource.org/licenses/MIT) - see the [LICENSE](LICENSE) file for details.
373
+
374
+ このプロジェクトは [MIT ライセンス](https://opensource.org/licenses/MIT)の下でライセンスされています - 詳細は [LICENSE](LICENSE) ファイルを参照してください。
375
+
376
+ ---
377
+
378
+ Copyright (c) 2021 Next2D
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@next2d/display",
3
- "version": "2.13.1",
3
+ "version": "3.0.1",
4
4
  "description": "Next2D Display Package",
5
5
  "author": "Toshiyuki Ienaga<ienaga@next2d.app> (https://github.com/ienaga/)",
6
6
  "license": "MIT",
@@ -24,13 +24,13 @@
24
24
  "url": "git+https://github.com/Next2D/Player.git"
25
25
  },
26
26
  "dependencies": {
27
- "@next2d/ui": "2.13.1",
28
- "@next2d/text": "2.13.1",
29
- "@next2d/geom": "2.13.1",
30
- "@next2d/media": "2.13.1",
31
- "@next2d/net": "2.13.1",
32
- "@next2d/events": "2.13.1",
33
- "@next2d/filters": "2.13.1",
34
- "@next2d/render-queue": "2.13.1"
27
+ "@next2d/ui": "3.0.1",
28
+ "@next2d/text": "3.0.1",
29
+ "@next2d/geom": "3.0.1",
30
+ "@next2d/media": "3.0.1",
31
+ "@next2d/net": "3.0.1",
32
+ "@next2d/events": "3.0.1",
33
+ "@next2d/filters": "3.0.1",
34
+ "@next2d/render-queue": "3.0.1"
35
35
  }
36
36
  }
@@ -31,7 +31,7 @@ export declare class BitmapData {
31
31
  height: number;
32
32
  /**
33
33
  * @type {Uint8Array | null}
34
- * @private
34
+ * @public
35
35
  */
36
36
  buffer: Uint8Array | null;
37
37
  /**
package/src/BitmapData.js CHANGED
@@ -50,7 +50,7 @@ export class BitmapData {
50
50
  });
51
51
  /**
52
52
  * @type {Uint8Array | null}
53
- * @private
53
+ * @public
54
54
  */
55
55
  Object.defineProperty(this, "buffer", {
56
56
  enumerable: true,
@@ -58,23 +58,8 @@ export class BitmapData {
58
58
  writable: true,
59
59
  value: void 0
60
60
  });
61
- /**
62
- * @type {number}
63
- * @default 0
64
- * @private
65
- */
66
61
  this.width = width | 0;
67
- /**
68
- * @type {number}
69
- * @default 0
70
- * @private
71
- */
72
62
  this.height = height | 0;
73
- /**
74
- * @type {Uint8Array}
75
- * @default null
76
- * @private
77
- */
78
63
  this.buffer = null;
79
64
  }
80
65
  /**
@@ -9,8 +9,9 @@
9
9
  */
10
10
  export const execute = (display_object) => {
11
11
  display_object.changed = true;
12
- const parent = display_object.parent;
13
- if (parent && !parent.changed) {
14
- execute(parent);
12
+ let parent = display_object.parent;
13
+ while (parent && !parent.changed) {
14
+ parent.changed = true;
15
+ parent = parent.parent;
15
16
  }
16
17
  };
@@ -8,17 +8,63 @@
8
8
  * @protected
9
9
  */
10
10
  export const execute = (buffer) => {
11
+ // Float32ArrayのバッファをUint32Arrayとして直接参照(DataView不要)
12
+ const bits = new Uint32Array(buffer.buffer, buffer.byteOffset, buffer.length);
13
+ const len = bits.length;
11
14
  let hash = 2166136261; // FNV-1aオフセット basis
12
- for (let idx = 0; idx < buffer.length; ++idx) {
13
- let num = buffer[idx] | 0; // 整数として扱う
14
- // 32bit整数の各バイトを処理
15
- for (let i = 0; i < 4; i++) {
16
- const byte = num & 0xff;
17
- hash ^= byte;
18
- hash = Math.imul(hash, 16777619); // FNV-1a FNV prime
19
- num >>>= 8;
20
- }
15
+ let idx = 0;
16
+ // 8要素ずつ処理(ループアンローリング)
17
+ const unrolledEnd = len & ~7; // len - (len % 8)
18
+ while (idx < unrolledEnd) {
19
+ let b = bits[idx++];
20
+ hash = Math.imul(hash ^ b & 0xff, 16777619);
21
+ hash = Math.imul(hash ^ b >> 8 & 0xff, 16777619);
22
+ hash = Math.imul(hash ^ b >> 16 & 0xff, 16777619);
23
+ hash = Math.imul(hash ^ b >>> 24, 16777619);
24
+ b = bits[idx++];
25
+ hash = Math.imul(hash ^ b & 0xff, 16777619);
26
+ hash = Math.imul(hash ^ b >> 8 & 0xff, 16777619);
27
+ hash = Math.imul(hash ^ b >> 16 & 0xff, 16777619);
28
+ hash = Math.imul(hash ^ b >>> 24, 16777619);
29
+ b = bits[idx++];
30
+ hash = Math.imul(hash ^ b & 0xff, 16777619);
31
+ hash = Math.imul(hash ^ b >> 8 & 0xff, 16777619);
32
+ hash = Math.imul(hash ^ b >> 16 & 0xff, 16777619);
33
+ hash = Math.imul(hash ^ b >>> 24, 16777619);
34
+ b = bits[idx++];
35
+ hash = Math.imul(hash ^ b & 0xff, 16777619);
36
+ hash = Math.imul(hash ^ b >> 8 & 0xff, 16777619);
37
+ hash = Math.imul(hash ^ b >> 16 & 0xff, 16777619);
38
+ hash = Math.imul(hash ^ b >>> 24, 16777619);
39
+ b = bits[idx++];
40
+ hash = Math.imul(hash ^ b & 0xff, 16777619);
41
+ hash = Math.imul(hash ^ b >> 8 & 0xff, 16777619);
42
+ hash = Math.imul(hash ^ b >> 16 & 0xff, 16777619);
43
+ hash = Math.imul(hash ^ b >>> 24, 16777619);
44
+ b = bits[idx++];
45
+ hash = Math.imul(hash ^ b & 0xff, 16777619);
46
+ hash = Math.imul(hash ^ b >> 8 & 0xff, 16777619);
47
+ hash = Math.imul(hash ^ b >> 16 & 0xff, 16777619);
48
+ hash = Math.imul(hash ^ b >>> 24, 16777619);
49
+ b = bits[idx++];
50
+ hash = Math.imul(hash ^ b & 0xff, 16777619);
51
+ hash = Math.imul(hash ^ b >> 8 & 0xff, 16777619);
52
+ hash = Math.imul(hash ^ b >> 16 & 0xff, 16777619);
53
+ hash = Math.imul(hash ^ b >>> 24, 16777619);
54
+ b = bits[idx++];
55
+ hash = Math.imul(hash ^ b & 0xff, 16777619);
56
+ hash = Math.imul(hash ^ b >> 8 & 0xff, 16777619);
57
+ hash = Math.imul(hash ^ b >> 16 & 0xff, 16777619);
58
+ hash = Math.imul(hash ^ b >>> 24, 16777619);
21
59
  }
22
- // 32bitの符号なし整数にキャストし、24bitの範囲に収める
23
- return (hash >>> 0) % 16777216;
60
+ // 残り (0〜7要素)
61
+ while (idx < len) {
62
+ const b = bits[idx++];
63
+ hash = Math.imul(hash ^ b & 0xff, 16777619);
64
+ hash = Math.imul(hash ^ b >> 8 & 0xff, 16777619);
65
+ hash = Math.imul(hash ^ b >> 16 & 0xff, 16777619);
66
+ hash = Math.imul(hash ^ b >>> 24, 16777619);
67
+ }
68
+ // 32bitハッシュ値を24bitに圧縮
69
+ return hash >>> 8 ^ hash & 0xff & 0xffffff;
24
70
  };
@@ -834,10 +834,11 @@ export class DisplayObject extends EventDispatcher {
834
834
  return this._$visible;
835
835
  }
836
836
  set visible(visible) {
837
+ visible = !!visible;
837
838
  if (this._$visible === visible) {
838
839
  return;
839
840
  }
840
- this._$visible = !!visible;
841
+ this._$visible = visible;
841
842
  displayObjectApplyChangesService(this);
842
843
  }
843
844
  /**