@10yun/cv-mobile-ui 0.5.51 → 0.5.52

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 (110) hide show
  1. package/build/common_func.js +3 -1
  2. package/build/parse-create.js +17 -8
  3. package/build/parse-pages-pkg.js +10 -4
  4. package/empty-devtools.js +3 -0
  5. package/libs/aes.js +50 -0
  6. package/libs/bledefine/bledefine.js +51 -0
  7. package/libs/bledefine/ios-ble-statuscode.js +97 -0
  8. package/libs/nfc/hexiii-nfc.js +236 -0
  9. package/libs/nfc.js +179 -0
  10. package/libs/sdk/html2canvas.js +8 -0
  11. package/libs/sdk/sdk-h5.js +585 -0
  12. package/{plugins → libs}/storage2.js +0 -5
  13. package/{plugins → libs}/storage3.js +0 -4
  14. package/libs/validators/index.js +438 -0
  15. package/libs/weapp-qrcode.js +1108 -0
  16. package/package.json +2 -3
  17. package/ui-cv/components/cv-dialog-share/tui-share.vue +16 -16
  18. package/ui-fireui/components/{fui-actionsheet/fui-actionsheet.vue → u-action-sheet/u-action-sheet.vue} +21 -21
  19. package/ui-fireui/components/{fui-alert/fui-alert.vue → u-alert/u-alert.vue} +13 -13
  20. package/ui-fireui/components/{fui-badge/fui-badge.vue → u-badge/u-badge.vue} +16 -16
  21. package/ui-fireui/components/{fui-bottom-navigation/fui-bottom-navigation.vue → u-bottom-navigation/u-bottom-navigation.vue} +47 -46
  22. package/ui-fireui/components/{fui-bottom-popup/fui-bottom-popup.vue → u-bottom-popup/u-bottom-popup.vue} +9 -8
  23. package/ui-fireui/components/{fui-bubble-popup/fui-bubble-popup.vue → u-bubble-popup/u-bubble-popup.vue} +19 -15
  24. package/ui-fireui/components/{fui-button/fui-button.vue → u-button/u-button.vue} +69 -69
  25. package/ui-fireui/components/u-button/u-button2.vue +553 -0
  26. package/ui-fireui/components/{fui-calendar/fui-calendar.vue → u-calendar/u-calendar.vue} +78 -78
  27. package/ui-fireui/components/u-calendar/u-calendar2.vue +801 -0
  28. package/ui-fireui/components/{fui-card/fui-card.vue → u-card/u-card.vue} +24 -24
  29. package/ui-fireui/components/{fui-cascade-selection/fui-cascade-selection.vue → u-cascade-selection/u-cascade-selection.vue} +32 -32
  30. package/ui-fireui/components/{fui-circular-progress/fui-circular-progress.vue → u-circular-progress/u-circular-progress.vue} +14 -6
  31. package/ui-fireui/components/{fui-collapse/fui-collapse.vue → u-collapse/u-collapse.vue} +19 -19
  32. package/ui-fireui/components/{fui-countdown/fui-countdown.vue → u-countdown/u-countdown.vue} +28 -28
  33. package/ui-fireui/components/{fui-datetime/fui-datetime.vue → u-datetime/u-datetime.vue} +51 -51
  34. package/ui-fireui/components/{fui-divider/fui-divider.vue → u-divider/u-divider.vue} +6 -6
  35. package/ui-fireui/components/{fui-drawer/fui-drawer.vue → u-drawer/u-drawer.vue} +11 -11
  36. package/ui-fireui/components/{fui-dropdown-list/fui-dropdown-list.vue → u-dropdown-list/u-dropdown-list.vue} +11 -6
  37. package/ui-fireui/components/{fui-fab/fui-fab.vue → u-fab/u-fab.vue} +30 -30
  38. package/ui-fireui/components/{fui-footer/fui-footer.vue → u-footer/u-footer.vue} +19 -15
  39. package/ui-fireui/components/{fui-grid/fui-grid.vue → u-grid/u-grid.vue} +13 -5
  40. package/ui-fireui/components/{fui-grid-item/fui-grid-item.vue → u-grid-item/u-grid-item.vue} +19 -19
  41. package/ui-fireui/components/{fui-icon/fui-icon.vue → u-icon/u-icon.vue} +191 -191
  42. package/ui-fireui/components/{fui-image-cropper/fui-image-cropper.vue → u-image-cropper/u-image-cropper.vue} +44 -44
  43. package/ui-fireui/components/{fui-image-group/fui-image-group.vue → u-image-group/u-image-group.vue} +7 -7
  44. package/ui-fireui/components/{fui-keyboard/fui-keyboard.vue → u-keyboard/u-keyboard.vue} +29 -32
  45. package/ui-fireui/components/{fui-keyboard-input/fui-keyboard-input.vue → u-keyboard-input/u-keyboard-input.vue} +9 -9
  46. package/ui-fireui/components/{fui-list-cell/fui-list-cell.vue → u-list-cell/u-list-cell.vue} +23 -23
  47. package/ui-fireui/components/{fui-list-view/fui-list-view.vue → u-list-view/u-list-view.vue} +11 -11
  48. package/ui-fireui/components/{fui-loading/fui-loading.vue → u-loading/u-loading.vue} +6 -6
  49. package/ui-fireui/components/{fui-loadmore/fui-loadmore.vue → u-loadmore/u-loadmore.vue} +15 -15
  50. package/ui-fireui/components/{fui-modal/fui-modal.vue → u-modal/u-modal.vue} +58 -58
  51. package/ui-fireui/components/{fui-navigation-bar/fui-navigation-bar.vue → u-navigation-bar/u-navigation-bar.vue} +11 -10
  52. package/ui-fireui/components/{fui-no-data/fui-no-data.vue → u-no-data/u-no-data.vue} +11 -11
  53. package/ui-fireui/components/{fui-nomore/fui-nomore.vue → u-nomore/u-nomore.vue} +10 -10
  54. package/ui-fireui/components/{fui-numberbox/fui-numberbox.vue → u-numberbox/u-numberbox.vue} +12 -12
  55. package/ui-fireui/components/{fui-numberbox-border/fui-numberbox-border.vue → u-numberbox-border/u-numberbox-border.vue} +10 -10
  56. package/ui-fireui/components/{fui-picture-cropper/fui-picture-cropper.vue → u-picture-cropper/u-picture-cropper.vue} +42 -42
  57. package/ui-fireui/components/u-picture-cropper/u-picture-cropper.wxs +582 -0
  58. package/ui-fireui/components/{fui-round-progress/fui-round-progress.vue → u-round-progress/u-round-progress.vue} +2 -2
  59. package/ui-fireui/components/{fui-scroll-top/fui-scroll-top.vue → u-scroll-top/u-scroll-top.vue} +21 -21
  60. package/ui-fireui/components/{fui-sharemodel/fui-sharemodel.vue → u-share-model/u-share-model.vue} +24 -24
  61. package/ui-fireui/components/{fui-skeleton/fui-skeleton.vue → u-skeleton/u-skeleton.vue} +22 -22
  62. package/ui-fireui/components/{fui-steps/fui-steps.vue → u-steps/u-steps.vue} +27 -27
  63. package/ui-fireui/components/{fui-sticky/fui-sticky.vue → u-sticky/u-sticky.vue} +4 -4
  64. package/ui-fireui/components/{fui-sticky-wxs/fui-sticky-wxs.vue → u-sticky-wxs/u-sticky-wxs.vue} +7 -7
  65. package/ui-fireui/components/u-sticky-wxs/u-sticky.wxs +46 -0
  66. package/ui-fireui/components/{fui-swipe-action/fui-swipe-action.vue → u-swipe-action/u-swipe-action.vue} +11 -11
  67. package/ui-fireui/components/{fui-tabbar/fui-tabbar.vue → u-tabbar/u-tabbar.vue} +26 -30
  68. package/ui-fireui/components/{fui-tabs/fui-tabs.vue → u-tabs/u-tabs.vue} +17 -17
  69. package/ui-fireui/components/{fui-tabs2/fui-tabs2.vue → u-tabs2/u-tabs2.vue} +17 -17
  70. package/ui-fireui/components/{fui-tag/fui-tag.vue → u-tag/u-tag.vue} +362 -374
  71. package/ui-fireui/components/{fui-time-axis/fui-time-axis.vue → u-time-axis/u-time-axis.vue} +3 -3
  72. package/ui-fireui/components/{fui-timeaxis-item/fui-timeaxis-item.vue → u-timeaxis-item/u-timeaxis-item.vue} +4 -4
  73. package/ui-fireui/components/{fui-tips/fui-tips.vue → u-tips/u-tips.vue} +20 -20
  74. package/ui-fireui/components/{fui-toast/fui-toast.vue → u-toast/u-toast.vue} +13 -13
  75. package/ui-fireui/components/{fui-top-dropdown/fui-top-dropdown.vue → u-top-dropdown/u-top-dropdown.vue} +8 -8
  76. package/ui-fireui/components/{fui-upload/fui-upload.vue → u-upload/u-upload.vue} +30 -30
  77. package/ui-fireui/components/u-upload2/u-upload.vue +464 -0
  78. package/ui-fireui/components/{fui-uploadsamll/fui-uploadsamll.vue → u-uploadsamll/u-uploadsamll.vue} +34 -34
  79. package/ui-fireui/css/thorui.css +589 -0
  80. package/ui-fireui/{fireui.css → index.css} +306 -268
  81. package/ui-fireui/nvue/u-circular-progress/gcanvas/bridge/bridge-weex.js +241 -0
  82. package/ui-fireui/nvue/u-circular-progress/gcanvas/context-2d/FillStyleLinearGradient.js +18 -0
  83. package/ui-fireui/nvue/u-circular-progress/gcanvas/context-2d/FillStylePattern.js +8 -0
  84. package/ui-fireui/nvue/u-circular-progress/gcanvas/context-2d/FillStyleRadialGradient.js +17 -0
  85. package/ui-fireui/nvue/u-circular-progress/gcanvas/context-2d/RenderingContext.js +666 -0
  86. package/ui-fireui/nvue/u-circular-progress/gcanvas/context-webgl/ActiveInfo.js +11 -0
  87. package/ui-fireui/nvue/u-circular-progress/gcanvas/context-webgl/Buffer.js +21 -0
  88. package/ui-fireui/nvue/u-circular-progress/gcanvas/context-webgl/Framebuffer.js +21 -0
  89. package/ui-fireui/nvue/u-circular-progress/gcanvas/context-webgl/GLenum.js +298 -0
  90. package/ui-fireui/nvue/u-circular-progress/gcanvas/context-webgl/GLmethod.js +142 -0
  91. package/ui-fireui/nvue/u-circular-progress/gcanvas/context-webgl/GLtype.js +23 -0
  92. package/ui-fireui/nvue/u-circular-progress/gcanvas/context-webgl/Program.js +21 -0
  93. package/ui-fireui/nvue/u-circular-progress/gcanvas/context-webgl/Renderbuffer.js +21 -0
  94. package/ui-fireui/nvue/u-circular-progress/gcanvas/context-webgl/RenderingContext.js +1191 -0
  95. package/ui-fireui/nvue/u-circular-progress/gcanvas/context-webgl/Shader.js +22 -0
  96. package/ui-fireui/nvue/u-circular-progress/gcanvas/context-webgl/ShaderPrecisionFormat.js +11 -0
  97. package/ui-fireui/nvue/u-circular-progress/gcanvas/context-webgl/Texture.js +22 -0
  98. package/ui-fireui/nvue/u-circular-progress/gcanvas/context-webgl/UniformLocation.js +22 -0
  99. package/ui-fireui/nvue/u-circular-progress/gcanvas/context-webgl/classUtils.js +3 -0
  100. package/ui-fireui/nvue/u-circular-progress/gcanvas/env/canvas.js +74 -0
  101. package/ui-fireui/nvue/u-circular-progress/gcanvas/env/image.js +96 -0
  102. package/ui-fireui/nvue/u-circular-progress/gcanvas/env/tool.js +24 -0
  103. package/ui-fireui/nvue/u-circular-progress/gcanvas/index.js +47 -0
  104. package/ui-fireui/nvue/u-circular-progress/u-circular-progress.nvue +203 -0
  105. package/ui-fireui/nvue/u-icon/icons.js +188 -0
  106. package/ui-fireui/nvue/u-icon/u-icon.vue +78 -0
  107. package/ui-fireui/components/fui-picture-cropper/fui-picture-cropper.wxs +0 -560
  108. package/ui-fireui/components/fui-rate/fui-rate.vue +0 -167
  109. package/ui-fireui/components/fui-sticky-wxs/fui-sticky.wxs +0 -44
  110. /package/ui-fireui/components/{fui-calendar/fui-calendar.js → u-calendar/u-calendar.js} +0 -0
