@next2d/display 3.15.1 → 3.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/package.json +9 -9
- package/src/BitmapData.js +0 -38
- package/src/DisplayObject/service/DisplayObjectGenerateHashService.d.ts +13 -0
- package/src/DisplayObject/service/DisplayObjectGenerateHashService.js +33 -50
- package/src/DisplayObject.js +1 -544
- package/src/DisplayObjectContainer.js +0 -99
- package/src/FrameLabel.js +0 -28
- package/src/Graphics/GraphicsCommand.d.ts +22 -0
- package/src/Graphics/GraphicsCommand.js +22 -0
- package/src/Graphics/service/GraphicsCalcFillBoundsService.js +13 -4
- package/src/Graphics/service/GraphicsCalcLineBoundsService.js +82 -20
- package/src/Graphics/service/GraphicsToNumberArrayService.js +16 -16
- package/src/Graphics.js +152 -327
- package/src/GraphicsBitmapFill.js +0 -24
- package/src/GraphicsGradientFill.js +0 -54
- package/src/InteractiveObject.js +0 -28
- package/src/Loader.js +0 -25
- package/src/LoaderInfo.js +0 -69
- package/src/LoopConfig.js +0 -59
- package/src/MovieClip.js +0 -156
- package/src/Shape/usecase/ShapeLoadSrcUseCase.js +4 -1
- package/src/Shape.js +0 -91
- package/src/Sprite.js +4 -92
- package/src/Stage.js +0 -122
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @description Graphics の描画命令の種類。Graphics.MOVE_TO などの static getter と同じ値。
|
|
3
|
+
* 経路の点ごとに通る処理では、getter の呼び出しを避けてこの定数を直接参照する。
|
|
4
|
+
* Kinds of Graphics drawing commands. Same values as the static getters such as
|
|
5
|
+
* Graphics.MOVE_TO. Code that runs per path point reads these constants directly
|
|
6
|
+
* instead of calling the getters.
|
|
7
|
+
*/
|
|
8
|
+
export declare const $MOVE_TO: number;
|
|
9
|
+
export declare const $CURVE_TO: number;
|
|
10
|
+
export declare const $LINE_TO: number;
|
|
11
|
+
export declare const $CUBIC: number;
|
|
12
|
+
export declare const $ARC: number;
|
|
13
|
+
export declare const $FILL_STYLE: number;
|
|
14
|
+
export declare const $STROKE_STYLE: number;
|
|
15
|
+
export declare const $END_FILL: number;
|
|
16
|
+
export declare const $END_STROKE: number;
|
|
17
|
+
export declare const $BEGIN_PATH: number;
|
|
18
|
+
export declare const $GRADIENT_FILL: number;
|
|
19
|
+
export declare const $GRADIENT_STROKE: number;
|
|
20
|
+
export declare const $CLOSE_PATH: number;
|
|
21
|
+
export declare const $BITMAP_FILL: number;
|
|
22
|
+
export declare const $BITMAP_STROKE: number;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @description Graphics の描画命令の種類。Graphics.MOVE_TO などの static getter と同じ値。
|
|
3
|
+
* 経路の点ごとに通る処理では、getter の呼び出しを避けてこの定数を直接参照する。
|
|
4
|
+
* Kinds of Graphics drawing commands. Same values as the static getters such as
|
|
5
|
+
* Graphics.MOVE_TO. Code that runs per path point reads these constants directly
|
|
6
|
+
* instead of calling the getters.
|
|
7
|
+
*/
|
|
8
|
+
export const $MOVE_TO = 0;
|
|
9
|
+
export const $CURVE_TO = 1;
|
|
10
|
+
export const $LINE_TO = 2;
|
|
11
|
+
export const $CUBIC = 3;
|
|
12
|
+
export const $ARC = 4;
|
|
13
|
+
export const $FILL_STYLE = 5;
|
|
14
|
+
export const $STROKE_STYLE = 6;
|
|
15
|
+
export const $END_FILL = 7;
|
|
16
|
+
export const $END_STROKE = 8;
|
|
17
|
+
export const $BEGIN_PATH = 9;
|
|
18
|
+
export const $GRADIENT_FILL = 10;
|
|
19
|
+
export const $GRADIENT_STROKE = 11;
|
|
20
|
+
export const $CLOSE_PATH = 12;
|
|
21
|
+
export const $BITMAP_FILL = 13;
|
|
22
|
+
export const $BITMAP_STROKE = 14;
|
|
@@ -10,8 +10,17 @@
|
|
|
10
10
|
* @protected
|
|
11
11
|
*/
|
|
12
12
|
export const execute = (graphics, x = 0, y = 0) => {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
13
|
+
// 経路の点ごとに呼ばれるので、Math.min / Math.max の呼び出しを避けて比較で広げる
|
|
14
|
+
if (x < graphics.xMin) {
|
|
15
|
+
graphics.xMin = x;
|
|
16
|
+
}
|
|
17
|
+
if (x > graphics.xMax) {
|
|
18
|
+
graphics.xMax = x;
|
|
19
|
+
}
|
|
20
|
+
if (y < graphics.yMin) {
|
|
21
|
+
graphics.yMin = y;
|
|
22
|
+
}
|
|
23
|
+
if (y > graphics.yMax) {
|
|
24
|
+
graphics.yMax = y;
|
|
25
|
+
}
|
|
17
26
|
};
|
|
@@ -14,16 +14,49 @@
|
|
|
14
14
|
* @protected
|
|
15
15
|
*/
|
|
16
16
|
export const execute = (graphics, x = 0, y = 0, position_x = 0, position_y = 0, line_width = 0, caps = "none") => {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
17
|
+
// 経路の点ごとに呼ばれるので、Math.min / Math.max の呼び出しを避けて比較で求める。
|
|
18
|
+
// 結果は、線分の 4 隅 (と、キャップの 4 隅) の最小・最大を取る以前の計算と同じ値になる:
|
|
19
|
+
// min(x + a, x - a, px + a, px - a) = min(x, px) - |a|
|
|
20
|
+
// min(c ± a ± b) = c - |a| - |b|
|
|
21
|
+
let xMin = graphics.xMin;
|
|
22
|
+
let xMax = graphics.xMax;
|
|
23
|
+
let yMin = graphics.yMin;
|
|
24
|
+
let yMax = graphics.yMax;
|
|
25
|
+
// 始点と終点
|
|
26
|
+
let lowX = x;
|
|
27
|
+
let highX = position_x;
|
|
28
|
+
if (position_x < x) {
|
|
29
|
+
lowX = position_x;
|
|
30
|
+
highX = x;
|
|
31
|
+
}
|
|
32
|
+
let lowY = y;
|
|
33
|
+
let highY = position_y;
|
|
34
|
+
if (position_y < y) {
|
|
35
|
+
lowY = position_y;
|
|
36
|
+
highY = y;
|
|
37
|
+
}
|
|
38
|
+
if (lowX < xMin) {
|
|
39
|
+
xMin = lowX;
|
|
40
|
+
}
|
|
41
|
+
if (highX > xMax) {
|
|
42
|
+
xMax = highX;
|
|
43
|
+
}
|
|
44
|
+
if (lowY < yMin) {
|
|
45
|
+
yMin = lowY;
|
|
46
|
+
}
|
|
47
|
+
if (highY > yMax) {
|
|
48
|
+
yMax = highY;
|
|
49
|
+
}
|
|
21
50
|
// 始点 - 終点のベクトル
|
|
22
51
|
const dx = position_x - x;
|
|
23
52
|
const dy = position_y - y;
|
|
24
53
|
// ベクトルの長さ
|
|
25
54
|
const length = Math.sqrt(dx * dx + dy * dy);
|
|
26
55
|
if (!length) {
|
|
56
|
+
graphics.xMin = xMin;
|
|
57
|
+
graphics.xMax = xMax;
|
|
58
|
+
graphics.yMin = yMin;
|
|
59
|
+
graphics.yMax = yMax;
|
|
27
60
|
return;
|
|
28
61
|
}
|
|
29
62
|
// 単位ベクトル
|
|
@@ -33,26 +66,55 @@ export const execute = (graphics, x = 0, y = 0, position_x = 0, position_y = 0,
|
|
|
33
66
|
const vy = ux;
|
|
34
67
|
// 線の太さの半分(半径)
|
|
35
68
|
const r = line_width / 2;
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
69
|
+
// 線の太さの分だけ、法線方向に広げる
|
|
70
|
+
let normalX = vx * r;
|
|
71
|
+
if (normalX < 0) {
|
|
72
|
+
normalX = -normalX;
|
|
73
|
+
}
|
|
74
|
+
let normalY = vy * r;
|
|
75
|
+
if (normalY < 0) {
|
|
76
|
+
normalY = -normalY;
|
|
77
|
+
}
|
|
78
|
+
if (lowX - normalX < xMin) {
|
|
79
|
+
xMin = lowX - normalX;
|
|
80
|
+
}
|
|
81
|
+
if (highX + normalX > xMax) {
|
|
82
|
+
xMax = highX + normalX;
|
|
83
|
+
}
|
|
84
|
+
if (lowY - normalY < yMin) {
|
|
85
|
+
yMin = lowY - normalY;
|
|
86
|
+
}
|
|
87
|
+
if (highY + normalY > yMax) {
|
|
88
|
+
yMax = highY + normalY;
|
|
89
|
+
}
|
|
44
90
|
// case
|
|
45
91
|
if (caps === "round" || caps === "square") {
|
|
46
92
|
// 矩形キャップの中心点(ux, uyは逆ベクトルなのでマイナスで反転)
|
|
47
93
|
const cxn = x + r * -ux;
|
|
48
94
|
const cyn = y + r * -uy;
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
95
|
+
let tangentX = r * ux;
|
|
96
|
+
if (tangentX < 0) {
|
|
97
|
+
tangentX = -tangentX;
|
|
98
|
+
}
|
|
99
|
+
let tangentY = r * uy;
|
|
100
|
+
if (tangentY < 0) {
|
|
101
|
+
tangentY = -tangentY;
|
|
102
|
+
}
|
|
103
|
+
if (cxn - tangentX - normalX < xMin) {
|
|
104
|
+
xMin = cxn - tangentX - normalX;
|
|
105
|
+
}
|
|
106
|
+
if (cxn + tangentX + normalX > xMax) {
|
|
107
|
+
xMax = cxn + tangentX + normalX;
|
|
108
|
+
}
|
|
109
|
+
if (cyn - tangentY - normalY < yMin) {
|
|
110
|
+
yMin = cyn - tangentY - normalY;
|
|
111
|
+
}
|
|
112
|
+
if (cyn + tangentY + normalY > yMax) {
|
|
113
|
+
yMax = cyn + tangentY + normalY;
|
|
114
|
+
}
|
|
57
115
|
}
|
|
116
|
+
graphics.xMin = xMin;
|
|
117
|
+
graphics.xMax = xMax;
|
|
118
|
+
graphics.yMin = yMin;
|
|
119
|
+
graphics.yMax = yMax;
|
|
58
120
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { $getArray } from "../../DisplayObjectUtil";
|
|
2
|
-
import {
|
|
2
|
+
import { $MOVE_TO, $CURVE_TO, $LINE_TO, $CUBIC, $ARC, $FILL_STYLE, $STROKE_STYLE, $END_FILL, $END_STROKE, $BEGIN_PATH, $GRADIENT_FILL, $GRADIENT_STROKE, $CLOSE_PATH, $BITMAP_FILL, $BITMAP_STROKE } from "../GraphicsCommand";
|
|
3
3
|
/**
|
|
4
4
|
* @description Graphicsのrecodesを解析して数値配列を生成します。
|
|
5
5
|
* Parses Graphics recodes and generates a numerical array.
|
|
@@ -18,23 +18,23 @@ export const execute = (recodes) => {
|
|
|
18
18
|
const type = recodes[idx++];
|
|
19
19
|
array.push(type);
|
|
20
20
|
switch (type) {
|
|
21
|
-
case
|
|
22
|
-
case
|
|
23
|
-
case
|
|
24
|
-
case
|
|
21
|
+
case $BEGIN_PATH:
|
|
22
|
+
case $END_FILL:
|
|
23
|
+
case $END_STROKE:
|
|
24
|
+
case $CLOSE_PATH:
|
|
25
25
|
break;
|
|
26
|
-
case
|
|
27
|
-
case
|
|
26
|
+
case $MOVE_TO:
|
|
27
|
+
case $LINE_TO:
|
|
28
28
|
array.push(recodes[idx++], recodes[idx++]);
|
|
29
29
|
break;
|
|
30
|
-
case
|
|
31
|
-
case
|
|
30
|
+
case $CURVE_TO:
|
|
31
|
+
case $FILL_STYLE:
|
|
32
32
|
array.push(recodes[idx++], recodes[idx++], recodes[idx++], recodes[idx++]);
|
|
33
33
|
break;
|
|
34
|
-
case
|
|
34
|
+
case $CUBIC:
|
|
35
35
|
array.push(recodes[idx++], recodes[idx++], recodes[idx++], recodes[idx++], recodes[idx++], recodes[idx++]);
|
|
36
36
|
break;
|
|
37
|
-
case
|
|
37
|
+
case $STROKE_STYLE:
|
|
38
38
|
{
|
|
39
39
|
array.push(recodes[idx++]);
|
|
40
40
|
const lineCap = recodes[idx++];
|
|
@@ -73,10 +73,10 @@ export const execute = (recodes) => {
|
|
|
73
73
|
recodes[idx++], recodes[idx++], recodes[idx++], recodes[idx++]);
|
|
74
74
|
}
|
|
75
75
|
break;
|
|
76
|
-
case
|
|
76
|
+
case $ARC:
|
|
77
77
|
array.push(recodes[idx++], recodes[idx++], recodes[idx++]);
|
|
78
78
|
break;
|
|
79
|
-
case
|
|
79
|
+
case $GRADIENT_FILL:
|
|
80
80
|
{
|
|
81
81
|
const type = recodes[idx++];
|
|
82
82
|
const stops = recodes[idx++];
|
|
@@ -110,7 +110,7 @@ export const execute = (recodes) => {
|
|
|
110
110
|
array.push(focal);
|
|
111
111
|
}
|
|
112
112
|
break;
|
|
113
|
-
case
|
|
113
|
+
case $GRADIENT_STROKE:
|
|
114
114
|
{
|
|
115
115
|
array.push(recodes[idx++]);
|
|
116
116
|
const lineCap = recodes[idx++];
|
|
@@ -177,7 +177,7 @@ export const execute = (recodes) => {
|
|
|
177
177
|
array.push(focal);
|
|
178
178
|
}
|
|
179
179
|
break;
|
|
180
|
-
case
|
|
180
|
+
case $BITMAP_FILL:
|
|
181
181
|
{
|
|
182
182
|
const bitmapData = recodes[idx++];
|
|
183
183
|
const buffer = bitmapData.buffer;
|
|
@@ -202,7 +202,7 @@ export const execute = (recodes) => {
|
|
|
202
202
|
array.push(smooth ? 1 : 0);
|
|
203
203
|
}
|
|
204
204
|
break;
|
|
205
|
-
case
|
|
205
|
+
case $BITMAP_STROKE:
|
|
206
206
|
{
|
|
207
207
|
array.push(recodes[idx++]);
|
|
208
208
|
const lineCap = recodes[idx++];
|