@realsee/dnalogel 2.1.0-alpha.20 → 2.1.0-alpha.22

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 (146) hide show
  1. package/components/index.js +569 -242
  2. package/dist/index.es.js +8980 -8566
  3. package/dist/index.js +8980 -8566
  4. package/docs/assets/search.js +1 -1
  5. package/docs/classes/CruisePluginController.html +1 -1
  6. package/docs/classes/Magnifier.html +1 -1
  7. package/docs/classes/ModelRoomLabelController.html +1 -1
  8. package/docs/classes/Object3DHelperController.html +1 -1
  9. package/docs/classes/PaintBrush.html +1 -1
  10. package/docs/classes/PanoTagPluginController.html +3 -3
  11. package/docs/enums/CameraMovementEffect.html +1 -1
  12. package/docs/enums/ContentType.html +1 -1
  13. package/docs/enums/DIRECTION.html +1 -1
  14. package/docs/enums/DISPLAY_STRATEGY_TYPE.html +1 -1
  15. package/docs/enums/DimensionType.html +1 -1
  16. package/docs/enums/FLOOR_PLAN_ATTACHED_TO.html +1 -1
  17. package/docs/enums/ITEM_LABEL_PLUGIN_DISPLAY_STRATEGY_TYPE.html +1 -1
  18. package/docs/enums/LinkType.html +1 -1
  19. package/docs/enums/PaintBrushTypeEnum.html +1 -1
  20. package/docs/enums/PointType.html +1 -1
  21. package/docs/enums/Rotation.html +1 -1
  22. package/docs/index.html +2 -2
  23. package/docs/interfaces/CSS3DRenderPluginEventMap.html +1 -1
  24. package/docs/interfaces/CSS3DRenderPluginState.html +1 -1
  25. package/docs/interfaces/CameraMovementPluginExportType.html +1 -1
  26. package/docs/interfaces/ContentTypeMap.html +23 -0
  27. package/docs/interfaces/FloorplanBounding.html +1 -1
  28. package/docs/interfaces/FloorplanData.html +1 -1
  29. package/docs/interfaces/FloorplanEntrance.html +1 -1
  30. package/docs/interfaces/FloorplanExtraObject.html +1 -1
  31. package/docs/interfaces/FloorplanExtraObject3D.html +1 -1
  32. package/docs/interfaces/FloorplanFloorData.html +1 -1
  33. package/docs/interfaces/FloorplanImagePosition.html +1 -1
  34. package/docs/interfaces/FloorplanObserver.html +1 -1
  35. package/docs/interfaces/FloorplanOutlineItem.html +1 -1
  36. package/docs/interfaces/FloorplanPosition.html +1 -1
  37. package/docs/interfaces/FloorplanRoomItem.html +1 -1
  38. package/docs/interfaces/FloorplanRoomLabelItem.html +1 -1
  39. package/docs/interfaces/FloorplanServerBounding.html +1 -1
  40. package/docs/interfaces/FloorplanServerComputedData.html +1 -1
  41. package/docs/interfaces/FloorplanServerData.html +1 -1
  42. package/docs/interfaces/FloorplanServerDoorItem.html +1 -1
  43. package/docs/interfaces/FloorplanServerDoorPosition.html +1 -1
  44. package/docs/interfaces/FloorplanServerEntrance.html +1 -1
  45. package/docs/interfaces/FloorplanServerFloorData.html +1 -1
  46. package/docs/interfaces/FloorplanServerImagePosition.html +1 -1
  47. package/docs/interfaces/FloorplanServerObserver.html +1 -1
  48. package/docs/interfaces/FloorplanServerOutlineItem.html +1 -1
  49. package/docs/interfaces/FloorplanServerPosition.html +1 -1
  50. package/docs/interfaces/FloorplanServerRoomItem.html +1 -1
  51. package/docs/interfaces/FloorplanServerRoomLabelItem.html +1 -1
  52. package/docs/interfaces/ItemLabelPluginData.html +1 -1
  53. package/docs/interfaces/ItemLabelPluginExportReturnsType.html +1 -1
  54. package/docs/interfaces/ItemLabelPluginParametersType.html +1 -1
  55. package/docs/interfaces/LineJson.html +1 -1
  56. package/docs/interfaces/ModelChassisCompassPluginData.html +1 -1
  57. package/docs/interfaces/ModelChassisCompassPluginExportType.html +1 -1
  58. package/docs/interfaces/ModelChassisCompassPluginParameterType.html +1 -1
  59. package/docs/interfaces/ModelEntryDoorGuidePluginData.html +1 -1
  60. package/docs/interfaces/ModelEntryDoorGuidePluginExportType.html +1 -1
  61. package/docs/interfaces/ModelItemLabelPluginData.html +1 -1
  62. package/docs/interfaces/ModelItemLabelPluginExportReturnsType.html +1 -1
  63. package/docs/interfaces/ModelItemLabelPluginParametersType.html +1 -1
  64. package/docs/interfaces/ModelRoomLabelPluginData.html +1 -1
  65. package/docs/interfaces/ModelTVVideoPluginData.html +1 -1
  66. package/docs/interfaces/ModelTVVideoPluginExportType.html +1 -1
  67. package/docs/interfaces/ModelTVVideoPluginParameterType.html +1 -1
  68. package/docs/interfaces/ModelViewPluginExportType.html +1 -1
  69. package/docs/interfaces/Object3DHelperState.html +1 -1
  70. package/docs/interfaces/OpenParameter.html +1 -1
  71. package/docs/interfaces/PaintBrushAction.html +1 -1
  72. package/docs/interfaces/PaintBrushConfigs.html +1 -1
  73. package/docs/interfaces/PaintBrushState.html +1 -1
  74. package/docs/interfaces/PanoCursorRaycasterPluginExportType.html +1 -1
  75. package/docs/interfaces/PanoCursorRaycasterPluginParameterType.html +1 -1
  76. package/docs/interfaces/PanoMeasureParameterType.html +1 -1
  77. package/docs/interfaces/PanoRulerPluginExportType.html +1 -1
  78. package/docs/interfaces/PanoRulerPluginOptions.html +1 -1
  79. package/docs/interfaces/PanoRulerPluginParameterType.html +1 -1
  80. package/docs/interfaces/PanoRulerProPluginExportType.html +1 -1
  81. package/docs/interfaces/PanoRulerProPluginOptions.html +1 -1
  82. package/docs/interfaces/PanoRulerProPluginParameterType.html +1 -1
  83. package/docs/interfaces/PanoRulerProPluginState.html +1 -1
  84. package/docs/interfaces/PanoSpatialTagPluginContentEvent.html +1 -1
  85. package/docs/interfaces/PanoSpatialTagPluginContentReplacement.html +1 -1
  86. package/docs/interfaces/PanoSpatialTagPluginData.html +1 -1
  87. package/docs/interfaces/PanoSpatialTagPluginDataElement.html +1 -1
  88. package/docs/interfaces/PanoSpatialTagPluginExportType.html +1 -1
  89. package/docs/interfaces/PanoSpatialTagPluginOriginElement.html +1 -1
  90. package/docs/interfaces/PanoSpatialTagPluginParameterType.html +1 -1
  91. package/docs/interfaces/PanoSpatialTagPluginPointElement.html +1 -1
  92. package/docs/interfaces/PanoSpatialTagPluginTagElement.html +1 -1
  93. package/docs/interfaces/Point.html +1 -1
  94. package/docs/interfaces/PointJson.html +1 -1
  95. package/docs/interfaces/Room.html +1 -1
  96. package/docs/interfaces/RoomInfo.html +1 -1
  97. package/docs/interfaces/RoomLabel.html +1 -1
  98. package/docs/interfaces/RoomRules.html +1 -1
  99. package/docs/interfaces/Rooms.html +1 -1
  100. package/docs/interfaces/Scissor.html +1 -1
  101. package/docs/interfaces/TagConfig.html +1 -1
  102. package/docs/interfaces/Tags.html +1 -1
  103. package/docs/modules.html +3 -3
  104. package/libs/CameraMovementPlugin/CameraMovementPlugin.js +5 -5
  105. package/libs/CameraMovementPlugin/index.js +1 -1
  106. package/libs/PanoCompassPlugin/Controller.js +1 -1
  107. package/libs/PanoCompassPlugin/index.js +1 -1
  108. package/libs/PanoMeasurePlugin/Controller/index.js +1 -1
  109. package/libs/PanoMeasurePlugin/Modules/rangePiece/index.js +3 -3
  110. package/libs/PanoMeasurePlugin/index.js +1 -1
  111. package/libs/PanoTagPlugin/Assets/Icon.d.ts +2 -1
  112. package/libs/PanoTagPlugin/Assets/Icon.js +3 -2
  113. package/libs/PanoTagPlugin/Components/Common/Media.js +558 -548
  114. package/libs/PanoTagPlugin/Components/Common/MediaItem.js +107 -57
  115. package/libs/PanoTagPlugin/Components/Common/MultiLineText.js +85 -79
  116. package/libs/PanoTagPlugin/Components/Common/Point/PointSwitch.js +65 -69
  117. package/libs/PanoTagPlugin/Components/PointTag.js +1 -1
  118. package/libs/PanoTagPlugin/Components/Tag/AudioTag.js +42 -42
  119. package/libs/PanoTagPlugin/Components/Tag/ImageTextTag.js +91 -93
  120. package/libs/PanoTagPlugin/Components/Tag/MarketingTag.js +54 -58
  121. package/libs/PanoTagPlugin/Components/Tag/MediaPlane.js +43 -40
  122. package/libs/PanoTagPlugin/Components/Tag/TextTag.js +56 -56
  123. package/libs/PanoTagPlugin/Components/Tag/index.js +1 -1
  124. package/libs/PanoTagPlugin/Components/TagWrapper.js +1 -1
  125. package/libs/PanoTagPlugin/controller/TagComputer.d.ts +1 -0
  126. package/libs/PanoTagPlugin/controller/TagComputer.js +1 -1
  127. package/libs/PanoTagPlugin/controller/index.js +24 -30
  128. package/libs/PanoTagPlugin/index.js +2 -2
  129. package/libs/PanoTagPlugin/tag.config.js +1 -2
  130. package/libs/PanoTagPlugin/typings/tag.d.ts +1 -1
  131. package/libs/PanoTagPlugin/utils/doUtil.d.ts +1 -0
  132. package/libs/PanoTagPlugin/utils/doUtil.js +12 -0
  133. package/libs/{TagComputer.5bd7014b.js → TagComputer.0920083a.js} +108 -90
  134. package/libs/components/PaintBrush/Controller.js +1 -1
  135. package/libs/components/PaintBrush/index.js +1 -1
  136. package/libs/components/PaintBrush/tween.js +5 -5
  137. package/libs/components/index.js +1 -1
  138. package/libs/index.js +3 -3
  139. package/libs/shared-utils/animationFrame/BetterTween.js +1 -1
  140. package/libs/shared-utils/animationFrame/tween.js +17 -17
  141. package/libs/tween.esm.bad2b2b4.js +340 -0
  142. package/package.json +4 -6
  143. package/dist/index.cjs.js +0 -556
  144. package/dist/index.umd.js +0 -556
  145. package/libs/PanoTagPlugin/utils/nullishCoalescing.d.ts +0 -2
  146. package/libs/PanoTagPlugin/utils/nullishCoalescing.js +0 -7
