manga-renderer 1.0.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.
Files changed (148) hide show
  1. package/LICENSE +17 -0
  2. package/README.md +118 -0
  3. package/dist/index.d.ts +28 -0
  4. package/dist/index.js +184 -0
  5. package/dist/index.js.map +1 -0
  6. package/dist/lib/book/book.d.ts +133 -0
  7. package/dist/lib/book/book.js +329 -0
  8. package/dist/lib/book/book.js.map +1 -0
  9. package/dist/lib/book/envelope.d.ts +26 -0
  10. package/dist/lib/book/envelope.js +158 -0
  11. package/dist/lib/book/envelope.js.map +1 -0
  12. package/dist/lib/book/imagePacking.d.ts +10 -0
  13. package/dist/lib/book/imagePacking.js +213 -0
  14. package/dist/lib/book/imagePacking.js.map +1 -0
  15. package/dist/lib/book/layout.d.ts +41 -0
  16. package/dist/lib/book/layout.js +14 -0
  17. package/dist/lib/book/layout.js.map +1 -0
  18. package/dist/lib/book/notebook.d.ts +72 -0
  19. package/dist/lib/book/notebook.js +30 -0
  20. package/dist/lib/book/notebook.js.map +1 -0
  21. package/dist/lib/book/richChat.d.ts +36 -0
  22. package/dist/lib/book/richChat.js +87 -0
  23. package/dist/lib/book/richChat.js.map +1 -0
  24. package/dist/lib/book/storyboard.d.ts +125 -0
  25. package/dist/lib/book/storyboard.js +44 -0
  26. package/dist/lib/book/storyboard.js.map +1 -0
  27. package/dist/lib/layeredCanvas/dataModels/bubble.d.ts +96 -0
  28. package/dist/lib/layeredCanvas/dataModels/bubble.js +630 -0
  29. package/dist/lib/layeredCanvas/dataModels/bubble.js.map +1 -0
  30. package/dist/lib/layeredCanvas/dataModels/effect.d.ts +25 -0
  31. package/dist/lib/layeredCanvas/dataModels/effect.js +104 -0
  32. package/dist/lib/layeredCanvas/dataModels/effect.js.map +1 -0
  33. package/dist/lib/layeredCanvas/dataModels/film.d.ts +44 -0
  34. package/dist/lib/layeredCanvas/dataModels/film.js +172 -0
  35. package/dist/lib/layeredCanvas/dataModels/film.js.map +1 -0
  36. package/dist/lib/layeredCanvas/dataModels/frameTree.d.ts +99 -0
  37. package/dist/lib/layeredCanvas/dataModels/frameTree.js +861 -0
  38. package/dist/lib/layeredCanvas/dataModels/frameTree.js.map +1 -0
  39. package/dist/lib/layeredCanvas/dataModels/media.d.ts +39 -0
  40. package/dist/lib/layeredCanvas/dataModels/media.js +69 -0
  41. package/dist/lib/layeredCanvas/dataModels/media.js.map +1 -0
  42. package/dist/lib/layeredCanvas/layers/SampleLayer.d.ts +6 -0
  43. package/dist/lib/layeredCanvas/layers/SampleLayer.js +22 -0
  44. package/dist/lib/layeredCanvas/layers/SampleLayer.js.map +1 -0
  45. package/dist/lib/layeredCanvas/layers/arrayLayer.d.ts +49 -0
  46. package/dist/lib/layeredCanvas/layers/arrayLayer.js +364 -0
  47. package/dist/lib/layeredCanvas/layers/arrayLayer.js.map +1 -0
  48. package/dist/lib/layeredCanvas/layers/bubbleLayer.d.ts +97 -0
  49. package/dist/lib/layeredCanvas/layers/bubbleLayer.js +1418 -0
  50. package/dist/lib/layeredCanvas/layers/bubbleLayer.js.map +1 -0
  51. package/dist/lib/layeredCanvas/layers/floorLayer.d.ts +13 -0
  52. package/dist/lib/layeredCanvas/layers/floorLayer.js +64 -0
  53. package/dist/lib/layeredCanvas/layers/floorLayer.js.map +1 -0
  54. package/dist/lib/layeredCanvas/layers/frameLayer.d.ts +106 -0
  55. package/dist/lib/layeredCanvas/layers/frameLayer.js +1283 -0
  56. package/dist/lib/layeredCanvas/layers/frameLayer.js.map +1 -0
  57. package/dist/lib/layeredCanvas/layers/inlinePainterLayer.d.ts +33 -0
  58. package/dist/lib/layeredCanvas/layers/inlinePainterLayer.js +222 -0
  59. package/dist/lib/layeredCanvas/layers/inlinePainterLayer.js.map +1 -0
  60. package/dist/lib/layeredCanvas/layers/paperRendererLayer.d.ts +64 -0
  61. package/dist/lib/layeredCanvas/layers/paperRendererLayer.js +443 -0
  62. package/dist/lib/layeredCanvas/layers/paperRendererLayer.js.map +1 -0
  63. package/dist/lib/layeredCanvas/layers/undoLayer.d.ts +8 -0
  64. package/dist/lib/layeredCanvas/layers/undoLayer.js +24 -0
  65. package/dist/lib/layeredCanvas/layers/undoLayer.js.map +1 -0
  66. package/dist/lib/layeredCanvas/system/keyCache.d.ts +4 -0
  67. package/dist/lib/layeredCanvas/system/keyCache.js +61 -0
  68. package/dist/lib/layeredCanvas/system/keyCache.js.map +1 -0
  69. package/dist/lib/layeredCanvas/system/layeredCanvas.d.ts +172 -0
  70. package/dist/lib/layeredCanvas/system/layeredCanvas.js +597 -0
  71. package/dist/lib/layeredCanvas/system/layeredCanvas.js.map +1 -0
  72. package/dist/lib/layeredCanvas/system/paperArray.d.ts +29 -0
  73. package/dist/lib/layeredCanvas/system/paperArray.js +108 -0
  74. package/dist/lib/layeredCanvas/system/paperArray.js.map +1 -0
  75. package/dist/lib/layeredCanvas/tools/draw/bubbleGraphic.d.ts +7 -0
  76. package/dist/lib/layeredCanvas/tools/draw/bubbleGraphic.js +728 -0
  77. package/dist/lib/layeredCanvas/tools/draw/bubbleGraphic.js.map +1 -0
  78. package/dist/lib/layeredCanvas/tools/draw/clickableIcon.d.ts +42 -0
  79. package/dist/lib/layeredCanvas/tools/draw/clickableIcon.js +129 -0
  80. package/dist/lib/layeredCanvas/tools/draw/clickableIcon.js.map +1 -0
  81. package/dist/lib/layeredCanvas/tools/draw/drawFilmStack.d.ts +4 -0
  82. package/dist/lib/layeredCanvas/tools/draw/drawFilmStack.js +53 -0
  83. package/dist/lib/layeredCanvas/tools/draw/drawFilmStack.js.map +1 -0
  84. package/dist/lib/layeredCanvas/tools/draw/drawText.d.ts +8 -0
  85. package/dist/lib/layeredCanvas/tools/draw/drawText.js +45 -0
  86. package/dist/lib/layeredCanvas/tools/draw/drawText.js.map +1 -0
  87. package/dist/lib/layeredCanvas/tools/draw/richText.d.ts +15 -0
  88. package/dist/lib/layeredCanvas/tools/draw/richText.js +172 -0
  89. package/dist/lib/layeredCanvas/tools/draw/richText.js.map +1 -0
  90. package/dist/lib/layeredCanvas/tools/draw/selectionFrame.d.ts +5 -0
  91. package/dist/lib/layeredCanvas/tools/draw/selectionFrame.js +63 -0
  92. package/dist/lib/layeredCanvas/tools/draw/selectionFrame.js.map +1 -0
  93. package/dist/lib/layeredCanvas/tools/draw/typeSetting.d.ts +16 -0
  94. package/dist/lib/layeredCanvas/tools/draw/typeSetting.js +2 -0
  95. package/dist/lib/layeredCanvas/tools/draw/typeSetting.js.map +1 -0
  96. package/dist/lib/layeredCanvas/tools/draw/verticalText.d.ts +3 -0
  97. package/dist/lib/layeredCanvas/tools/draw/verticalText.js +230 -0
  98. package/dist/lib/layeredCanvas/tools/draw/verticalText.js.map +1 -0
  99. package/dist/lib/layeredCanvas/tools/focusKeeper.d.ts +8 -0
  100. package/dist/lib/layeredCanvas/tools/focusKeeper.js +15 -0
  101. package/dist/lib/layeredCanvas/tools/focusKeeper.js.map +1 -0
  102. package/dist/lib/layeredCanvas/tools/frameExamples.d.ts +382 -0
  103. package/dist/lib/layeredCanvas/tools/frameExamples.js +758 -0
  104. package/dist/lib/layeredCanvas/tools/frameExamples.js.map +1 -0
  105. package/dist/lib/layeredCanvas/tools/geometry/bubbleGeometry.d.ts +12 -0
  106. package/dist/lib/layeredCanvas/tools/geometry/bubbleGeometry.js +117 -0
  107. package/dist/lib/layeredCanvas/tools/geometry/bubbleGeometry.js.map +1 -0
  108. package/dist/lib/layeredCanvas/tools/geometry/convertPoint.d.ts +2 -0
  109. package/dist/lib/layeredCanvas/tools/geometry/convertPoint.js +25 -0
  110. package/dist/lib/layeredCanvas/tools/geometry/convertPoint.js.map +1 -0
  111. package/dist/lib/layeredCanvas/tools/geometry/geometry.d.ts +69 -0
  112. package/dist/lib/layeredCanvas/tools/geometry/geometry.js +408 -0
  113. package/dist/lib/layeredCanvas/tools/geometry/geometry.js.map +1 -0
  114. package/dist/lib/layeredCanvas/tools/geometry/geometry.vitest.d.ts +1 -0
  115. package/dist/lib/layeredCanvas/tools/geometry/geometry.vitest.js +58 -0
  116. package/dist/lib/layeredCanvas/tools/geometry/geometry.vitest.js.map +1 -0
  117. package/dist/lib/layeredCanvas/tools/geometry/quickHull.d.ts +10 -0
  118. package/dist/lib/layeredCanvas/tools/geometry/quickHull.js +91 -0
  119. package/dist/lib/layeredCanvas/tools/geometry/quickHull.js.map +1 -0
  120. package/dist/lib/layeredCanvas/tools/geometry/trapezoid.d.ts +18 -0
  121. package/dist/lib/layeredCanvas/tools/geometry/trapezoid.js +105 -0
  122. package/dist/lib/layeredCanvas/tools/geometry/trapezoid.js.map +1 -0
  123. package/dist/lib/layeredCanvas/tools/grid.d.ts +7 -0
  124. package/dist/lib/layeredCanvas/tools/grid.js +16 -0
  125. package/dist/lib/layeredCanvas/tools/grid.js.map +1 -0
  126. package/dist/lib/layeredCanvas/tools/haiku.d.ts +1 -0
  127. package/dist/lib/layeredCanvas/tools/haiku.js +17 -0
  128. package/dist/lib/layeredCanvas/tools/haiku.js.map +1 -0
  129. package/dist/lib/layeredCanvas/tools/imageUtil.d.ts +8 -0
  130. package/dist/lib/layeredCanvas/tools/imageUtil.js +58 -0
  131. package/dist/lib/layeredCanvas/tools/imageUtil.js.map +1 -0
  132. package/dist/lib/layeredCanvas/tools/kinsoku.d.ts +26 -0
  133. package/dist/lib/layeredCanvas/tools/kinsoku.js +124 -0
  134. package/dist/lib/layeredCanvas/tools/kinsoku.js.map +1 -0
  135. package/dist/lib/layeredCanvas/tools/misc.d.ts +25 -0
  136. package/dist/lib/layeredCanvas/tools/misc.js +46 -0
  137. package/dist/lib/layeredCanvas/tools/misc.js.map +1 -0
  138. package/dist/lib/layeredCanvas/tools/perfectFreehandUtil.d.ts +2 -0
  139. package/dist/lib/layeredCanvas/tools/perfectFreehandUtil.js +21 -0
  140. package/dist/lib/layeredCanvas/tools/perfectFreehandUtil.js.map +1 -0
  141. package/dist/lib/layeredCanvas/tools/pictureControl.d.ts +4 -0
  142. package/dist/lib/layeredCanvas/tools/pictureControl.js +24 -0
  143. package/dist/lib/layeredCanvas/tools/pictureControl.js.map +1 -0
  144. package/dist/lib/layeredCanvas/tools/rectHandle.d.ts +6 -0
  145. package/dist/lib/layeredCanvas/tools/rectHandle.js +17 -0
  146. package/dist/lib/layeredCanvas/tools/rectHandle.js.map +1 -0
  147. package/dist/tsconfig.tsbuildinfo +1 -0
  148. package/package.json +64 -0