@@ -0,0 +1,666 @@
1
+ import FillStylePattern from './FillStylePattern';
2
+ import FillStyleLinearGradient from './FillStyleLinearGradient';
3
+ import FillStyleRadialGradient from './FillStyleRadialGradient';
4
+ import GImage from '../env/image.js';
5
+ import {
6
+ ArrayBufferToBase64,
7
+ Base64ToUint8ClampedArray
8
+ } from '../env/tool.js';
9
+
10
+ export default class CanvasRenderingContext2D {
11
+
12
+ _drawCommands = '';
13
+
14
+ _globalAlpha = 1.0;
15
+
16
+ _fillStyle = 'rgb(0,0,0)';
17
+ _strokeStyle = 'rgb(0,0,0)';
18
+
19
+ _lineWidth = 1;
20
+ _lineCap = 'butt';
21
+ _lineJoin = 'miter';
22
+
23
+ _miterLimit = 10;
24
+
25
+ _globalCompositeOperation = 'source-over';
26
+
27
+ _textAlign = 'start';
28
+ _textBaseline = 'alphabetic';
29
+
30
+ _font = '10px sans-serif';
31
+
32
+ _savedGlobalAlpha = [];
33
+
34
+ timer = null;
35
+ componentId = null;
36
+
37
+ _notCommitDrawImageCache = [];
38
+ _needRedrawImageCache = [];
39
+ _redrawCommands = '';
40
+ _autoSaveContext = true;
41
+ // _imageMap = new GHashMap();
42
+ // _textureMap = new GHashMap();
43
+
44
+ constructor() {
45
+ this.className = 'CanvasRenderingContext2D';
46
+ //this.save()
47
+ }
48
+
49
+ setFillStyle(value) {
50
+ this.fillStyle = value;
51
+ }
52
+
53
+ set fillStyle(value) {
54
+ this._fillStyle = value;
55
+
56
+ if (typeof(value) == 'string') {
57
+ this._drawCommands = this._drawCommands.concat("F" + value + ";");
58
+ } else if (value instanceof FillStylePattern) {
59
+ const image = value._img;
60
+ if (!image.complete) {
61
+ image.onload = () => {
62
+ var index = this._needRedrawImageCache.indexOf(image);
63
+ if (index > -1) {
64
+ this._needRedrawImageCache.splice(index, 1);
65
+ CanvasRenderingContext2D.GBridge.bindImageTexture(this.componentId, image.src, image._id);
66
+ this._redrawflush(true);
67
+ }
68
+ }
69
+ this._notCommitDrawImageCache.push(image);
70
+ } else {
71
+ CanvasRenderingContext2D.GBridge.bindImageTexture(this.componentId, image.src, image._id);
72
+ }
73
+
74
+ //CanvasRenderingContext2D.GBridge.bindImageTexture(this.componentId, image.src, image._id);
75
+ this._drawCommands = this._drawCommands.concat("G" + image._id + "," + value._style + ";");
76
+ } else if (value instanceof FillStyleLinearGradient) {
77
+ var command = "D" + value._start_pos._x.toFixed(2) + "," + value._start_pos._y.toFixed(2) + "," +
78
+ value._end_pos._x.toFixed(2) + "," + value._end_pos._y.toFixed(2) + "," +
79
+ value._stop_count;
80
+ for (var i = 0; i < value._stop_count; ++i) {
81
+ command += ("," + value._stops[i]._pos + "," + value._stops[i]._color);
82
+ }
83
+ this._drawCommands = this._drawCommands.concat(command + ";");
84
+ } else if (value instanceof FillStyleRadialGradient) {
85
+ var command = "H" + value._start_pos._x.toFixed(2) + "," + value._start_pos._y.toFixed(2) + "," + value._start_pos._r
86
+ .toFixed(2) + "," +
87
+ value._end_pos._x.toFixed(2) + "," + value._end_pos._y.toFixed(2) + "," + value._end_pos._r.toFixed(2) + "," +
88
+ value._stop_count;
89
+ for (var i = 0; i < value._stop_count; ++i) {
90
+ command += ("," + value._stops[i]._pos + "," + value._stops[i]._color);
91
+ }
92
+ this._drawCommands = this._drawCommands.concat(command + ";");
93
+ }
94
+ }
95
+
96
+ get fillStyle() {
97
+ return this._fillStyle;
98
+ }
99
+
100
+ get globalAlpha() {
101
+ return this._globalAlpha;
102
+ }
103
+
104
+ setGlobalAlpha(value) {
105
+ this.globalAlpha = value;
106
+ }
107
+
108
+ set globalAlpha(value) {
109
+ this._globalAlpha = value;
110
+ this._drawCommands = this._drawCommands.concat("a" + value.toFixed(2) + ";");
111
+ }
112
+
113
+
114
+ get strokeStyle() {
115
+ return this._strokeStyle;
116
+ }
117
+
118
+ setStrokeStyle(value) {
119
+ this.strokeStyle = value;
120
+ }
121
+
122
+ set strokeStyle(value) {
123
+
124
+ this._strokeStyle = value;
125
+
126
+ if (typeof(value) == 'string') {
127
+ this._drawCommands = this._drawCommands.concat("S" + value + ";");
128
+ } else if (value instanceof FillStylePattern) {
129
+ CanvasRenderingContext2D.GBridge.bindImageTexture(this.componentId, image.src, image._id);
130
+ this._drawCommands = this._drawCommands.concat("G" + image._id + "," + value._style + ";");
131
+ } else if (value instanceof FillStyleLinearGradient) {
132
+ var command = "D" + value._start_pos._x.toFixed(2) + "," + value._start_pos._y.toFixed(2) + "," +
133
+ value._end_pos._x.toFixed(2) + "," + value._end_pos._y.toFixed(2) + "," +
134
+ value._stop_count;
135
+
136
+ for (var i = 0; i < value._stop_count; ++i) {
137
+ command += ("," + value._stops[i]._pos + "," + value._stops[i]._color);
138
+ }
139
+ this._drawCommands = this._drawCommands.concat(command + ";");
140
+ } else if (value instanceof FillStyleRadialGradient) {
141
+ var command = "H" + value._start_pos._x.toFixed(2) + "," + value._start_pos._y.toFixed(2) + "," + value._start_pos._r
142
+ .toFixed(2) + "," +
143
+ value._end_pos._x.toFixed(2) + "," + value._end_pos._y + ",".toFixed(2) + value._end_pos._r.toFixed(2) + "," +
144
+ value._stop_count;
145
+
146
+ for (var i = 0; i < value._stop_count; ++i) {
147
+ command += ("," + value._stops[i]._pos + "," + value._stops[i]._color);
148
+ }
149
+ this._drawCommands = this._drawCommands.concat(command + ";");
150
+ }
151
+ }
152
+
153
+ get lineWidth() {
154
+ return this._lineWidth;
155
+ }
156
+
157
+ setLineWidth(value) {
158
+ this.lineWidth = value;
159
+ }
160
+
161
+ set lineWidth(value) {
162
+ this._lineWidth = value;
163
+ this._drawCommands = this._drawCommands.concat("W" + value + ";");
164
+ }
165
+
166
+ get lineCap() {
167
+ return this._lineCap;
168
+ }
169
+
170
+ setLineCap(value) {
171
+ this.lineCap = value;
172
+ }
173
+
174
+ set lineCap(value) {
175
+ this._lineCap = value;
176
+ this._drawCommands = this._drawCommands.concat("C" + value + ";");
177
+ }
178
+
179
+ get lineJoin() {
180
+ return this._lineJoin;
181
+ }
182
+
183
+ setLineJoin(value) {
184
+ this.lineJoin = value
185
+ }
186
+
187
+ set lineJoin(value) {
188
+ this._lineJoin = value;
189
+ this._drawCommands = this._drawCommands.concat("J" + value + ";");
190
+ }
191
+
192
+ get miterLimit() {
193
+ return this._miterLimit;
194
+ }
195
+
196
+ setMiterLimit(value) {
197
+ this.miterLimit = value
198
+ }
199
+
200
+ set miterLimit(value) {
201
+ this._miterLimit = value;
202
+ this._drawCommands = this._drawCommands.concat("M" + value + ";");
203
+ }
204
+
205
+ get globalCompositeOperation() {
206
+ return this._globalCompositeOperation;
207
+ }
208
+
209
+ set globalCompositeOperation(value) {
210
+
211
+ this._globalCompositeOperation = value;
212
+ let mode = 0;
213
+ switch (value) {
214
+ case "source-over":
215
+ mode = 0;
216
+ break;
217
+ case "source-atop":
218
+ mode = 5;
219
+ break;
220
+ case "source-in":
221
+ mode = 0;
222
+ break;
223
+ case "source-out":
224
+ mode = 2;
225
+ break;
226
+ case "destination-over":
227
+ mode = 4;
228
+ break;
229
+ case "destination-atop":
230
+ mode = 4;
231
+ break;
232
+ case "destination-in":
233
+ mode = 4;
234
+ break;
235
+ case "destination-out":
236
+ mode = 3;
237
+ break;
238
+ case "lighter":
239
+ mode = 1;
240
+ break;
241
+ case "copy":
242
+ mode = 2;
243
+ break;
244
+ case "xor":
245
+ mode = 6;
246
+ break;
247
+ default:
248
+ mode = 0;
249
+ }
250
+
251
+ this._drawCommands = this._drawCommands.concat("B" + mode + ";");
252
+ }
253
+
254
+ get textAlign() {
255
+ return this._textAlign;
256
+ }
257
+
258
+ setTextAlign(value) {
259
+ this.textAlign = value
260
+ }
261
+
262
+ set textAlign(value) {
263
+
264
+ this._textAlign = value;
265
+ let Align = 0;
266
+ switch (value) {
267
+ case "start":
268
+ Align = 0;
269
+ break;
270
+ case "end":
271
+ Align = 1;
272
+ break;
273
+ case "left":
274
+ Align = 2;
275
+ break;
276
+ case "center":
277
+ Align = 3;
278
+ break;
279
+ case "right":
280
+ Align = 4;
281
+ break;
282
+ default:
283
+ Align = 0;
284
+ }
285
+
286
+ this._drawCommands = this._drawCommands.concat("A" + Align + ";");
287
+ }
288
+
289
+ get textBaseline() {
290
+ return this._textBaseline;
291
+ }
292
+
293
+ setTextBaseline(value) {
294
+ this.textBaseline = value
295
+ }
296
+
297
+ set textBaseline(value) {
298
+ this._textBaseline = value;
299
+ let baseline = 0;
300
+ switch (value) {
301
+ case "alphabetic":
302
+ baseline = 0;
303
+ break;
304
+ case "middle":
305
+ baseline = 1;
306
+ break;
307
+ case "top":
308
+ baseline = 2;
309
+ break;
310
+ case "hanging":
311
+ baseline = 3;
312
+ break;
313
+ case "bottom":
314
+ baseline = 4;
315
+ break;
316
+ case "ideographic":
317
+ baseline = 5;
318
+ break;
319
+ default:
320
+ baseline = 0;
321
+ break;
322
+ }
323
+
324
+ this._drawCommands = this._drawCommands.concat("E" + baseline + ";");
325
+ }
326
+
327
+ get font() {
328
+ return this._font;
329
+ }
330
+
331
+ setFontSize(size) {
332
+ var str = this._font;
333
+ var strs = str.trim().split(/\s+/);
334
+ for (var i = 0; i < strs.length; i++) {
335
+ var values = ["normal", "italic", "oblique", "normal", "small-caps", "normal", "bold",
336
+ "bolder", "lighter", "100", "200", "300", "400", "500", "600", "700", "800", "900",
337
+ "normal", "ultra-condensed", "extra-condensed", "condensed", "semi-condensed",
338
+ "semi-expanded", "expanded", "extra-expanded", "ultra-expanded"
339
+ ];
340
+
341
+ if (-1 == values.indexOf(strs[i].trim())) {
342
+ if (typeof size === 'string') {
343
+ strs[i] = size;
344
+ } else if (typeof size === 'number') {
345
+ strs[i] = String(size) + 'px';
346
+ }
347
+ break;
348
+ }
349
+ }
350
+ this.font = strs.join(" ");
351
+ }
352
+
353
+ set font(value) {
354
+ this._font = value;
355
+ this._drawCommands = this._drawCommands.concat("j" + value + ";");
356
+ }
357
+
358
+ setTransform(a, b, c, d, tx, ty) {
359
+ this._drawCommands = this._drawCommands.concat("t" +
360
+ (a === 1 ? "1" : a.toFixed(2)) + "," +
361
+ (b === 0 ? "0" : b.toFixed(2)) + "," +
362
+ (c === 0 ? "0" : c.toFixed(2)) + "," +
363
+ (d === 1 ? "1" : d.toFixed(2)) + "," + tx.toFixed(2) + "," + ty.toFixed(2) + ";");
364
+ }
365
+
366
+ transform(a, b, c, d, tx, ty) {
367
+ this._drawCommands = this._drawCommands.concat("f" +
368
+ (a === 1 ? "1" : a.toFixed(2)) + "," +
369
+ (b === 0 ? "0" : b.toFixed(2)) + "," +
370
+ (c === 0 ? "0" : c.toFixed(2)) + "," +
371
+ (d === 1 ? "1" : d.toFixed(2)) + "," + tx + "," + ty + ";");
372
+ }
373
+
374
+ resetTransform() {
375
+ this._drawCommands = this._drawCommands.concat("m;");
376
+ }
377
+
378
+ scale(a, d) {
379
+ this._drawCommands = this._drawCommands.concat("k" + a.toFixed(2) + "," +
380
+ d.toFixed(2) + ";");
381
+ }
382
+
383
+ rotate(angle) {
384
+ this._drawCommands = this._drawCommands
385
+ .concat("r" + angle.toFixed(6) + ";");
386
+ }
387
+
388
+ translate(tx, ty) {
389
+ this._drawCommands = this._drawCommands.concat("l" + tx.toFixed(2) + "," + ty.toFixed(2) + ";");
390
+ }
391
+
392
+ save() {
393
+ this._savedGlobalAlpha.push(this._globalAlpha);
394
+ this._drawCommands = this._drawCommands.concat("v;");
395
+ }
396
+
397
+ restore() {
398
+ this._drawCommands = this._drawCommands.concat("e;");
399
+ this._globalAlpha = this._savedGlobalAlpha.pop();
400
+ }
401
+
402
+ createPattern(img, pattern) {
403
+ if (typeof img === 'string') {
404
+ var imgObj = new GImage();
405
+ imgObj.src = img;
406
+ img = imgObj;
407
+ }
408
+ return new FillStylePattern(img, pattern);
409
+ }
410
+
411
+ createLinearGradient(x0, y0, x1, y1) {
412
+ return new FillStyleLinearGradient(x0, y0, x1, y1);
413
+ }
414
+
415
+ createRadialGradient = function(x0, y0, r0, x1, y1, r1) {
416
+ return new FillStyleRadialGradient(x0, y0, r0, x1, y1, r1);
417
+ };
418
+
419
+ createCircularGradient = function(x0, y0, r0) {
420
+ return new FillStyleRadialGradient(x0, y0, 0, x0, y0, r0);
421
+ };
422
+
423
+ strokeRect(x, y, w, h) {
424
+ this._drawCommands = this._drawCommands.concat("s" + x + "," + y + "," + w + "," + h + ";");
425
+ }
426
+
427
+
428
+ clearRect(x, y, w, h) {
429
+ this._drawCommands = this._drawCommands.concat("c" + x + "," + y + "," + w +
430
+ "," + h + ";");
431
+ }
432
+
433
+ clip() {
434
+ this._drawCommands = this._drawCommands.concat("p;");
435
+ }
436
+
437
+ resetClip() {
438
+ this._drawCommands = this._drawCommands.concat("q;");
439
+ }
440
+
441
+ closePath() {
442
+ this._drawCommands = this._drawCommands.concat("o;");
443
+ }
444
+
445
+ moveTo(x, y) {
446
+ this._drawCommands = this._drawCommands.concat("g" + x.toFixed(2) + "," + y.toFixed(2) + ";");
447
+ }
448
+
449
+ lineTo(x, y) {
450
+ this._drawCommands = this._drawCommands.concat("i" + x.toFixed(2) + "," + y.toFixed(2) + ";");
451
+ }
452
+
453
+ quadraticCurveTo = function(cpx, cpy, x, y) {
454
+ this._drawCommands = this._drawCommands.concat("u" + cpx + "," + cpy + "," + x + "," + y + ";");
455
+ }
456
+
457
+ bezierCurveTo(cp1x, cp1y, cp2x, cp2y, x, y, ) {
458
+ this._drawCommands = this._drawCommands.concat(
459
+ "z" + cp1x.toFixed(2) + "," + cp1y.toFixed(2) + "," + cp2x.toFixed(2) + "," + cp2y.toFixed(2) + "," +
460
+ x.toFixed(2) + "," + y.toFixed(2) + ";");
461
+ }
462
+
463
+ arcTo(x1, y1, x2, y2, radius) {
464
+ this._drawCommands = this._drawCommands.concat("h" + x1 + "," + y1 + "," + x2 + "," + y2 + "," + radius + ";");
465
+ }
466
+
467
+ beginPath() {
468
+ this._drawCommands = this._drawCommands.concat("b;");
469
+ }
470
+
471
+
472
+ fillRect(x, y, w, h) {
473
+ this._drawCommands = this._drawCommands.concat("n" + x + "," + y + "," + w +
474
+ "," + h + ";");
475
+ }
476
+
477
+ rect(x, y, w, h) {
478
+ this._drawCommands = this._drawCommands.concat("w" + x + "," + y + "," + w + "," + h + ";");
479
+ }
480
+
481
+ fill() {
482
+ this._drawCommands = this._drawCommands.concat("L;");
483
+ }
484
+
485
+ stroke(path) {
486
+ this._drawCommands = this._drawCommands.concat("x;");
487
+ }
488
+
489
+ arc(x, y, radius, startAngle, endAngle, anticlockwise) {
490
+
491
+ let ianticlockwise = 0;
492
+ if (anticlockwise) {
493
+ ianticlockwise = 1;
494
+ }
495
+
496
+ this._drawCommands = this._drawCommands.concat(
497
+ "y" + x.toFixed(2) + "," + y.toFixed(2) + "," +
498
+ radius.toFixed(2) + "," + startAngle + "," + endAngle + "," + ianticlockwise +
499
+ ";"
500
+ );
501
+ }
502
+
503
+ fillText(text, x, y) {
504
+ let tmptext = text.replace(/!/g, "!!");
505
+ tmptext = tmptext.replace(/,/g, "!,");
506
+ tmptext = tmptext.replace(/;/g, "!;");
507
+ this._drawCommands = this._drawCommands.concat("T" + tmptext + "," + x + "," + y + ",0.0;");
508
+ }
509
+
510
+ strokeText = function(text, x, y) {
511
+ let tmptext = text.replace(/!/g, "!!");
512
+ tmptext = tmptext.replace(/,/g, "!,");
513
+ tmptext = tmptext.replace(/;/g, "!;");
514
+ this._drawCommands = this._drawCommands.concat("U" + tmptext + "," + x + "," + y + ",0.0;");
515
+ }
516
+
517
+ measureText(text) {
518
+ return CanvasRenderingContext2D.GBridge.measureText(text, this.font, this.componentId);
519
+ }
520
+
521
+ isPointInPath = function(x, y) {
522
+ throw new Error('GCanvas not supported yet');
523
+ }
524
+
525
+ drawImage(image, sx, sy, sw, sh, dx, dy, dw, dh) {
526
+ if (typeof image === 'string') {
527
+ var imgObj = new GImage();
528
+ imgObj.src = image;
529
+ image = imgObj;
530
+ }
531
+ if (image instanceof GImage) {
532
+ if (!image.complete) {
533
+ imgObj.onload = () => {
534
+ var index = this._needRedrawImageCache.indexOf(image);
535
+ if (index > -1) {
536
+ this._needRedrawImageCache.splice(index, 1);
537
+ CanvasRenderingContext2D.GBridge.bindImageTexture(this.componentId, image.src, image._id);
538
+ this._redrawflush(true);
539
+ }
540
+ }
541
+ this._notCommitDrawImageCache.push(image);
542
+ } else {
543
+ CanvasRenderingContext2D.GBridge.bindImageTexture(this.componentId, image.src, image._id);
544
+ }
545
+ var srcArgs = [image, sx, sy, sw, sh, dx, dy, dw, dh];
546
+ var args = [];
547
+ for (var arg in srcArgs) {
548
+ if (typeof(srcArgs[arg]) != 'undefined') {
549
+ args.push(srcArgs[arg]);
550
+ }
551
+ }
552
+ this.__drawImage.apply(this, args);
553
+ //this.__drawImage(image,sx, sy, sw, sh, dx, dy, dw, dh);
554
+ }
555
+ }
556
+
557
+ __drawImage(image, sx, sy, sw, sh, dx, dy, dw, dh) {
558
+ const numArgs = arguments.length;
559
+
560
+ function drawImageCommands() {
561
+
562
+ if (numArgs === 3) {
563
+ const x = parseFloat(sx) || 0.0;
564
+ const y = parseFloat(sy) || 0.0;
565
+
566
+ return ("d" + image._id + ",0,0," +
567
+ image.width + "," + image.height + "," +
568
+ x + "," + y + "," + image.width + "," + image.height + ";");
569
+ } else if (numArgs === 5) {
570
+ const x = parseFloat(sx) || 0.0;
571
+ const y = parseFloat(sy) || 0.0;
572
+ const width = parseInt(sw) || image.width;
573
+ const height = parseInt(sh) || image.height;
574
+
575
+ return ("d" + image._id + ",0,0," +
576
+ image.width + "," + image.height + "," +
577
+ x + "," + y + "," + width + "," + height + ";");
578
+ } else if (numArgs === 9) {
579
+ sx = parseFloat(sx) || 0.0;
580
+ sy = parseFloat(sy) || 0.0;
581
+ sw = parseInt(sw) || image.width;
582
+ sh = parseInt(sh) || image.height;
583
+ dx = parseFloat(dx) || 0.0;
584
+ dy = parseFloat(dy) || 0.0;
585
+ dw = parseInt(dw) || image.width;
586
+ dh = parseInt(dh) || image.height;
587
+
588
+ return ("d" + image._id + "," +
589
+ sx + "," + sy + "," + sw + "," + sh + "," +
590
+ dx + "," + dy + "," + dw + "," + dh + ";");
591
+ }
592
+ }
593
+ this._drawCommands += drawImageCommands();
594
+ }
595
+
596
+ _flush(reserve, callback) {
597
+ const commands = this._drawCommands;
598
+ this._drawCommands = '';
599
+ CanvasRenderingContext2D.GBridge.render2d(this.componentId, commands, callback);
600
+ this._needRender = false;
601
+ }
602
+
603
+ _redrawflush(reserve, callback) {
604
+ const commands = this._redrawCommands;
605
+ CanvasRenderingContext2D.GBridge.render2d(this.componentId, commands, callback);
606
+ if (this._needRedrawImageCache.length == 0) {
607
+ this._redrawCommands = '';
608
+ }
609
+ }
610
+
611
+ draw(reserve, callback) {
612
+ if (!reserve) {
613
+ this._globalAlpha = this._savedGlobalAlpha.pop();
614
+ this._savedGlobalAlpha.push(this._globalAlpha);
615
+ this._redrawCommands = this._drawCommands;
616
+ this._needRedrawImageCache = this._notCommitDrawImageCache;
617
+ if (this._autoSaveContext) {
618
+ this._drawCommands = ("v;" + this._drawCommands);
619
+ this._autoSaveContext = false;
620
+ } else {
621
+ this._drawCommands = ("e;X;v;" + this._drawCommands);
622
+ }
623
+ } else {
624
+ this._needRedrawImageCache = this._needRedrawImageCache.concat(this._notCommitDrawImageCache);
625
+ this._redrawCommands += this._drawCommands;
626
+ if (this._autoSaveContext) {
627
+ this._drawCommands = ("v;" + this._drawCommands);
628
+ this._autoSaveContext = false;
629
+ }
630
+ }
631
+ this._notCommitDrawImageCache = [];
632
+ if (this._flush) {
633
+ this._flush(reserve, callback);
634
+ }
635
+ }
636
+
637
+ getImageData(x, y, w, h, callback) {
638
+ CanvasRenderingContext2D.GBridge.getImageData(this.componentId, x, y, w, h, function(res) {
639
+ res.data = Base64ToUint8ClampedArray(res.data);
640
+ if (typeof(callback) == 'function') {
641
+ callback(res);
642
+ }
643
+ });
644
+ }
645
+
646
+ putImageData(data, x, y, w, h, callback) {
647
+ if (data instanceof Uint8ClampedArray) {
648
+ data = ArrayBufferToBase64(data);
649
+ CanvasRenderingContext2D.GBridge.putImageData(this.componentId, data, x, y, w, h, function(res) {
650
+ if (typeof(callback) == 'function') {
651
+ callback(res);
652
+ }
653
+ });
654
+ }
655
+ }
656
+
657
+ toTempFilePath(x, y, width, height, destWidth, destHeight, fileType, quality, callback) {
658
+ CanvasRenderingContext2D.GBridge.toTempFilePath(this.componentId, x, y, width, height, destWidth, destHeight,
659
+ fileType, quality,
660
+ function(res) {
661
+ if (typeof(callback) == 'function') {
662
+ callback(res);
663
+ }
664
+ });
665
+ }
666
+ }
@@ -0,0 +1,11 @@
1
+ export default class WebGLActiveInfo {
2
+ className = 'WebGLActiveInfo';
3
+
4
+ constructor({
5
+ type, name, size
6
+ }) {
7
+ this.type = type;
8
+ this.name = name;
9
+ this.size = size;
10
+ }
11
+ }
@@ -0,0 +1,21 @@
1
+ import {getTransferedObjectUUID} from './classUtils';
2
+
3
+ const name = 'WebGLBuffer';
4
+
5
+ function uuid(id) {
6
+ return getTransferedObjectUUID(name, id);
7
+ }
8
+
9
+ export default class WebGLBuffer {
10
+ className = name;
11
+
12
+ constructor(id) {
13
+ this.id = id;
14
+ }
15
+
16
+ static uuid = uuid;
17
+
18
+ uuid() {
19
+ return uuid(this.id);
20
+ }
21
+ }
@@ -0,0 +1,21 @@
1
+ import {getTransferedObjectUUID} from './classUtils';
2
+
3
+ const name = 'WebGLFrameBuffer';
4
+
5
+ function uuid(id) {
6
+ return getTransferedObjectUUID(name, id);
7
+ }
8
+
9
+ export default class WebGLFramebuffer {
10
+ className = name;
11
+
12
+ constructor(id) {
13
+ this.id = id;
14
+ }
15
+
16
+ static uuid = uuid;
17
+
18
+ uuid() {
19
+ return uuid(this.id);
20
+ }
21
+ }