@@ -1,102 +1,429 @@
1
- var j = Object.defineProperty;
2
- var M = (o, n, t) => n in o ? j(o, n, { enumerable: !0, configurable: !0, writable: !0, value: t }) : o[n] = t;
3
- var g = (o, n, t) => (M(o, typeof n != "symbol" ? n + "" : n, t), t);
4
- import { Tween as W, Easing as $ } from "@tweenjs/tween.js";
5
- function U() {
1
+ var q = Object.defineProperty;
2
+ var H = (t, i, e) => i in t ? q(t, i, { enumerable: !0, configurable: !0, writable: !0, value: e }) : t[i] = e;
3
+ var g = (t, i, e) => (H(t, typeof i != "symbol" ? i + "" : i, e), e);
4
+ function N() {
6
5
  }
7
- const S = () => Promise.resolve(), k = {
6
+ const U = () => Promise.resolve(), F = {
8
7
  __queue: Promise.resolve()
9
8
  };
10
- function q(o = S) {
11
- k.__queue = k.__queue.then(o).catch(S);
9
+ function W(t = U) {
10
+ F.__queue = F.__queue.then(t).catch(U);
12
11
  }
13
- function b(o, n, t) {
14
- const e = o.x, s = o.y, i = Math.floor(e / n * 1e4) / 1e4, c = Math.floor(s / t * 1e4) / 1e4;
15
- return { x: i, y: c };
12
+ function I(t, i, e) {
13
+ const n = t.x, r = t.y, s = Math.floor(n / i * 1e4) / 1e4, o = Math.floor(r / e * 1e4) / 1e4;
14
+ return { x: s, y: o };
16
15
  }
17
- function T(o, n, t) {
18
- const { x: e, y: s } = o, i = e * n, c = s * t;
19
- return { x: i, y: c };
16
+ function R(t, i, e) {
17
+ const { x: n, y: r } = t, s = n * i, o = r * e;
18
+ return { x: s, y: o };
20
19
  }
21
- function B(o) {
22
- if (o.length < 2)
20
+ function M(t) {
21
+ if (t.length < 2)
23
22
  return {};
24
- const n = o.slice(-2), t = n[0], e = {
25
- x: (n[0].x + n[1].x) / 2,
26
- y: (n[0].y + n[1].y) / 2
23
+ const i = t.slice(-2), e = i[0], n = {
24
+ x: (i[0].x + i[1].x) / 2,
25
+ y: (i[0].y + i[1].y) / 2
27
26
  };
28
- return { control: t, end: e };
27
+ return { control: e, end: n };
29
28
  }
30
- function O(o, n, t = U) {
31
- new Promise((e) => {
29
+ function $(t, i, e = N) {
30
+ new Promise((n) => {
32
31
  setTimeout(() => {
33
- t(), e(!0);
34
- }, n * o);
32
+ e(), n(!0);
33
+ }, i * t);
35
34
  });
36
35
  }
37
- const I = window, H = window.requestAnimationFrame || I.webkitRequestAnimationFrame || ((o) => setTimeout(o, 16));
38
- function D(o, n = 0) {
39
- n <= 0 ? H(o) : H(() => D(o, n - 1));
36
+ const z = window, j = window.requestAnimationFrame || z.webkitRequestAnimationFrame || ((t) => setTimeout(t, 16));
37
+ function D(t, i = 0) {
38
+ i <= 0 ? j(t) : j(() => D(t, i - 1));
40
39
  }
41
- function A(o, n, t, e = $.Linear.None) {
42
- const s = new W(o).to(n, t).easing(e).start();
43
- function i(c) {
44
- !s.update(c) || requestAnimationFrame(i);
40
+ var m = {
41
+ Linear: {
42
+ None: function(t) {
43
+ return t;
44
+ }
45
+ },
46
+ Quadratic: {
47
+ In: function(t) {
48
+ return t * t;
49
+ },
50
+ Out: function(t) {
51
+ return t * (2 - t);
52
+ },
53
+ InOut: function(t) {
54
+ return (t *= 2) < 1 ? 0.5 * t * t : -0.5 * (--t * (t - 2) - 1);
55
+ }
56
+ },
57
+ Cubic: {
58
+ In: function(t) {
59
+ return t * t * t;
60
+ },
61
+ Out: function(t) {
62
+ return --t * t * t + 1;
63
+ },
64
+ InOut: function(t) {
65
+ return (t *= 2) < 1 ? 0.5 * t * t * t : 0.5 * ((t -= 2) * t * t + 2);
66
+ }
67
+ },
68
+ Quartic: {
69
+ In: function(t) {
70
+ return t * t * t * t;
71
+ },
72
+ Out: function(t) {
73
+ return 1 - --t * t * t * t;
74
+ },
75
+ InOut: function(t) {
76
+ return (t *= 2) < 1 ? 0.5 * t * t * t * t : -0.5 * ((t -= 2) * t * t * t - 2);
77
+ }
78
+ },
79
+ Quintic: {
80
+ In: function(t) {
81
+ return t * t * t * t * t;
82
+ },
83
+ Out: function(t) {
84
+ return --t * t * t * t * t + 1;
85
+ },
86
+ InOut: function(t) {
87
+ return (t *= 2) < 1 ? 0.5 * t * t * t * t * t : 0.5 * ((t -= 2) * t * t * t * t + 2);
88
+ }
89
+ },
90
+ Sinusoidal: {
91
+ In: function(t) {
92
+ return 1 - Math.cos(t * Math.PI / 2);
93
+ },
94
+ Out: function(t) {
95
+ return Math.sin(t * Math.PI / 2);
96
+ },
97
+ InOut: function(t) {
98
+ return 0.5 * (1 - Math.cos(Math.PI * t));
99
+ }
100
+ },
101
+ Exponential: {
102
+ In: function(t) {
103
+ return t === 0 ? 0 : Math.pow(1024, t - 1);
104
+ },
105
+ Out: function(t) {
106
+ return t === 1 ? 1 : 1 - Math.pow(2, -10 * t);
107
+ },
108
+ InOut: function(t) {
109
+ return t === 0 ? 0 : t === 1 ? 1 : (t *= 2) < 1 ? 0.5 * Math.pow(1024, t - 1) : 0.5 * (-Math.pow(2, -10 * (t - 1)) + 2);
110
+ }
111
+ },
112
+ Circular: {
113
+ In: function(t) {
114
+ return 1 - Math.sqrt(1 - t * t);
115
+ },
116
+ Out: function(t) {
117
+ return Math.sqrt(1 - --t * t);
118
+ },
119
+ InOut: function(t) {
120
+ return (t *= 2) < 1 ? -0.5 * (Math.sqrt(1 - t * t) - 1) : 0.5 * (Math.sqrt(1 - (t -= 2) * t) + 1);
121
+ }
122
+ },
123
+ Elastic: {
124
+ In: function(t) {
125
+ return t === 0 ? 0 : t === 1 ? 1 : -Math.pow(2, 10 * (t - 1)) * Math.sin((t - 1.1) * 5 * Math.PI);
126
+ },
127
+ Out: function(t) {
128
+ return t === 0 ? 0 : t === 1 ? 1 : Math.pow(2, -10 * t) * Math.sin((t - 0.1) * 5 * Math.PI) + 1;
129
+ },
130
+ InOut: function(t) {
131
+ return t === 0 ? 0 : t === 1 ? 1 : (t *= 2, t < 1 ? -0.5 * Math.pow(2, 10 * (t - 1)) * Math.sin((t - 1.1) * 5 * Math.PI) : 0.5 * Math.pow(2, -10 * (t - 1)) * Math.sin((t - 1.1) * 5 * Math.PI) + 1);
132
+ }
133
+ },
134
+ Back: {
135
+ In: function(t) {
136
+ var i = 1.70158;
137
+ return t * t * ((i + 1) * t - i);
138
+ },
139
+ Out: function(t) {
140
+ var i = 1.70158;
141
+ return --t * t * ((i + 1) * t + i) + 1;
142
+ },
143
+ InOut: function(t) {
144
+ var i = 2.5949095;
145
+ return (t *= 2) < 1 ? 0.5 * (t * t * ((i + 1) * t - i)) : 0.5 * ((t -= 2) * t * ((i + 1) * t + i) + 2);
146
+ }
147
+ },
148
+ Bounce: {
149
+ In: function(t) {
150
+ return 1 - m.Bounce.Out(1 - t);
151
+ },
152
+ Out: function(t) {
153
+ return t < 1 / 2.75 ? 7.5625 * t * t : t < 2 / 2.75 ? 7.5625 * (t -= 1.5 / 2.75) * t + 0.75 : t < 2.5 / 2.75 ? 7.5625 * (t -= 2.25 / 2.75) * t + 0.9375 : 7.5625 * (t -= 2.625 / 2.75) * t + 0.984375;
154
+ },
155
+ InOut: function(t) {
156
+ return t < 0.5 ? m.Bounce.In(t * 2) * 0.5 : m.Bounce.Out(t * 2 - 1) * 0.5 + 0.5;
157
+ }
158
+ }
159
+ }, T;
160
+ typeof self > "u" && typeof process < "u" && process.hrtime ? T = function() {
161
+ var t = process.hrtime();
162
+ return t[0] * 1e3 + t[1] / 1e6;
163
+ } : typeof self < "u" && self.performance !== void 0 && self.performance.now !== void 0 ? T = self.performance.now.bind(self.performance) : Date.now !== void 0 ? T = Date.now : T = function() {
164
+ return new Date().getTime();
165
+ };
166
+ var C = T, X = function() {
167
+ function t() {
168
+ this._tweens = {}, this._tweensAddedDuringUpdate = {};
169
+ }
170
+ return t.prototype.getAll = function() {
171
+ var i = this;
172
+ return Object.keys(this._tweens).map(function(e) {
173
+ return i._tweens[e];
174
+ });
175
+ }, t.prototype.removeAll = function() {
176
+ this._tweens = {};
177
+ }, t.prototype.add = function(i) {
178
+ this._tweens[i.getId()] = i, this._tweensAddedDuringUpdate[i.getId()] = i;
179
+ }, t.prototype.remove = function(i) {
180
+ delete this._tweens[i.getId()], delete this._tweensAddedDuringUpdate[i.getId()];
181
+ }, t.prototype.update = function(i, e) {
182
+ i === void 0 && (i = C()), e === void 0 && (e = !1);
183
+ var n = Object.keys(this._tweens);
184
+ if (n.length === 0)
185
+ return !1;
186
+ for (; n.length > 0; ) {
187
+ this._tweensAddedDuringUpdate = {};
188
+ for (var r = 0; r < n.length; r++) {
189
+ var s = this._tweens[n[r]], o = !e;
190
+ s && s.update(i, o) === !1 && !e && delete this._tweens[n[r]];
191
+ }
192
+ n = Object.keys(this._tweensAddedDuringUpdate);
193
+ }
194
+ return !0;
195
+ }, t;
196
+ }(), S = {
197
+ Linear: function(t, i) {
198
+ var e = t.length - 1, n = e * i, r = Math.floor(n), s = S.Utils.Linear;
199
+ return i < 0 ? s(t[0], t[1], n) : i > 1 ? s(t[e], t[e - 1], e - n) : s(t[r], t[r + 1 > e ? e : r + 1], n - r);
200
+ },
201
+ Bezier: function(t, i) {
202
+ for (var e = 0, n = t.length - 1, r = Math.pow, s = S.Utils.Bernstein, o = 0; o <= n; o++)
203
+ e += r(1 - i, n - o) * r(i, o) * t[o] * s(n, o);
204
+ return e;
205
+ },
206
+ CatmullRom: function(t, i) {
207
+ var e = t.length - 1, n = e * i, r = Math.floor(n), s = S.Utils.CatmullRom;
208
+ return t[0] === t[e] ? (i < 0 && (r = Math.floor(n = e * (1 + i))), s(t[(r - 1 + e) % e], t[r], t[(r + 1) % e], t[(r + 2) % e], n - r)) : i < 0 ? t[0] - (s(t[0], t[0], t[1], t[1], -n) - t[0]) : i > 1 ? t[e] - (s(t[e], t[e], t[e - 1], t[e - 1], n - e) - t[e]) : s(t[r ? r - 1 : 0], t[r], t[e < r + 1 ? e : r + 1], t[e < r + 2 ? e : r + 2], n - r);
209
+ },
210
+ Utils: {
211
+ Linear: function(t, i, e) {
212
+ return (i - t) * e + t;
213
+ },
214
+ Bernstein: function(t, i) {
215
+ var e = S.Utils.Factorial;
216
+ return e(t) / e(i) / e(t - i);
217
+ },
218
+ Factorial: function() {
219
+ var t = [1];
220
+ return function(i) {
221
+ var e = 1;
222
+ if (t[i])
223
+ return t[i];
224
+ for (var n = i; n > 1; n--)
225
+ e *= n;
226
+ return t[i] = e, e;
227
+ };
228
+ }(),
229
+ CatmullRom: function(t, i, e, n, r) {
230
+ var s = (e - t) * 0.5, o = (n - i) * 0.5, a = r * r, c = r * a;
231
+ return (2 * i - 2 * e + s + o) * c + (-3 * i + 3 * e - 2 * s - o) * a + s * r + i;
232
+ }
45
233
  }
46
- return requestAnimationFrame(i), s;
234
+ }, A = function() {
235
+ function t() {
236
+ }
237
+ return t.nextId = function() {
238
+ return t._nextId++;
239
+ }, t._nextId = 0, t;
240
+ }(), L = new X(), Y = function() {
241
+ function t(i, e) {
242
+ e === void 0 && (e = L), this._object = i, this._group = e, this._isPaused = !1, this._pauseStart = 0, this._valuesStart = {}, this._valuesEnd = {}, this._valuesStartRepeat = {}, this._duration = 1e3, this._initialRepeat = 0, this._repeat = 0, this._yoyo = !1, this._isPlaying = !1, this._reversed = !1, this._delayTime = 0, this._startTime = 0, this._easingFunction = m.Linear.None, this._interpolationFunction = S.Linear, this._chainedTweens = [], this._onStartCallbackFired = !1, this._id = A.nextId(), this._isChainStopped = !1, this._goToEnd = !1;
243
+ }
244
+ return t.prototype.getId = function() {
245
+ return this._id;
246
+ }, t.prototype.isPlaying = function() {
247
+ return this._isPlaying;
248
+ }, t.prototype.isPaused = function() {
249
+ return this._isPaused;
250
+ }, t.prototype.to = function(i, e) {
251
+ return this._valuesEnd = Object.create(i), e !== void 0 && (this._duration = e), this;
252
+ }, t.prototype.duration = function(i) {
253
+ return this._duration = i, this;
254
+ }, t.prototype.start = function(i) {
255
+ if (this._isPlaying)
256
+ return this;
257
+ if (this._group && this._group.add(this), this._repeat = this._initialRepeat, this._reversed) {
258
+ this._reversed = !1;
259
+ for (var e in this._valuesStartRepeat)
260
+ this._swapEndStartRepeatValues(e), this._valuesStart[e] = this._valuesStartRepeat[e];
261
+ }
262
+ return this._isPlaying = !0, this._isPaused = !1, this._onStartCallbackFired = !1, this._isChainStopped = !1, this._startTime = i !== void 0 ? typeof i == "string" ? C() + parseFloat(i) : i : C(), this._startTime += this._delayTime, this._setupProperties(this._object, this._valuesStart, this._valuesEnd, this._valuesStartRepeat), this;
263
+ }, t.prototype._setupProperties = function(i, e, n, r) {
264
+ for (var s in n) {
265
+ var o = i[s], a = Array.isArray(o), c = a ? "array" : typeof o, d = !a && Array.isArray(n[s]);
266
+ if (!(c === "undefined" || c === "function")) {
267
+ if (d) {
268
+ var _ = n[s];
269
+ if (_.length === 0)
270
+ continue;
271
+ _ = _.map(this._handleRelativeValue.bind(this, o)), n[s] = [o].concat(_);
272
+ }
273
+ if ((c === "object" || a) && o && !d) {
274
+ e[s] = a ? [] : {};
275
+ for (var l in o)
276
+ e[s][l] = o[l];
277
+ r[s] = a ? [] : {}, this._setupProperties(o, e[s], n[s], r[s]);
278
+ } else
279
+ typeof e[s] > "u" && (e[s] = o), a || (e[s] *= 1), d ? r[s] = n[s].slice().reverse() : r[s] = e[s] || 0;
280
+ }
281
+ }
282
+ }, t.prototype.stop = function() {
283
+ return this._isChainStopped || (this._isChainStopped = !0, this.stopChainedTweens()), this._isPlaying ? (this._group && this._group.remove(this), this._isPlaying = !1, this._isPaused = !1, this._onStopCallback && this._onStopCallback(this._object), this) : this;
284
+ }, t.prototype.end = function() {
285
+ return this._goToEnd = !0, this.update(1 / 0), this;
286
+ }, t.prototype.pause = function(i) {
287
+ return i === void 0 && (i = C()), this._isPaused || !this._isPlaying ? this : (this._isPaused = !0, this._pauseStart = i, this._group && this._group.remove(this), this);
288
+ }, t.prototype.resume = function(i) {
289
+ return i === void 0 && (i = C()), !this._isPaused || !this._isPlaying ? this : (this._isPaused = !1, this._startTime += i - this._pauseStart, this._pauseStart = 0, this._group && this._group.add(this), this);
290
+ }, t.prototype.stopChainedTweens = function() {
291
+ for (var i = 0, e = this._chainedTweens.length; i < e; i++)
292
+ this._chainedTweens[i].stop();
293
+ return this;
294
+ }, t.prototype.group = function(i) {
295
+ return this._group = i, this;
296
+ }, t.prototype.delay = function(i) {
297
+ return this._delayTime = i, this;
298
+ }, t.prototype.repeat = function(i) {
299
+ return this._initialRepeat = i, this._repeat = i, this;
300
+ }, t.prototype.repeatDelay = function(i) {
301
+ return this._repeatDelayTime = i, this;
302
+ }, t.prototype.yoyo = function(i) {
303
+ return this._yoyo = i, this;
304
+ }, t.prototype.easing = function(i) {
305
+ return this._easingFunction = i, this;
306
+ }, t.prototype.interpolation = function(i) {
307
+ return this._interpolationFunction = i, this;
308
+ }, t.prototype.chain = function() {
309
+ for (var i = [], e = 0; e < arguments.length; e++)
310
+ i[e] = arguments[e];
311
+ return this._chainedTweens = i, this;
312
+ }, t.prototype.onStart = function(i) {
313
+ return this._onStartCallback = i, this;
314
+ }, t.prototype.onUpdate = function(i) {
315
+ return this._onUpdateCallback = i, this;
316
+ }, t.prototype.onRepeat = function(i) {
317
+ return this._onRepeatCallback = i, this;
318
+ }, t.prototype.onComplete = function(i) {
319
+ return this._onCompleteCallback = i, this;
320
+ }, t.prototype.onStop = function(i) {
321
+ return this._onStopCallback = i, this;
322
+ }, t.prototype.update = function(i, e) {
323
+ if (i === void 0 && (i = C()), e === void 0 && (e = !0), this._isPaused)
324
+ return !0;
325
+ var n, r, s = this._startTime + this._duration;
326
+ if (!this._goToEnd && !this._isPlaying) {
327
+ if (i > s)
328
+ return !1;
329
+ e && this.start(i);
330
+ }
331
+ if (this._goToEnd = !1, i < this._startTime)
332
+ return !0;
333
+ this._onStartCallbackFired === !1 && (this._onStartCallback && this._onStartCallback(this._object), this._onStartCallbackFired = !0), r = (i - this._startTime) / this._duration, r = this._duration === 0 || r > 1 ? 1 : r;
334
+ var o = this._easingFunction(r);
335
+ if (this._updateProperties(this._object, this._valuesStart, this._valuesEnd, o), this._onUpdateCallback && this._onUpdateCallback(this._object, r), r === 1)
336
+ if (this._repeat > 0) {
337
+ isFinite(this._repeat) && this._repeat--;
338
+ for (n in this._valuesStartRepeat)
339
+ !this._yoyo && typeof this._valuesEnd[n] == "string" && (this._valuesStartRepeat[n] = this._valuesStartRepeat[n] + parseFloat(this._valuesEnd[n])), this._yoyo && this._swapEndStartRepeatValues(n), this._valuesStart[n] = this._valuesStartRepeat[n];
340
+ return this._yoyo && (this._reversed = !this._reversed), this._repeatDelayTime !== void 0 ? this._startTime = i + this._repeatDelayTime : this._startTime = i + this._delayTime, this._onRepeatCallback && this._onRepeatCallback(this._object), !0;
341
+ } else {
342
+ this._onCompleteCallback && this._onCompleteCallback(this._object);
343
+ for (var a = 0, c = this._chainedTweens.length; a < c; a++)
344
+ this._chainedTweens[a].start(this._startTime + this._duration);
345
+ return this._isPlaying = !1, !1;
346
+ }
347
+ return !0;
348
+ }, t.prototype._updateProperties = function(i, e, n, r) {
349
+ for (var s in n)
350
+ if (e[s] !== void 0) {
351
+ var o = e[s] || 0, a = n[s], c = Array.isArray(i[s]), d = Array.isArray(a), _ = !c && d;
352
+ _ ? i[s] = this._interpolationFunction(a, r) : typeof a == "object" && a ? this._updateProperties(i[s], o, a, r) : (a = this._handleRelativeValue(o, a), typeof a == "number" && (i[s] = o + (a - o) * r));
353
+ }
354
+ }, t.prototype._handleRelativeValue = function(i, e) {
355
+ return typeof e != "string" ? e : e.charAt(0) === "+" || e.charAt(0) === "-" ? i + parseFloat(e) : parseFloat(e);
356
+ }, t.prototype._swapEndStartRepeatValues = function(i) {
357
+ var e = this._valuesStartRepeat[i], n = this._valuesEnd[i];
358
+ typeof n == "string" ? this._valuesStartRepeat[i] = this._valuesStartRepeat[i] + parseFloat(n) : this._valuesStartRepeat[i] = this._valuesEnd[i], this._valuesEnd[i] = e;
359
+ }, t;
360
+ }();
361
+ A.nextId;
362
+ var v = L;
363
+ v.getAll.bind(v);
364
+ v.removeAll.bind(v);
365
+ v.add.bind(v);
366
+ v.remove.bind(v);
367
+ v.update.bind(v);
368
+ function Q(t, i, e, n = m.Linear.None) {
369
+ const r = new Y(t).to(i, e).easing(n).start();
370
+ function s(o) {
371
+ !r.update(o) || requestAnimationFrame(s);
372
+ }
373
+ return requestAnimationFrame(s), r;
47
374
  }
48
- var v = /* @__PURE__ */ ((o) => (o.Drawline = "Drawline", o.Undo = "Undo", o.Exit = "Exit", o))(v || {});
49
- const C = Symbol("$$PAINT_BRUSH_EVENT$$");
50
- function E(o) {
51
- return o[C] || (o[C] = {}), o[C];
375
+ var w = /* @__PURE__ */ ((t) => (t.Drawline = "Drawline", t.Undo = "Undo", t.Exit = "Exit", t))(w || {});
376
+ const E = Symbol("$$PAINT_BRUSH_EVENT$$");
377
+ function P(t) {
378
+ return t[E] || (t[E] = {}), t[E];
52
379
  }
53
- function F(o) {
54
- o[C] || delete o[C];
380
+ function G(t) {
381
+ t[E] || delete t[E];
55
382
  }
56
- class P {
57
- hasListener(n) {
58
- const t = E(this);
59
- return t && t[n] && t[n].length > 0;
383
+ class J {
384
+ hasListener(i) {
385
+ const e = P(this);
386
+ return e && e[i] && e[i].length > 0;
60
387
  }
61
- on(n, t, e) {
62
- const s = E(this);
63
- return s[n] || (s[n] = []), s[n].push([t, e || !1]), () => this.off(n, t);
388
+ on(i, e, n) {
389
+ const r = P(this);
390
+ return r[i] || (r[i] = []), r[i].push([e, n || !1]), () => this.off(i, e);
64
391
  }
65
- once(n, t) {
66
- return this.on(n, t, !0);
392
+ once(i, e) {
393
+ return this.on(i, e, !0);
67
394
  }
68
- off(n, t) {
69
- if (n === void 0) {
70
- F(this);
395
+ off(i, e) {
396
+ if (i === void 0) {
397
+ G(this);
71
398
  return;
72
399
  }
73
- const e = E(this);
74
- if (e[n] || (e[n] = []), t === void 0) {
75
- e[n].length = 0;
400
+ const n = P(this);
401
+ if (n[i] || (n[i] = []), e === void 0) {
402
+ n[i].length = 0;
76
403
  return;
77
404
  }
78
- let s = 0;
79
- for (; s < e[n].length && e[n][s][0] !== t; s++)
405
+ let r = 0;
406
+ for (; r < n[i].length && n[i][r][0] !== e; r++)
80
407
  ;
81
- s < e[n].length && e[n].splice(s, 1);
82
- }
83
- emit(n, ...t) {
84
- let e = !1;
85
- const i = E(this)[n] || [];
86
- for (let c of i.slice()) {
87
- const [r, l = !1] = c, f = r(...t);
88
- l && this.off(n, r), f === !1 && (e = !0);
408
+ r < n[i].length && n[i].splice(r, 1);
409
+ }
410
+ emit(i, ...e) {
411
+ let n = !1;
412
+ const s = P(this)[i] || [];
413
+ for (let o of s.slice()) {
414
+ const [a, c = !1] = o, d = a(...e);
415
+ c && this.off(i, a), d === !1 && (n = !0);
89
416
  }
90
- return e;
417
+ return n;
91
418
  }
92
419
  }
93
- function m() {
420
+ function y() {
94
421
  return ((1 + Math.random()) * 65536 | 0).toString(16).substring(1);
95
422
  }
96
- function R() {
97
- return (m() + m() + "-" + m() + "-4" + m().substr(0, 3) + "-" + m() + "-" + m() + m() + m()).toLowerCase();
423
+ function Z() {
424
+ return (y() + y() + "-" + y() + "-4" + y().substr(0, 3) + "-" + y() + "-" + y() + y() + y()).toLowerCase();
98
425
  }
99
- const z = `
426
+ const K = `
100
427
  <style type="text/css">
101
428
 
102
429
  #_gl_paintBrush {
@@ -197,21 +524,21 @@ transition: all 500ms;
197
524
 
198
525
  </style>
199
526
  `;
200
- class X extends P {
201
- constructor(t) {
527
+ class V extends J {
528
+ constructor(e) {
202
529
  super();
203
530
  g(this, "configs");
204
531
  g(this, "clientWidth");
205
532
  g(this, "clientHeight");
206
533
  g(this, "ready", !1);
207
- g(this, "uuid", R());
534
+ g(this, "uuid", Z());
208
535
  g(this, "tween");
209
536
  g(this, "tweening", !1);
210
537
  g(this, "container");
211
538
  g(this, "canvas");
212
539
  g(this, "data", {});
213
540
  g(this, "tempLine", {});
214
- this.configs = t, this.clientWidth = document.body.clientWidth, this.clientHeight = document.body.clientHeight, this.container = this.ifInsertToDOM(), this.canvas = {}, this.initCtrl();
541
+ this.configs = e, this.clientWidth = document.body.clientWidth, this.clientHeight = document.body.clientHeight, this.container = this.ifInsertToDOM(), this.canvas = {}, this.initCtrl();
215
542
  }
216
543
  get color() {
217
544
  return this.configs.currentColor;
@@ -230,293 +557,293 @@ class X extends P {
230
557
  else if (document.getElementById("_gl_paintBrush"))
231
558
  this.container = document.getElementById("_gl_paintBrush");
232
559
  else {
233
- const t = document.createElement("div");
234
- t.id = "_gl_paintBrush", document.body.appendChild(t), this.container = t;
560
+ const e = document.createElement("div");
561
+ e.id = "_gl_paintBrush", document.body.appendChild(e), this.container = e;
235
562
  }
236
- return this.container.innerHTML = z, this.container;
563
+ return this.container.innerHTML = K, this.container;
237
564
  }
238
- initCanvas(t) {
239
- const e = document.createElement("canvas");
240
- e.className = t, e.width = this.clientWidth, e.height = this.clientHeight;
241
- const s = e.getContext("2d");
242
- if (!!s)
243
- return s.lineWidth = 5 * this.dpr, s.lineCap = "round", s.lineJoin = "round", this.container.appendChild(e), e;
565
+ initCanvas(e) {
566
+ const n = document.createElement("canvas");
567
+ n.className = e, n.width = this.clientWidth, n.height = this.clientHeight;
568
+ const r = n.getContext("2d");
569
+ if (!!r)
570
+ return r.lineWidth = 5 * this.dpr, r.lineCap = "round", r.lineJoin = "round", this.container.appendChild(n), n;
244
571
  }
245
572
  initCtrl() {
246
- const t = document.createElement("div");
247
- t.className = "_paintBrush-ctrl";
248
573
  const e = document.createElement("div");
249
- e.className = "_paintBrush-ctrlinner";
250
- const s = document.createElement("a");
251
- s.className = "_paintBrush-ctrlitem _paintBrush-ctrlitem--undo", s.addEventListener("click", (r) => {
252
- var h;
253
- if (r.stopPropagation(), this.configs.onClickUndo && this.configs.onClickUndo(), !this.canvas[this.uuid] || !this.data[this.uuid] || this.data[this.uuid].length === 0)
574
+ e.className = "_paintBrush-ctrl";
575
+ const n = document.createElement("div");
576
+ n.className = "_paintBrush-ctrlinner";
577
+ const r = document.createElement("a");
578
+ r.className = "_paintBrush-ctrlitem _paintBrush-ctrlitem--undo", r.addEventListener("click", (a) => {
579
+ var u;
580
+ if (a.stopPropagation(), this.configs.onClickUndo && this.configs.onClickUndo(), !this.canvas[this.uuid] || !this.data[this.uuid] || this.data[this.uuid].length === 0)
254
581
  return;
255
- const l = this.data[this.uuid].pop();
256
- l && this.emitStateChange({
257
- type: v.Undo,
582
+ const c = this.data[this.uuid].pop();
583
+ c && this.emitStateChange({
584
+ type: w.Undo,
258
585
  color: this.color,
259
586
  ready: this.ready,
260
- state: l,
587
+ state: c,
261
588
  uuid: this.uuid
262
589
  });
263
- const f = (h = this.canvas[this.uuid]) == null ? void 0 : h.getContext("2d");
590
+ const d = (u = this.canvas[this.uuid]) == null ? void 0 : u.getContext("2d");
264
591
  if (!this.canvas[this.uuid])
265
592
  return;
266
- const { width: x, height: u } = this.canvas[this.uuid];
267
- f && f.clearRect(0, 0, x, u), this.data[this.uuid].forEach((a) => this.handleDrawLine(this.uuid, a, { withUndo: !0 }));
593
+ const { width: _, height: l } = this.canvas[this.uuid];
594
+ d && d.clearRect(0, 0, _, l), this.data[this.uuid].forEach((h) => this.handleDrawLine(this.uuid, h, { withUndo: !0 }));
268
595
  });
269
- const i = document.createElement("a");
270
- return i.className = "_paintBrush-ctrlitem _paintBrush-ctrlitem--close", i.addEventListener("click", (r) => {
271
- r.stopPropagation(), this.closeBrush(), this.configs.onClickClose && this.configs.onClickClose();
272
- }), [s, i].forEach((r) => {
273
- const l = document.createElement("i");
274
- l.className = "brush-icon";
275
- const f = document.createElement("span");
276
- f.className = "brush-txt", f.innerText = r.className.endsWith("undo") ? this.configs.onUndoText : this.configs.onExitText, r.appendChild(l), r.appendChild(f);
277
- }), e.appendChild(s), e.appendChild(i), t.appendChild(e), this.container.appendChild(t), t;
596
+ const s = document.createElement("a");
597
+ return s.className = "_paintBrush-ctrlitem _paintBrush-ctrlitem--close", s.addEventListener("click", (a) => {
598
+ a.stopPropagation(), this.closeBrush(), this.configs.onClickClose && this.configs.onClickClose();
599
+ }), [r, s].forEach((a) => {
600
+ const c = document.createElement("i");
601
+ c.className = "brush-icon";
602
+ const d = document.createElement("span");
603
+ d.className = "brush-txt", d.innerText = a.className.endsWith("undo") ? this.configs.onUndoText : this.configs.onExitText, a.appendChild(c), a.appendChild(d);
604
+ }), n.appendChild(r), n.appendChild(s), e.appendChild(n), this.container.appendChild(e), e;
278
605
  }
279
606
  openBrush() {
280
607
  if (this.ready)
281
608
  return;
282
609
  this.canvas[this.uuid] || (this.canvas[this.uuid] = this.initCanvas("_paintBrush-canvas")), this.container.className = "brushing";
283
- const t = this.canvas[this.uuid];
284
- t.getContext("2d").clearRect(0, 0, t.width, t.height), this.openBrushHandle(), this.ready = !0, this.emit("readyChange", !0);
610
+ const e = this.canvas[this.uuid];
611
+ e.getContext("2d").clearRect(0, 0, e.width, e.height), this.openBrushHandle(), this.ready = !0, this.emit("readyChange", !0);
285
612
  }
286
613
  closeBrush() {
287
- !this.ready || (this.container.className = "", this.data = {}, this.tempLine = {}, Object.keys(this.canvas).forEach((t) => {
288
- this.canvas[t].ontouchstart = () => !1, this.canvas[t].ontouchmove = () => !1, this.canvas[t].ontouchend = () => !1, this.canvas[t].ontouchcancel = () => !1;
289
- const e = this.canvas[t].getContext("2d");
290
- e && e.clearRect(0, 0, this.canvas[t].width, this.canvas[t].height);
614
+ !this.ready || (this.container.className = "", this.data = {}, this.tempLine = {}, Object.keys(this.canvas).forEach((e) => {
615
+ this.canvas[e].ontouchstart = () => !1, this.canvas[e].ontouchmove = () => !1, this.canvas[e].ontouchend = () => !1, this.canvas[e].ontouchcancel = () => !1;
616
+ const n = this.canvas[e].getContext("2d");
617
+ n && n.clearRect(0, 0, this.canvas[e].width, this.canvas[e].height);
291
618
  }), this.ready = !1, this.emit("readyChange", !1), this.emitStateChange({
292
- type: v.Exit,
619
+ type: w.Exit,
293
620
  color: this.color,
294
621
  ready: !1,
295
622
  uuid: this.uuid
296
623
  }));
297
624
  }
298
- updateCurrentColor(t) {
299
- const e = this.canvas[this.uuid];
300
- if (!e)
625
+ updateCurrentColor(e) {
626
+ const n = this.canvas[this.uuid];
627
+ if (!n)
301
628
  return;
302
- const s = e.getContext("2d");
303
- !s || (this.configs.currentColor = t, s.strokeStyle = t);
629
+ const r = n.getContext("2d");
630
+ !r || (this.configs.currentColor = e, r.strokeStyle = e);
304
631
  }
305
632
  openBrushHandle() {
306
- const t = this.canvas[this.uuid];
307
- if (!t)
308
- return;
309
- const e = t.getContext("2d");
633
+ const e = this.canvas[this.uuid];
310
634
  if (!e)
311
635
  return;
312
- const s = this.color || "#6D92FF";
313
- e.strokeStyle = s;
314
- let i = null, c = [], r, l = [], f = 0;
315
- const x = (u, h, a) => {
636
+ const n = e.getContext("2d");
637
+ if (!n)
638
+ return;
639
+ const r = this.color || "#6D92FF";
640
+ n.strokeStyle = r;
641
+ let s = null, o = [], a, c = [], d = 0;
642
+ const _ = (l, u, h) => {
316
643
  const p = this.color || "#ff0000";
317
- e.strokeStyle = p, e.beginPath(), e.moveTo(u.x, u.y), e.quadraticCurveTo(h.x, h.y, a.x, a.y), e.stroke();
644
+ n.strokeStyle = p, n.beginPath(), n.moveTo(l.x, l.y), n.quadraticCurveTo(u.x, u.y, h.x, h.y), n.stroke();
318
645
  };
319
- t.onmousedown = (u) => {
320
- u.preventDefault(), f = Date.now();
321
- const h = u.clientX, a = u.clientY;
322
- c = [], c.push({ x: h, y: a }), i = { x: h, y: a }, r = b({ x: h, y: a }, this.clientWidth, this.clientHeight), l = [];
323
- }, t.onmousemove = (u) => {
324
- if (u.preventDefault(), !i)
646
+ e.onmousedown = (l) => {
647
+ l.preventDefault(), d = Date.now();
648
+ const u = l.clientX, h = l.clientY;
649
+ o = [], o.push({ x: u, y: h }), s = { x: u, y: h }, a = I({ x: u, y: h }, this.clientWidth, this.clientHeight), c = [];
650
+ }, e.onmousemove = (l) => {
651
+ if (l.preventDefault(), !s)
325
652
  return;
326
- const h = Number(u.clientX), a = Number(u.clientY);
327
- if (Math.abs(h - i.x) < 5 && Math.abs(a - i.y) < 5 || (c.push({ x: h, y: a }), l.push(b({ x: h, y: a }, this.clientWidth, this.clientHeight)), c.length < 3))
653
+ const u = Number(l.clientX), h = Number(l.clientY);
654
+ if (Math.abs(u - s.x) < 5 && Math.abs(h - s.y) < 5 || (o.push({ x: u, y: h }), c.push(I({ x: u, y: h }, this.clientWidth, this.clientHeight)), o.length < 3))
328
655
  return;
329
- const { control: p, end: d } = B(c);
330
- !p || !d || (x(i, p, d), i = d);
331
- }, t.onmouseup = (u) => {
332
- if (u.preventDefault(), i = null, c.length < 3)
656
+ const { control: p, end: f } = M(o);
657
+ !p || !f || (_(s, p, f), s = f);
658
+ }, e.onmouseup = (l) => {
659
+ if (l.preventDefault(), s = null, o.length < 3)
333
660
  return;
334
661
  this.data[this.uuid] || (this.data[this.uuid] = []);
335
- const h = Date.now() - f, a = {
336
- move: Object.assign({}, r),
662
+ const u = Date.now() - d, h = {
663
+ move: Object.assign({}, a),
337
664
  uuid: this.uuid,
338
- line: [...l],
665
+ line: [...c],
339
666
  color: this.color,
340
- duration: h < 1280 ? h : h < 2e3 ? 1280 : 0
667
+ duration: u < 1280 ? u : u < 2e3 ? 1280 : 0
341
668
  };
342
- this.data[this.uuid].push(a), D(() => {
669
+ this.data[this.uuid].push(h), D(() => {
343
670
  this.emitStateChange({
344
- type: v.Drawline,
671
+ type: w.Drawline,
345
672
  color: this.color,
346
673
  ready: this.ready,
347
- state: a,
674
+ state: h,
348
675
  uuid: this.uuid
349
676
  });
350
677
  });
351
- }, t.ontouchstart = (u) => {
352
- u.preventDefault(), f = Date.now();
353
- const h = u.touches[0].clientX, a = u.touches[0].clientY;
354
- c = [], c.push({ x: h, y: a }), i = { x: h, y: a }, console.log("ontouchstart", h, a, i), r = b({ x: h, y: a }, this.clientWidth, this.clientHeight), l = [];
355
- }, t.ontouchmove = (u) => {
356
- if (u.preventDefault(), !i)
678
+ }, e.ontouchstart = (l) => {
679
+ l.preventDefault(), d = Date.now();
680
+ const u = l.touches[0].clientX, h = l.touches[0].clientY;
681
+ o = [], o.push({ x: u, y: h }), s = { x: u, y: h }, console.log("ontouchstart", u, h, s), a = I({ x: u, y: h }, this.clientWidth, this.clientHeight), c = [];
682
+ }, e.ontouchmove = (l) => {
683
+ if (l.preventDefault(), !s)
357
684
  return;
358
- const h = Number(u.touches[0].clientX), a = Number(u.touches[0].clientY);
359
- if (Math.abs(h - i.x) < 5 && Math.abs(a - i.y) < 5 || (c.push({ x: h, y: a }), l.push(b({ x: h, y: a }, this.clientWidth, this.clientHeight)), c.length < 3))
685
+ const u = Number(l.touches[0].clientX), h = Number(l.touches[0].clientY);
686
+ if (Math.abs(u - s.x) < 5 && Math.abs(h - s.y) < 5 || (o.push({ x: u, y: h }), c.push(I({ x: u, y: h }, this.clientWidth, this.clientHeight)), o.length < 3))
360
687
  return;
361
- const { control: p, end: d } = B(c);
362
- !p || !d || (x(i, p, d), i = d);
363
- }, t.ontouchend = t.ontouchcancel = (u) => {
364
- if (u.preventDefault(), i = null, c.length < 3)
688
+ const { control: p, end: f } = M(o);
689
+ !p || !f || (_(s, p, f), s = f);
690
+ }, e.ontouchend = e.ontouchcancel = (l) => {
691
+ if (l.preventDefault(), s = null, o.length < 3)
365
692
  return;
366
693
  this.data[this.uuid] || (this.data[this.uuid] = []);
367
- const h = Date.now() - f, a = {
368
- move: Object.assign({}, r),
369
- line: [...l],
694
+ const u = Date.now() - d, h = {
695
+ move: Object.assign({}, a),
696
+ line: [...c],
370
697
  uuid: this.uuid,
371
698
  color: this.color,
372
- duration: h < 1280 ? h : h < 2e3 ? 1280 : 0
699
+ duration: u < 1280 ? u : u < 2e3 ? 1280 : 0
373
700
  };
374
- this.data[this.uuid].push(a), D(() => {
701
+ this.data[this.uuid].push(h), D(() => {
375
702
  this.emitStateChange({
376
- type: v.Drawline,
703
+ type: w.Drawline,
377
704
  color: this.color,
378
705
  ready: this.ready,
379
- state: a,
706
+ state: h,
380
707
  uuid: this.uuid
381
708
  });
382
709
  });
383
710
  };
384
711
  }
385
- emitStateChange(t, e = !0) {
386
- if (t.type !== v.Drawline) {
387
- this.emit("stateChange", t, e);
712
+ emitStateChange(e, n = !0) {
713
+ if (e.type !== w.Drawline) {
714
+ this.emit("stateChange", e, n);
388
715
  return;
389
716
  }
390
- const s = Date.now(), i = t.state;
391
- if (!i || !i.line)
717
+ const r = Date.now(), s = e.state;
718
+ if (!s || !s.line)
392
719
  return;
393
- const c = Math.ceil(i.line.length / 100);
394
- for (let r = 0; r < c; r++) {
395
- const l = {
720
+ const o = Math.ceil(s.line.length / 100);
721
+ for (let a = 0; a < o; a++) {
722
+ const c = {
396
723
  uuid: this.uuid,
397
724
  color: this.color,
398
725
  ready: this.ready,
399
- type: t.type,
726
+ type: e.type,
400
727
  state: {
401
728
  uuid: this.uuid,
402
- move: i.move,
403
- duration: i.duration,
729
+ move: s.move,
730
+ duration: s.duration,
404
731
  color: this.color,
405
- line: i.line.slice(r * 100, (r + 1) * 100)
732
+ line: s.line.slice(a * 100, (a + 1) * 100)
406
733
  },
407
- timestamp: s,
408
- end: r === c - 1
734
+ timestamp: r,
735
+ end: a === o - 1
409
736
  };
410
- O(r, 20, () => {
411
- this.emit("stateChange", l, e);
737
+ $(a, 20, () => {
738
+ this.emit("stateChange", c, n);
412
739
  });
413
740
  }
414
741
  }
415
- action(t) {
416
- const { ready: e, type: s, uuid: i } = t;
417
- if (!e && this.ready) {
742
+ action(e) {
743
+ const { ready: n, type: r, uuid: s } = e;
744
+ if (!n && this.ready) {
418
745
  this.closeBrush();
419
746
  return;
420
747
  }
421
- if (e && !this.ready) {
748
+ if (n && !this.ready) {
422
749
  this.openBrush();
423
750
  return;
424
751
  }
425
752
  if (!!this.ready)
426
- switch (s) {
427
- case v.Drawline:
428
- const { state: c, timestamp: r, end: l } = t;
429
- if (!r || !c)
753
+ switch (r) {
754
+ case w.Drawline:
755
+ const { state: o, timestamp: a, end: c } = e;
756
+ if (!a || !o)
430
757
  return;
431
- this.tempLine[r] = [].concat(this.tempLine[r] || [], c.line), l && (Object.assign(c, { line: this.tempLine[r] }), this.handleDrawLine(i, c, {}, () => delete this.tempLine[r]));
758
+ this.tempLine[a] = [].concat(this.tempLine[a] || [], o.line), c && (Object.assign(o, { line: this.tempLine[a] }), this.handleDrawLine(s, o, {}, () => delete this.tempLine[a]));
432
759
  break;
433
- case v.Undo:
434
- this.handleUndo(i);
760
+ case w.Undo:
761
+ this.handleUndo(s);
435
762
  break;
436
763
  }
437
764
  }
438
- handleDrawLine(t, e, { withUndo: s = !1 }, i = U) {
439
- !e || Object.prototype.toString.call(e) != "[object Object]" || Object.keys(e).length === 0 || (console.log("handleDrawLine", e, e.line), q(() => new Promise((c) => {
440
- if (s || (this.canvas[t] || (this.canvas[t] = this.initCanvas("_paintBrush-canvas--sync")), this.data[t] || (this.data[t] = []), this.data[t].push(e)), !this.canvas[t])
765
+ handleDrawLine(e, n, { withUndo: r = !1 }, s = N) {
766
+ !n || Object.prototype.toString.call(n) != "[object Object]" || Object.keys(n).length === 0 || (console.log("handleDrawLine", n, n.line), W(() => new Promise((o) => {
767
+ if (r || (this.canvas[e] || (this.canvas[e] = this.initCanvas("_paintBrush-canvas--sync")), this.data[e] || (this.data[e] = []), this.data[e].push(n)), !this.canvas[e])
441
768
  return;
442
- const r = this.canvas[t].getContext("2d");
443
- if (!r)
769
+ const a = this.canvas[e].getContext("2d");
770
+ if (!a)
444
771
  return;
445
- const { line: l = [], color: f = "black", duration: x = 0, uuid: u } = e, h = T(e.move || {}, this.clientWidth, this.clientHeight);
446
- let a = [h];
447
- if (r.strokeStyle = f, r.beginPath(), r.moveTo(h.x, h.y), x && !s) {
772
+ const { line: c = [], color: d = "black", duration: _ = 0, uuid: l } = n, u = R(n.move || {}, this.clientWidth, this.clientHeight);
773
+ let h = [u];
774
+ if (a.strokeStyle = d, a.beginPath(), a.moveTo(u.x, u.y), _ && !r) {
448
775
  let p = [];
449
- const d = this;
450
- d.tween = A({ step: 0 }, { step: l.length - 1 }, x).onUpdate(({ step: y }) => {
451
- var L;
452
- if (d.tweening = !0, !d.ready)
453
- return r.clearRect(0, 0, d.canvas[u].width, d.canvas[u].height), (L = d.tween) == null ? void 0 : L.stop();
454
- const _ = Math.floor(y);
455
- if (!p.find((w) => w === _)) {
456
- if (p.push(_), console.log("__debug__", l, l[_], _), a.push(T(l[_], d.clientWidth, d.clientHeight)), a.length < 3)
776
+ const f = this;
777
+ f.tween = Q({ step: 0 }, { step: c.length - 1 }, _).onUpdate(({ step: b }) => {
778
+ var k;
779
+ if (f.tweening = !0, !f.ready)
780
+ return a.clearRect(0, 0, f.canvas[l].width, f.canvas[l].height), (k = f.tween) == null ? void 0 : k.stop();
781
+ const x = Math.floor(b);
782
+ if (!p.find((B) => B === x)) {
783
+ if (p.push(x), console.log("__debug__", c, c[x], x), h.push(R(c[x], f.clientWidth, f.clientHeight)), h.length < 3)
457
784
  return;
458
- const { control: w, end: N } = B(a);
459
- if (!w || !N)
785
+ const { control: B, end: O } = M(h);
786
+ if (!B || !O)
460
787
  return;
461
- r.quadraticCurveTo(w.x, w.y, N.x, N.y), r.stroke();
788
+ a.quadraticCurveTo(B.x, B.y, O.x, O.y), a.stroke();
462
789
  }
463
- }).onComplete((y) => {
464
- d.tween = void 0, d.tweening = !1, p = [], a = [], i && i(), c();
790
+ }).onComplete((b) => {
791
+ f.tween = void 0, f.tweening = !1, p = [], h = [], s && s(), o();
465
792
  });
466
793
  } else {
467
- for (let p = 0; p < l.length; p++) {
468
- if (a.push(T(l[p], this.clientWidth, this.clientHeight)), a.length < 3)
794
+ for (let p = 0; p < c.length; p++) {
795
+ if (h.push(R(c[p], this.clientWidth, this.clientHeight)), h.length < 3)
469
796
  continue;
470
- const { control: d, end: y } = B(a);
471
- !d || !y || r.quadraticCurveTo(d.x, d.y, y.x, y.y);
797
+ const { control: f, end: b } = M(h);
798
+ !f || !b || a.quadraticCurveTo(f.x, f.y, b.x, b.y);
472
799
  }
473
- r.stroke(), a = [], i && i(), c();
800
+ a.stroke(), h = [], s && s(), o();
474
801
  }
475
802
  })));
476
803
  }
477
- handleUndo(t) {
478
- if (console.log("handleUndo", t, this.canvas[t]), !this.canvas[t] || !this.data[t] || this.data[t].length === 0)
804
+ handleUndo(e) {
805
+ if (console.log("handleUndo", e, this.canvas[e]), !this.canvas[e] || !this.data[e] || this.data[e].length === 0)
479
806
  return;
480
- this.data[t].pop();
481
- const e = () => {
482
- var i;
483
- const s = (i = this.canvas[t]) == null ? void 0 : i.getContext("2d");
484
- s && s.clearRect(0, 0, this.canvas[t].width, this.canvas[t].height), this.data[t].forEach((c) => this.handleDrawLine(t, c, { withUndo: !0 }));
807
+ this.data[e].pop();
808
+ const n = () => {
809
+ var s;
810
+ const r = (s = this.canvas[e]) == null ? void 0 : s.getContext("2d");
811
+ r && r.clearRect(0, 0, this.canvas[e].width, this.canvas[e].height), this.data[e].forEach((o) => this.handleDrawLine(e, o, { withUndo: !0 }));
485
812
  };
486
813
  if (this.tween && this.tweening) {
487
- this.tween.stop(), D(e, 60);
814
+ this.tween.stop(), D(n, 60);
488
815
  return;
489
816
  }
490
- e();
817
+ n();
491
818
  }
492
819
  destroyBrush() {
493
820
  this.closeBrush(), this.ready = !1, this.emit("readyChange", !0);
494
821
  }
495
822
  }
496
- class J {
497
- constructor(n = {}) {
823
+ class et {
824
+ constructor(i = {}) {
498
825
  g(this, "controller");
499
- const t = Object.assign({
826
+ const e = Object.assign({
500
827
  currentColor: "#f44336",
501
828
  onUndoText: "\u56DE\u9000",
502
829
  onExitText: "\u5173\u95ED"
503
- }, n);
504
- this.controller = new X(t);
830
+ }, i);
831
+ this.controller = new V(e);
505
832
  }
506
- on(n, t) {
507
- this.controller.on(n, t);
833
+ on(i, e) {
834
+ this.controller.on(i, e);
508
835
  }
509
- off(n, t) {
510
- this.controller.off(n, t);
836
+ off(i, e) {
837
+ this.controller.off(i, e);
511
838
  }
512
- once(n, t) {
513
- this.controller.once(n, t);
839
+ once(i, e) {
840
+ this.controller.once(i, e);
514
841
  }
515
842
  show() {
516
843
  this.controller.openBrush();
517
844
  }
518
- action(n) {
519
- this.controller.action(n);
845
+ action(i) {
846
+ this.controller.action(i);
520
847
  }
521
848
  get state() {
522
849
  return this.controller.state;
@@ -527,11 +854,11 @@ class J {
527
854
  dispose() {
528
855
  return this.controller.destroyBrush();
529
856
  }
530
- setCurrentColor(n) {
531
- this.controller.updateCurrentColor(n);
857
+ setCurrentColor(i) {
858
+ this.controller.updateCurrentColor(i);
532
859
  }
533
860
  }
534
861
  export {
535
- J as PaintBrush,
536
- v as PaintBrushTypeEnum
862
+ et as PaintBrush,
863
+ w as PaintBrushTypeEnum
537
864
  };