@@ -0,0 +1,630 @@
1
+ import { ulid } from 'ulid';
2
+ import { rectContains } from '../tools/geometry/geometry';
3
+ import { rectHandles } from '../tools/rectHandle';
4
+ import { measureHorizontalText, measureVerticalText } from "../tools/draw/drawText";
5
+ import { FilmStack } from "./film";
6
+ const minimumBubbleSize = 72;
7
+ const threshold = 10;
8
+ export class Bubble {
9
+ // n_p0, n_p1, n_offset, n_fontSize, n_strokeWidth, n_outlineWidthはnormalized
10
+ n_p0;
11
+ n_p1;
12
+ n_offset;
13
+ rotation;
14
+ text;
15
+ shape;
16
+ embedded;
17
+ fontStyle;
18
+ fontWeight;
19
+ n_fontSize;
20
+ charSkip;
21
+ lineSkip;
22
+ fontFamily;
23
+ direction;
24
+ fontColor;
25
+ fillColor;
26
+ strokeColor;
27
+ n_strokeWidth;
28
+ outlineColor;
29
+ n_outlineWidth;
30
+ autoNewline;
31
+ uuid;
32
+ parent;
33
+ creationContext;
34
+ filmStack;
35
+ scaleLock;
36
+ rubySize;
37
+ rubyDistance;
38
+ optionContext;
39
+ // 以下一時的
40
+ pageNumber; // 当該自分が格納したのでない限り正しい値だと仮定してはいけない また保存されていることを期待してはいけない
41
+ fontRenderVersion; // フォント読み込み後の数秒後の強制再描画で変更されていないことになることを防ぐ
42
+ appearanceDelay; // ムービー生成時に使う出現までの時間(コマ単位)
43
+ hidesText; // ムービー生成時に使うテキスト非表示フラグ
44
+ prompt = '';
45
+ gallery = [];
46
+ renderInfo;
47
+ constructor() {
48
+ this.reset();
49
+ this.n_p0 = [0, 0];
50
+ this.n_p1 = [0.1, 0.1];
51
+ this.text = "empty";
52
+ this.uuid = ulid();
53
+ this.parent = null;
54
+ this.creationContext = this.getStackTrace();
55
+ this.filmStack = new FilmStack();
56
+ this.optionContext = {};
57
+ this.fontRenderVersion = 0;
58
+ this.gallery = [];
59
+ }
60
+ reset() {
61
+ const unit = 1 / 840;
62
+ this.n_offset = [0, 0];
63
+ this.rotation = 0;
64
+ this.shape = "soft";
65
+ this.embedded = false;
66
+ this.fontStyle = "normal";
67
+ this.fontWeight = "400";
68
+ this.n_fontSize = 32 * unit;
69
+ this.charSkip = 0;
70
+ this.lineSkip = 0;
71
+ this.fontFamily = "源暎アンチック";
72
+ this.direction = 'v';
73
+ this.fontColor = '#000000FF';
74
+ this.fillColor = '#ffffffE6';
75
+ this.strokeColor = "#000000FF";
76
+ this.n_strokeWidth = 3 * unit;
77
+ this.n_outlineWidth = 0;
78
+ this.outlineColor = "#000000FF";
79
+ this.autoNewline = false;
80
+ this.appearanceDelay = 0;
81
+ this.hidesText = false;
82
+ this.rubySize = 0.4;
83
+ this.rubyDistance = 0.45;
84
+ }
85
+ getStackTrace() {
86
+ return Error().stack;
87
+ }
88
+ clone(hard) {
89
+ const b = new Bubble();
90
+ b.n_p0 = [...this.n_p0];
91
+ b.n_p1 = [...this.n_p1];
92
+ b.n_offset = [...this.n_offset];
93
+ b.rotation = this.rotation;
94
+ b.text = this.text;
95
+ b.shape = this.shape;
96
+ b.embedded = this.embedded;
97
+ b.fontStyle = this.fontStyle;
98
+ b.fontWeight = this.fontWeight;
99
+ b.n_fontSize = this.n_fontSize;
100
+ b.charSkip = this.charSkip;
101
+ b.lineSkip = this.lineSkip;
102
+ b.fontFamily = this.fontFamily;
103
+ b.direction = this.direction;
104
+ b.fontColor = this.fontColor;
105
+ b.fillColor = this.fillColor;
106
+ b.strokeColor = this.strokeColor;
107
+ b.n_strokeWidth = this.n_strokeWidth;
108
+ b.outlineColor = this.outlineColor;
109
+ b.n_outlineWidth = this.n_outlineWidth;
110
+ b.autoNewline = this.autoNewline;
111
+ b.appearanceDelay = this.appearanceDelay;
112
+ b.rubySize = this.rubySize;
113
+ b.rubyDistance = this.rubyDistance;
114
+ if (hard) {
115
+ b.uuid = this.uuid;
116
+ b.parent = this.parent;
117
+ }
118
+ b.filmStack = new FilmStack();
119
+ b.filmStack.films = this.filmStack.films.map(film => film.clone());
120
+ b.optionContext = { ...this.optionContext };
121
+ return b;
122
+ }
123
+ copyStyleFrom(c) {
124
+ this.shape = c.shape;
125
+ this.embedded = c.embedded;
126
+ this.fontStyle = c.fontStyle;
127
+ this.fontWeight = c.fontWeight;
128
+ this.n_fontSize = c.n_fontSize;
129
+ this.charSkip = c.charSkip;
130
+ this.lineSkip = c.lineSkip;
131
+ this.fontFamily = c.fontFamily;
132
+ this.direction = c.direction;
133
+ this.fontColor = c.fontColor;
134
+ this.fillColor = c.fillColor;
135
+ this.strokeColor = c.strokeColor;
136
+ this.n_strokeWidth = c.n_strokeWidth;
137
+ this.outlineColor = c.outlineColor;
138
+ this.n_outlineWidth = c.n_outlineWidth;
139
+ this.autoNewline = c.autoNewline;
140
+ this.optionContext = { ...c.optionContext };
141
+ this.rubySize = c.rubySize;
142
+ this.rubyDistance = c.rubyDistance;
143
+ }
144
+ static getUnit(paperSize) {
145
+ return 1 / Math.min(paperSize[0], paperSize[1]);
146
+ }
147
+ static compile(paperSize, json) {
148
+ // paperSizeはほぼ後方互換性のために存在している
149
+ // 一旦Bubbleにしたあとはすべて正規化されている
150
+ // 古いjsonはn_に一貫性がない 古い"fontsize"はn_fontsize相当
151
+ const defaultUnit = 1 / 840;
152
+ const unit = Bubble.getUnit(paperSize);
153
+ const normalizedNumber = (v1, v2, v3) => { if (v1 != null) {
154
+ return v1;
155
+ }
156
+ else if (v2 != null) {
157
+ return v2 * unit;
158
+ }
159
+ else {
160
+ return v3 * defaultUnit;
161
+ } };
162
+ const b = new Bubble();
163
+ b.n_p0 = json.p0 ?? json.n_p0;
164
+ b.n_p1 = json.p1 ?? json.n_p1;
165
+ b.n_offset = [0, 0];
166
+ if (json.n_offset) {
167
+ b.n_offset = json.n_offset;
168
+ }
169
+ else if (json.offset) {
170
+ b.n_offset = this.normalizedPosition(paperSize, json.offset);
171
+ }
172
+ b.rotation = json.rotation ?? 0;
173
+ b.text = json.text ?? "";
174
+ b.shape = json.shape ?? "square";
175
+ if (b.shape == "harsh-curve")
176
+ b.shape = "shout";
177
+ b.embedded = json.embedded ?? false;
178
+ b.fontStyle = json.fontStyle ?? "normal";
179
+ b.fontWeight = json.fontWeight ?? "400";
180
+ b.n_fontSize = 26 * unit;
181
+ if (json.n_fontSize) {
182
+ b.n_fontSize = json.n_fontSize;
183
+ }
184
+ else if (json.fontSize) {
185
+ b.n_fontSize = json.fontSize;
186
+ }
187
+ b.charSkip = json.charSkip ?? 0;
188
+ b.lineSkip = json.lineSkip ?? 0;
189
+ b.fontFamily = json.fontFamily ?? "Noto Sans JP";
190
+ b.direction = json.direction ?? 'v';
191
+ b.fontColor = json.fontColor ?? '#000000FF';
192
+ b.fillColor = json.fillColor ?? '#ffffffE6';
193
+ b.strokeColor = json.strokeColor ?? "#000000FF";
194
+ b.n_strokeWidth = normalizedNumber(json.n_strokeWidth, json.strokeWidth, 1);
195
+ b.outlineColor = json.outlineColor ?? "#000000FF";
196
+ b.n_outlineWidth = normalizedNumber(json.n_outlineWidth, json.outlineWidth, 0);
197
+ b.autoNewline = json.autoNewline ?? true;
198
+ b.uuid = json.uuid ?? ulid();
199
+ b.parent = json.parent;
200
+ b.rubySize = json.rubySize ?? 0.4;
201
+ b.rubyDistance = json.rubyDistance ?? 0.45;
202
+ b.optionContext = Bubble.getInitialOptions(b);
203
+ Object.assign(b.optionContext, json.optionContext ?? {});
204
+ b.forceEnoughSize(paperSize);
205
+ return b;
206
+ }
207
+ static decompile(b) {
208
+ const unit = 1 / 840;
209
+ const equalNumber = (v1, v2) => { return Math.abs(v1 - v2) < 0.0001; };
210
+ return {
211
+ n_p0: b.n_p0,
212
+ n_p1: b.n_p1,
213
+ n_offset: b.n_offset[0] == 0 && b.n_offset[1] == 0 ? undefined : b.n_offset,
214
+ rotation: b.rotation == 0 ? undefined : b.rotation,
215
+ text: b.text == "" ? undefined : b.text,
216
+ shape: b.shape == "square" ? undefined : b.shape,
217
+ embedded: b.embedded == false ? undefined : b.embedded,
218
+ fontStyle: b.fontStyle == "normal" ? undefined : b.fontStyle,
219
+ fontWeight: b.fontWeight == "400" ? undefined : b.fontWeight,
220
+ n_fontSize: equalNumber(b.n_fontSize, 26 * unit) ? undefined : b.n_fontSize,
221
+ charSkip: b.charSkip == 0 ? undefined : b.charSkip,
222
+ lineSkip: b.lineSkip == 0 ? undefined : b.lineSkip,
223
+ fontFamily: b.fontFamily == "Noto Sans JP" ? undefined : b.fontFamily,
224
+ direction: b.direction == 'v' ? undefined : b.direction,
225
+ fontColor: b.fontColor == '#000000FF' ? undefined : b.fontColor,
226
+ fillColor: b.fillColor == '#ffffffE6' ? undefined : b.fillColor,
227
+ strokeColor: b.strokeColor == "#000000FF" ? undefined : b.strokeColor,
228
+ n_strokeWidth: equalNumber(b.n_strokeWidth, 1 * unit) ? undefined : b.n_strokeWidth,
229
+ outlineColor: b.outlineColor == "#000000FF" ? undefined : b.outlineColor,
230
+ n_outlineWidth: equalNumber(b.n_outlineWidth, 0 * unit) ? undefined : b.n_outlineWidth,
231
+ autoNewline: b.autoNewline ? undefined : b.autoNewline,
232
+ uuid: b.uuid,
233
+ parent: b.parent,
234
+ rubySize: b.rubySize == 0.4 ? undefined : b.rubySize,
235
+ rubyDistance: b.rubyDistance == 0.45 ? undefined : b.rubyDistance,
236
+ optionContext: JSON.stringify(b.optionContext) == JSON.stringify(Bubble.getInitialOptions(b)) ? undefined : b.optionContext,
237
+ };
238
+ }
239
+ static getPhysicalPoint(paperSize, n_p) {
240
+ return [n_p[0] * paperSize[0], n_p[1] * paperSize[1]];
241
+ }
242
+ getPhysicalRect(paperSize) {
243
+ const [x0, y0] = Bubble.getPhysicalPoint(paperSize, this.n_p0);
244
+ const [x1, y1] = Bubble.getPhysicalPoint(paperSize, this.n_p1);
245
+ return [x0, y0, x1 - x0, y1 - y0];
246
+ }
247
+ getPhysicalBox(paperSize) {
248
+ return [Bubble.getPhysicalPoint(paperSize, this.n_p0), Bubble.getPhysicalPoint(paperSize, this.n_p1)];
249
+ }
250
+ getPhysicalCenter(paperSize) {
251
+ const r = this.getPhysicalRect(paperSize);
252
+ return [r[0] + r[2] / 2, r[1] + r[3] / 2];
253
+ }
254
+ getPhysicalSize(paperSize) {
255
+ const r = this.getPhysicalRect(paperSize);
256
+ return [r[2], r[3]];
257
+ }
258
+ getPhysicalOffset(paperSize) {
259
+ return Bubble.denormalizedPosition(paperSize, this.n_offset);
260
+ }
261
+ getPhysicalFontSize(paperSize) {
262
+ return this.n_fontSize / Bubble.getUnit(paperSize);
263
+ }
264
+ getPhysicalStrokeWidth(paperSize) {
265
+ return this.n_strokeWidth / Bubble.getUnit(paperSize);
266
+ }
267
+ getPhysicalOutlineWidth(paperSize) {
268
+ return this.n_outlineWidth / Bubble.getUnit(paperSize);
269
+ }
270
+ getPhysicalRegularizedRect(paperSize) {
271
+ const [p0, p1] = this.regularized();
272
+ const [x0, y0] = Bubble.getPhysicalPoint(paperSize, p0);
273
+ const [x1, y1] = Bubble.getPhysicalPoint(paperSize, p1);
274
+ return [x0, y0, x1 - x0, y1 - y0];
275
+ }
276
+ getPhysicalRegularizedBox(paperSize) {
277
+ const [n_p0, n_p1] = this.regularized();
278
+ return [Bubble.getPhysicalPoint(paperSize, n_p0), Bubble.getPhysicalPoint(paperSize, n_p1)];
279
+ }
280
+ hasEnoughSize(paperSize) {
281
+ const r = this.getPhysicalRect(paperSize);
282
+ return minimumBubbleSize <= r[2] && minimumBubbleSize <= r[3];
283
+ }
284
+ static enoughSize(size) {
285
+ return [
286
+ Math.max(size[0], minimumBubbleSize + 1),
287
+ Math.max(size[1], minimumBubbleSize + 1),
288
+ ];
289
+ }
290
+ setPhysicalCenter(paperSize, p) {
291
+ const [x, y] = p;
292
+ const [w, h] = this.getPhysicalSize(paperSize);
293
+ this.n_p0 = Bubble.normalizedPosition(paperSize, [x - w / 2, y - h / 2]);
294
+ this.n_p1 = Bubble.normalizedPosition(paperSize, [x + w / 2, y + h / 2]);
295
+ }
296
+ setPhysicalSize(paperSize, size) {
297
+ const center = [(this.n_p0[0] + this.n_p1[0]) / 2, (this.n_p0[1] + this.n_p1[1]) / 2];
298
+ this.n_p0 = [center[0] - size[0] / paperSize[0] / 2, center[1] - size[1] / paperSize[1] / 2];
299
+ this.n_p1 = [center[0] + size[0] / paperSize[0] / 2, center[1] + size[1] / paperSize[1] / 2];
300
+ }
301
+ setPhysicalRect(paperSize, rect) {
302
+ this.n_p0 = [rect[0] / paperSize[0], rect[1] / paperSize[1]];
303
+ this.n_p1 = [(rect[0] + rect[2]) / paperSize[0], (rect[1] + rect[3]) / paperSize[1]];
304
+ }
305
+ setPhysicalFontSize(paperSize, n) {
306
+ this.n_fontSize = n * Bubble.getUnit(paperSize);
307
+ }
308
+ setPhysicalStrokeWidth(paperSize, n) {
309
+ this.n_strokeWidth = n * Bubble.getUnit(paperSize);
310
+ }
311
+ setPhysicalOutlineWidth(paperSize, n) {
312
+ this.n_outlineWidth = n * Bubble.getUnit(paperSize);
313
+ }
314
+ setPhysicalOffset(paperSize, p) {
315
+ this.n_offset = Bubble.normalizedPosition(paperSize, p);
316
+ }
317
+ forceEnoughSize(paperSize) {
318
+ const r = this.getPhysicalRect(paperSize);
319
+ const enoughSize = Bubble.enoughSize([r[2], r[3]]);
320
+ this.setPhysicalSize(paperSize, enoughSize);
321
+ }
322
+ contains(paperSize, p) {
323
+ const [x, y] = p;
324
+ const [x0, y0] = Bubble.getPhysicalPoint(paperSize, this.n_p0);
325
+ const [x1, y1] = Bubble.getPhysicalPoint(paperSize, this.n_p1);
326
+ return x0 <= x && x <= x1 && y0 <= y && y <= y1;
327
+ }
328
+ getHandleAt(paperSize, p) {
329
+ for (let handle of rectHandles) {
330
+ const rect = this.getHandleRect(paperSize, handle);
331
+ if (rectContains(rect, p)) {
332
+ return handle;
333
+ }
334
+ }
335
+ return null;
336
+ }
337
+ getHandleRect(paperSize, handle) {
338
+ const [x, y, w, h] = this.getPhysicalRect(paperSize);
339
+ switch (handle) {
340
+ case "topLeft":
341
+ return [x - threshold, y - threshold, threshold * 2, threshold * 2];
342
+ case "topRight":
343
+ return [x + w - threshold, y - threshold, threshold * 2, threshold * 2];
344
+ case "bottomLeft":
345
+ return [x - threshold, y + h - threshold, threshold * 2, threshold * 2];
346
+ case "bottomRight":
347
+ return [
348
+ x + w - threshold,
349
+ y + h - threshold,
350
+ threshold * 2,
351
+ threshold * 2,
352
+ ];
353
+ case "top":
354
+ return [x - threshold, y - threshold, w + threshold * 2, threshold * 2];
355
+ case "bottom":
356
+ return [
357
+ x - threshold,
358
+ y + h - threshold,
359
+ w + threshold * 2,
360
+ threshold * 2,
361
+ ];
362
+ case "left":
363
+ return [x - threshold, y - threshold, threshold * 2, h + threshold * 2];
364
+ case "right":
365
+ return [
366
+ x + w - threshold,
367
+ y - threshold,
368
+ threshold * 2,
369
+ h + threshold * 2,
370
+ ];
371
+ }
372
+ }
373
+ regularized() {
374
+ const p0 = [Math.min(this.n_p0[0], this.n_p1[0]), Math.min(this.n_p0[1], this.n_p1[1])];
375
+ const p1 = [Math.max(this.n_p0[0], this.n_p1[0]), Math.max(this.n_p0[1], this.n_p1[1])];
376
+ return [p0, p1];
377
+ }
378
+ regularize() {
379
+ [this.n_p0, this.n_p1] = this.regularized();
380
+ }
381
+ canLink() {
382
+ console.log(this.optionSet);
383
+ return !!this.optionSet.link;
384
+ }
385
+ linkTo(b) {
386
+ this.parent = b.uuid;
387
+ }
388
+ linkedTo(b) {
389
+ return this.parent === b.uuid || b.parent === this.uuid;
390
+ }
391
+ static normalizedPosition(paperSize, p) {
392
+ return [p[0] / paperSize[0], p[1] / paperSize[1]];
393
+ }
394
+ static denormalizedPosition(paperSize, p) {
395
+ return [p[0] * paperSize[0], p[1] * paperSize[1]];
396
+ }
397
+ get optionSet() {
398
+ return bubbleOptionSets[this.shape];
399
+ }
400
+ initOptions() {
401
+ this.optionContext = Bubble.getInitialOptions(this);
402
+ }
403
+ static getInitialOptions(b, sample = false) {
404
+ const optionSet = bubbleOptionSets[b.shape];
405
+ const options = {};
406
+ for (const option of Object.keys(optionSet)) {
407
+ if (optionSet[option].init) {
408
+ options[option] = optionSet[option].init(b);
409
+ if (sample && optionSet[option].sampleInit) {
410
+ options[option] = optionSet[option].sampleInit(b);
411
+ }
412
+ }
413
+ }
414
+ return options;
415
+ }
416
+ calculateFitSize(paperSize) {
417
+ const fontSize = this.getPhysicalFontSize(paperSize);
418
+ const baselineSkip = fontSize * 1.5 * (1.0 + this.lineSkip);
419
+ const charSkip = fontSize * (1.0 + this.charSkip);
420
+ const canvas = document.createElement('canvas');
421
+ const ctx = canvas.getContext('2d');
422
+ let size = [0, 0];
423
+ if (this.direction == 'v') {
424
+ const m = measureVerticalText(ctx, Infinity, this.text, baselineSkip, charSkip, false);
425
+ size = [Math.floor(m.width * 1.2), Math.floor(m.height * 1.4)];
426
+ }
427
+ else {
428
+ const ss = `${this.fontStyle} ${this.fontWeight} ${fontSize}px '${this.fontFamily}'`;
429
+ ctx.font = ss;
430
+ const m = measureHorizontalText(ctx, Infinity, this.text, baselineSkip, charSkip, false);
431
+ size = [Math.floor(m.width * 1.4), Math.floor(m.height * 1.2)];
432
+ }
433
+ console.log(size);
434
+ return Bubble.enoughSize(size);
435
+ }
436
+ }
437
+ // TODO: tailTip正規化してなかった……
438
+ export const bubbleOptionSets = {
439
+ "rounded": {
440
+ link: { hint: "結合", icon: "unite" },
441
+ tailTip: { hint: "しっぽの先端", icon: "tail", init: (b) => [0, 0] },
442
+ tailMid: { hint: "しっぽの途中", icon: "curve", init: (b) => [0.5, 0] },
443
+ tailWidth: { label: "しっぽの幅", type: "number", min: 0.2, max: 2.0, step: 0.01, init: (b) => 1.0 },
444
+ xStraight: { label: "横線の長さ", type: "number", min: 0, max: 0.9, step: 0.01, init: (b) => 0.6 },
445
+ yStraight: { label: "縦線の長さ", type: "number", min: 0, max: 0.9, step: 0.01, init: (b) => 0.7 },
446
+ extract: { label: "食い込み", type: "boolean", init: (b) => false },
447
+ extractWidth: { label: "食い込み広さ", type: "number", min: 0, max: 1, step: 0.01, init: (b) => 0.2 },
448
+ shapeExpand: { label: "はみだし", type: "number", min: 0, max: 0.2, step: 0.01, init: (b) => 0 },
449
+ roughness: { label: "ラフさ", type: "number", min: 0, max: 5, step: 0.1, init: (b) => 0 },
450
+ // freehand: {label: "手書き風", type:"boolean", init: (b: Bubble) => false},
451
+ },
452
+ "square": {
453
+ link: { hint: "結合", icon: "unite" },
454
+ tailTip: { hint: "しっぽの先端", icon: "tail", init: (b) => [0, 0] },
455
+ tailMid: { hint: "しっぽの途中", icon: "curve", init: (b) => [0.5, 0] },
456
+ tailWidth: { label: "しっぽの幅", type: "number", min: 0.2, max: 2.0, step: 0.01, init: (b) => 1.0 },
457
+ extract: { label: "食い込み", type: "boolean", init: (b) => false },
458
+ extractWidth: { label: "食い込み広さ", type: "number", min: 0, max: 1, step: 0.01, init: (b) => 0.2 },
459
+ shapeExpand: { label: "はみだし", type: "number", min: 0, max: 0.2, step: 0.01, init: (b) => 0 },
460
+ roughness: { label: "ラフさ", type: "number", min: 0, max: 5, step: 0.1, init: (b) => 0 },
461
+ // freehand: {label: "手書き風", type:"boolean", init: (b: Bubble) => false},
462
+ },
463
+ "ellipse": {
464
+ link: { hint: "結合", icon: "unite" },
465
+ tailTip: { hint: "しっぽの先端", icon: "tail", init: (b) => [0, 0] },
466
+ tailMid: { hint: "しっぽの途中", icon: "curve", init: (b) => [0.5, 0] },
467
+ tailWidth: { label: "しっぽの幅", type: "number", min: 0.2, max: 2.0, step: 0.01, init: (b) => 1.0 },
468
+ extract: { label: "食い込み", type: "boolean", init: (b) => false },
469
+ extractWidth: { label: "食い込み広さ", type: "number", min: 0, max: 1, step: 0.01, init: (b) => 0.2 },
470
+ shapeExpand: { label: "はみだし", type: "number", min: 0, max: 0.2, step: 0.01, init: (b) => 0 },
471
+ roughness: { label: "ラフさ", type: "number", min: 0, max: 5, step: 0.1, init: (b) => 0.1 },
472
+ // freehand: {label: "手書き風", type:"boolean", init: (b: Bubble) => false},
473
+ },
474
+ "concentration": {
475
+ lineCount: { label: "線の本数", type: "number", min: 100, max: 300, step: 1, init: (b) => 200 },
476
+ lineLength: { label: "線の長さ", type: "number", min: 1.05, max: 1.50, step: 0.01, init: (b) => 1.3 },
477
+ },
478
+ "polygon": {
479
+ link: { hint: "結合", icon: "unite" },
480
+ tailTip: { hint: "しっぽの先端", icon: "tail", init: (b) => [0, 0] },
481
+ tailMid: { hint: "しっぽの途中", icon: "curve", init: (b) => [0.5, 0] },
482
+ tailWidth: { label: "しっぽの幅", type: "number", min: 0.2, max: 2.0, step: 0.01, init: (b) => 1.0 },
483
+ randomSeed: { label: "乱数調整", type: "number", min: 0, max: 100, step: 1, init: (b) => 0 },
484
+ superEllipse: { label: "矩形っぽさ", type: "number", min: 1, max: 8, step: 0.1, init: (b) => 3 },
485
+ vertexCount: { label: "頂点の数", type: "number", min: 4, max: 20, step: 1, init: (b) => 7 },
486
+ angleJitter: { label: "角度ジッター", type: "number", min: 0, max: 1.0, step: 0.1, init: (b) => 0.4 },
487
+ extract: { label: "食い込み", type: "boolean", init: (b) => false },
488
+ extractWidth: { label: "食い込み広さ", type: "number", min: 0, max: 1, step: 0.01, init: (b) => 0.2 },
489
+ shapeExpand: { label: "はみだし", type: "number", min: 0, max: 0.2, step: 0.01, init: (b) => 0 },
490
+ roughness: { label: "ラフさ", type: "number", min: 0, max: 5, step: 0.1, init: (b) => 0 },
491
+ // freehand: {label: "手書き風", type:"boolean", init: (b: Bubble) => false},
492
+ },
493
+ "strokes": {
494
+ randomSeed: { label: "乱数調整", type: "number", min: 0, max: 100, step: 1, init: (b) => 0 },
495
+ superEllipse: { label: "矩形っぽさ", type: "number", min: 1, max: 8, step: 0.1, init: (b) => 3 },
496
+ vertexCount: { label: "頂点の数", type: "number", min: 4, max: 20, step: 1, init: (b) => 10 },
497
+ angleJitter: { label: "角度ジッター", type: "number", min: 0, max: 1.0, step: 0.1, init: (b) => 0.5 },
498
+ overRun: { label: "オーバーラン", type: "number", min: 1.01, max: 1.4, step: 0.01, init: (b) => 1.2 },
499
+ shapeExpand: { label: "はみだし", type: "number", min: 0, max: 0.2, step: 0.01, init: (b) => 0 },
500
+ },
501
+ "double-strokes": {
502
+ randomSeed: { label: "乱数調整", type: "number", min: 0, max: 100, step: 1, init: (b) => 0 },
503
+ superEllipse: { label: "矩形っぽさ", type: "number", min: 1, max: 8, step: 0.1, init: (b) => 3 },
504
+ vertexCount: { label: "頂点の数", type: "number", min: 4, max: 20, step: 1, init: (b) => 10 },
505
+ angleJitter: { label: "角度ジッター", type: "number", min: 0, max: 1.0, step: 0.1, init: (b) => 0.5 },
506
+ overRun: { label: "オーバーラン", type: "number", min: 1.01, max: 1.4, step: 0.01, init: (b) => 1.25 },
507
+ interval: { label: "間隔", type: "number", min: 0.01, max: 0.2, step: 0.01, init: (b) => 0.04 },
508
+ shapeExpand: { label: "はみだし", type: "number", min: 0, max: 0.2, step: 0.01, init: (b) => 0 },
509
+ },
510
+ "harsh": {
511
+ link: { hint: "結合", icon: "unite" },
512
+ tailTip: { hint: "しっぽの先端", icon: "tail", init: (b) => [0, 0] },
513
+ tailWidth: { label: "しっぽの幅", type: "number", min: 0.2, max: 2.0, step: 0.01, init: (b) => 1.0 },
514
+ randomSeed: { label: "乱数調整", type: "number", min: 0, max: 100, step: 1, init: (b) => 0 },
515
+ superEllipse: { label: "矩形っぽさ", type: "number", min: 1, max: 8, step: 0.1, init: (b) => 3 },
516
+ bumpDepth: { label: "でこぼこの深さ", type: "number", min: 0.01, max: 0.2, step: 0.01, init: (b) => 0.07 },
517
+ bumpCount: { label: "でこぼこの数", type: "number", min: 4, max: 20, step: 1, init: (b) => 15 },
518
+ angleJitter: { label: "角度ジッター", type: "number", min: 0, max: 1.0, step: 0.1, init: (b) => 0.1 },
519
+ shapeExpand: { label: "はみだし", type: "number", min: 0, max: 0.2, step: 0.01, init: (b) => 0 },
520
+ roughness: { label: "ラフさ", type: "number", min: 0, max: 5, step: 0.1, init: (b) => 0 },
521
+ // freehand: {label: "手書き風", type:"boolean", init: (b: Bubble) => false},
522
+ },
523
+ "shout": {
524
+ link: { hint: "結合", icon: "unite" },
525
+ tailTip: { hint: "しっぽの先端", icon: "tail", init: (b) => [0, 0] },
526
+ tailMid: { hint: "しっぽの途中", icon: "curve", init: (b) => [0.5, 0] },
527
+ tailWidth: { label: "しっぽの幅", type: "number", min: 0.2, max: 2.0, step: 0.01, init: (b) => 1.0 },
528
+ randomSeed: { label: "乱数調整", type: "number", min: 0, max: 100, step: 1, init: (b) => 6, sampleInit: (b) => 6 },
529
+ superEllipse: { label: "矩形っぽさ", type: "number", min: 1, max: 8, step: 0.1, init: (b) => 3, sampleInit: (b) => 3 },
530
+ bumpSharp: { label: "でっぱりの鋭さ", type: "number", min: 0.01, max: 0.5, step: 0.01, init: (b) => 0.16, sampleInit: (b) => 0.2 },
531
+ bumpCount: { label: "でっぱりの数", type: "number", min: 4, max: 20, step: 1, init: (b) => 10 },
532
+ angleJitter: { label: "角度ジッター", type: "number", min: 0, max: 1.0, step: 0.1, init: (b) => 0.5, sampleInit: (b) => 0.2 },
533
+ depthJitter: { label: "鋭さジッター", type: "number", min: 0, max: 1.5, step: 0.01, init: (b) => 0.5, sampleInit: (b) => 0.1 },
534
+ shapeExpand: { label: "はみだし", type: "number", min: 0, max: 0.2, step: 0.01, init: (b) => 0 },
535
+ roughness: { label: "ラフさ", type: "number", min: 0, max: 5, step: 0.1, init: (b) => 0 },
536
+ // freehand: {label: "手書き風", type:"boolean", init: (b: Bubble) => false},
537
+ },
538
+ "soft": {
539
+ link: { hint: "結合", icon: "unite" },
540
+ tailTip: { hint: "しっぽの先端", icon: "tail", init: (b) => [0, 0] },
541
+ tailMid: { hint: "しっぽの途中", icon: "curve", init: (b) => [0.5, 0] },
542
+ tailWidth: { label: "しっぽの幅", type: "number", min: 0.2, max: 2.0, step: 0.01, init: (b) => 1.0 },
543
+ randomSeed: { label: "乱数調整", type: "number", min: 0, max: 100, step: 1, init: (b) => 36 },
544
+ superEllipse: { label: "矩形っぽさ", type: "number", min: 1, max: 8, step: 0.1, init: (b) => 3 },
545
+ bumpDepth: { label: "でこぼこの深さ", type: "number", min: 0.01, max: 0.2, step: 0.01, init: (b) => 0.14 },
546
+ bumpCount: { label: "でこぼこの数", type: "number", min: 4, max: 20, step: 1, init: (b) => 5 },
547
+ angleJitter: { label: "角度ジッター", type: "number", min: 0, max: 1.0, step: 0.1, init: (b) => 0.4 },
548
+ extract: { label: "食い込み", type: "boolean", init: (b) => false },
549
+ extractWidth: { label: "食い込み広さ", type: "number", min: 0, max: 1, step: 0.01, init: (b) => 0.2 },
550
+ shapeExpand: { label: "はみだし", type: "number", min: 0, max: 0.2, step: 0.01, init: (b) => 0 },
551
+ smoothing: { label: "スムース", type: "boolean", init: (b) => true },
552
+ roughness: { label: "ラフさ", type: "number", min: 0, max: 5, step: 0.1, init: (b) => 0 },
553
+ // freehand: {label: "手書き風", type:"boolean", init: (b: Bubble) => false},
554
+ },
555
+ "heart": {
556
+ link: { hint: "結合", icon: "unite" },
557
+ shapeExpand: { label: "はみだし", type: "number", min: 0, max: 0.2, step: 0.01, init: (b) => 0 },
558
+ roughness: { label: "ラフさ", type: "number", min: 0, max: 5, step: 0.1, init: (b) => 0 },
559
+ // freehand: {label: "手書き風", type:"boolean", init: (b: Bubble) => false},
560
+ },
561
+ "diamond": {
562
+ link: { hint: "結合", icon: "unite" },
563
+ shapeExpand: { label: "はみだし", type: "number", min: 0, max: 0.2, step: 0.01, init: (b) => 0 },
564
+ roughness: { label: "ラフさ", type: "number", min: 0, max: 5, step: 0.1, init: (b) => 0 },
565
+ // freehand: {label: "手書き風", type:"boolean", init: (b: Bubble) => false},
566
+ },
567
+ "arrow": {
568
+ link: { hint: "結合", icon: "unite" },
569
+ shaftWidth: { label: "軸の太さ", type: "number", min: 0, max: 1, step: 0.01, init: (b) => 0.5 },
570
+ headLength: { label: "矢じりの長さ", type: "number", min: 0, max: 1, step: 0.01, init: (b) => 0.5 },
571
+ shapeExpand: { label: "はみだし", type: "number", min: 0, max: 0.2, step: 0.01, init: (b) => 0 },
572
+ roughness: { label: "ラフさ", type: "number", min: 0, max: 5, step: 0.1, init: (b) => 0 },
573
+ // freehand: {label: "手書き風", type:"boolean", init: (b: Bubble) => false},
574
+ },
575
+ "motion-lines": {
576
+ focalPoint: { hint: "内円の中心", icon: "circle", init: (b) => [0, 0] },
577
+ focalRange: { hint: "内円の範囲", icon: "radius", init: (b) => [0, 40] },
578
+ randomSeed: { label: "乱数調整", type: "number", min: 0, max: 100, step: 1, init: (b) => 0 },
579
+ lineCount: { label: "線の本数", type: "number", min: 100, max: 300, step: 1, init: (b) => 200 },
580
+ lineWidth: { label: "線の太さ", type: "number", min: 0.01, max: 0.1, step: 0.01, init: (b) => 0.05 },
581
+ angleJitter: { label: "角度ジッター", type: "number", min: 0, max: 0.2, step: 0.01, init: (b) => 0.05 },
582
+ startJitter: { label: "起点ジッター", type: "number", min: 0, max: 1.0, step: 0.01, init: (b) => 0.5 },
583
+ },
584
+ "speed-lines": {
585
+ tailTip: { hint: "流線の先端", icon: "tail", init: (b) => [40, 0] },
586
+ tailMid: { hint: "流線の途中", icon: "curve", init: (b) => [0.5, 0] },
587
+ randomSeed: { label: "乱数調整", type: "number", min: 0, max: 100, step: 1, init: (b) => 0 },
588
+ lineCount: { label: "線の本数", type: "number", min: 10, max: 200, step: 1, init: (b) => 70 },
589
+ lineWidth: { label: "線の太さ", type: "number", min: 0.01, max: 1.0, step: 0.01, init: (b) => 0.2 },
590
+ laneJitter: { label: "間隔ジッター", type: "number", min: 0, max: 0.2, step: 0.01, init: (b) => 0.05 },
591
+ startJitter: { label: "起点ジッター", type: "number", min: 0, max: 0.5, step: 0.01, init: (b) => 0.3 },
592
+ },
593
+ "ellipse-mind": {
594
+ link: { hint: "結合", icon: "unite" },
595
+ tailTip: { hint: "しっぽの先端", icon: "tail", init: (b) => [0, 0] },
596
+ tailMid: { hint: "しっぽの途中", icon: "curve", init: (b) => [0.5, 0] },
597
+ tailWidth: { label: "しっぽの幅", type: "number", min: 0.2, max: 2.0, step: 0.01, init: (b) => 1.0 },
598
+ shapeExpand: { label: "はみだし", type: "number", min: 0, max: 0.2, step: 0.01, init: (b) => 0 },
599
+ roughness: { label: "ラフさ", type: "number", min: 0, max: 5, step: 0.1, init: (b) => 0 },
600
+ // freehand: {label: "手書き風", type:"boolean", init: (b: Bubble) => false},
601
+ },
602
+ "soft-mind": {
603
+ link: { hint: "結合", icon: "unite" },
604
+ tailTip: { hint: "しっぽの先端", icon: "tail", init: (b) => [0, 0] },
605
+ tailMid: { hint: "しっぽの途中", icon: "curve", init: (b) => [0.5, 0] },
606
+ tailWidth: { label: "しっぽの幅", type: "number", min: 0.2, max: 2.0, step: 0.01, init: (b) => 1.0 },
607
+ randomSeed: { label: "乱数調整", type: "number", min: 0, max: 100, step: 1, init: (b) => 36 },
608
+ superEllipse: { label: "矩形っぽさ", type: "number", min: 1, max: 8, step: 0.1, init: (b) => 3 },
609
+ bumpDepth: { label: "でこぼこの深さ", type: "number", min: 0.01, max: 0.2, step: 0.01, init: (b) => 0.15 },
610
+ bumpCount: { label: "でこぼこの数", type: "number", min: 4, max: 20, step: 1, init: (b) => 5 },
611
+ angleJitter: { label: "角度ジッター", type: "number", min: 0, max: 1.0, step: 0.1, init: (b) => 0.4 },
612
+ shapeExpand: { label: "はみだし", type: "number", min: 0, max: 0.2, step: 0.01, init: (b) => 0 },
613
+ smoothing: { label: "スムース", type: "boolean", init: (b) => true },
614
+ roughness: { label: "ラフさ", type: "number", min: 0, max: 5, step: 0.1, init: (b) => 0 },
615
+ // freehand: {label: "手書き風", type:"boolean", init: (b: Bubble) => false},
616
+ },
617
+ "rounded-mind": {
618
+ link: { hint: "結合", icon: "unite" },
619
+ tailTip: { hint: "しっぽの先端", icon: "tail", init: (b) => [0, 0] },
620
+ tailMid: { hint: "しっぽの途中", icon: "curve", init: (b) => [0.5, 0] },
621
+ tailWidth: { label: "しっぽの幅", type: "number", min: 0.2, max: 2.0, step: 0.01, init: (b) => 1.0 },
622
+ xStraight: { label: "横線の長さ", type: "number", min: 0, max: 0.9, step: 0.01, init: (b) => 0.6 },
623
+ yStraight: { label: "縦線の長さ", type: "number", min: 0, max: 0.9, step: 0.01, init: (b) => 0.7 },
624
+ shapeExpand: { label: "はみだし", type: "number", min: 0, max: 0.2, step: 0.01, init: (b) => 0 },
625
+ roughness: { label: "ラフさ", type: "number", min: 0, max: 5, step: 0.1, init: (b) => 0 },
626
+ // freehand: {label: "手書き風", type:"boolean", init: (b: Bubble) => false},
627
+ },
628
+ "none": {},
629
+ };
630
+ //# sourceMappingURL=bubble.js.map