libey-ng-component-library 0.0.32 → 0.0.34

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 (69) hide show
  1. package/karma.conf.js +44 -0
  2. package/ng-package.json +13 -0
  3. package/package.json +17 -24
  4. package/src/lib/cpm-indicator/libey-ng-cpm-indicator.component.css +216 -0
  5. package/src/lib/cpm-indicator/libey-ng-cpm-indicator.component.html +201 -0
  6. package/src/lib/cpm-indicator/libey-ng-cpm-indicator.component.spec.ts +25 -0
  7. package/src/lib/cpm-indicator/libey-ng-cpm-indicator.component.ts +203 -0
  8. package/src/lib/cpm-indicator/libey-ng-cpm-indicator.module.ts +19 -0
  9. package/src/lib/icons/icons.component.css +9 -0
  10. package/src/lib/icons/icons.module.ts +16 -0
  11. package/src/lib/icons/libey-ng-icons/libey-ng-icons.component.html +1831 -0
  12. package/src/lib/icons/libey-ng-icons/libey-ng-icons.component.ts +36 -0
  13. package/src/lib/libey-ng-component-library.component.spec.ts +25 -0
  14. package/src/lib/libey-ng-component-library.component.ts +20 -0
  15. package/src/lib/libey-ng-component-library.module.ts +32 -0
  16. package/src/lib/libey-ng-component-library.service.spec.ts +16 -0
  17. package/src/lib/libey-ng-component-library.service.ts +9 -0
  18. package/src/lib/signature/libey-ng-signature/libey-ng-signature.component.css +7 -0
  19. package/src/lib/signature/libey-ng-signature/libey-ng-signature.component.html +41 -0
  20. package/src/lib/signature/libey-ng-signature/libey-ng-signature.component.spec.ts +25 -0
  21. package/src/lib/signature/libey-ng-signature/libey-ng-signature.component.ts +214 -0
  22. package/src/lib/signature/libey-ng-signature.module.ts +30 -0
  23. package/src/lib/table/directives/libey-column.directive.ts +29 -0
  24. package/src/lib/table/libey-ng-table.component.css +249 -0
  25. package/src/lib/table/libey-ng-table.component.html +122 -0
  26. package/src/lib/table/libey-ng-table.component.ts +234 -0
  27. package/src/lib/table/libey-ng-table.module.ts +13 -0
  28. package/{public-api.d.ts → src/public-api.ts} +4 -0
  29. package/src/test.ts +28 -0
  30. package/src/utils/CpmIndicator/cpm-indicator-types.ts +63 -0
  31. package/src/utils/SigWeb/SigWeb.ts +1906 -0
  32. package/tsconfig.lib.json +20 -0
  33. package/tsconfig.lib.prod.json +10 -0
  34. package/tsconfig.spec.json +17 -0
  35. package/bundles/libey-ng-component-library.umd.js +0 -2497
  36. package/bundles/libey-ng-component-library.umd.js.map +0 -1
  37. package/esm2015/lib/cpm-indicator/libey-ng-cpm-indicator.component.js +0 -193
  38. package/esm2015/lib/cpm-indicator/libey-ng-cpm-indicator.module.js +0 -26
  39. package/esm2015/lib/icons/icons.module.js +0 -26
  40. package/esm2015/lib/icons/libey-ng-icons/libey-ng-icons.component.js +0 -52
  41. package/esm2015/lib/libey-ng-component-library.component.js +0 -26
  42. package/esm2015/lib/libey-ng-component-library.module.js +0 -60
  43. package/esm2015/lib/libey-ng-component-library.service.js +0 -14
  44. package/esm2015/lib/signature/libey-ng-signature/libey-ng-signature.component.js +0 -197
  45. package/esm2015/lib/signature/libey-ng-signature.module.js +0 -57
  46. package/esm2015/lib/table/directives/libey-column.directive.js +0 -56
  47. package/esm2015/lib/table/libey-ng-table.component.js +0 -229
  48. package/esm2015/lib/table/libey-ng-table.module.js +0 -21
  49. package/esm2015/libey-ng-component-library.js +0 -5
  50. package/esm2015/public-api.js +0 -23
  51. package/esm2015/utils/CpmIndicator/cpm-indicator-types.js +0 -25
  52. package/esm2015/utils/SigWeb/SigWeb.js +0 -1442
  53. package/fesm2015/libey-ng-component-library.js +0 -2393
  54. package/fesm2015/libey-ng-component-library.js.map +0 -1
  55. package/lib/cpm-indicator/libey-ng-cpm-indicator.component.d.ts +0 -66
  56. package/lib/cpm-indicator/libey-ng-cpm-indicator.module.d.ts +0 -8
  57. package/lib/icons/icons.module.d.ts +0 -8
  58. package/lib/icons/libey-ng-icons/libey-ng-icons.component.d.ts +0 -19
  59. package/lib/libey-ng-component-library.component.d.ts +0 -8
  60. package/lib/libey-ng-component-library.module.d.ts +0 -13
  61. package/lib/libey-ng-component-library.service.d.ts +0 -6
  62. package/lib/signature/libey-ng-signature/libey-ng-signature.component.d.ts +0 -40
  63. package/lib/signature/libey-ng-signature.module.d.ts +0 -13
  64. package/lib/table/directives/libey-column.directive.d.ts +0 -23
  65. package/lib/table/libey-ng-table.component.d.ts +0 -63
  66. package/lib/table/libey-ng-table.module.d.ts +0 -10
  67. package/libey-ng-component-library.d.ts +0 -5
  68. package/utils/CpmIndicator/cpm-indicator-types.d.ts +0 -40
  69. package/utils/SigWeb/SigWeb.d.ts +0 -219
@@ -0,0 +1,1906 @@
1
+ // SigWebTablet.ts
2
+ export class SigWebTablet {
3
+ private static revokeBlobURL(url: string): void {
4
+ if (window.URL) {
5
+ URL.revokeObjectURL(url);
6
+ } else if (window.webkitURL) {
7
+ webkitURL.revokeObjectURL(url);
8
+ }
9
+ }
10
+ private static getBlobURL(blob: Blob): string {
11
+ if (window.URL) {
12
+ return URL.createObjectURL(blob);
13
+ } else if (window.webkitURL) {
14
+ return webkitURL.createObjectURL(blob);
15
+ }
16
+ return ''; // Retornar un string vacío en caso de error
17
+ }
18
+
19
+ private static baseUri: string = SigWebTablet.makeUri();
20
+ private static ctx;
21
+ private static Count: boolean = false;
22
+ private static EvStatus;
23
+ private static onSigPenDown;
24
+ private static onSigPenUp;
25
+ private static SigWebFontThreshold = 155;
26
+ private static NumPointsLastTime = 0;
27
+ private static SigImageB64;
28
+
29
+ private static makeUri(): string {
30
+ var prot = location.protocol;
31
+ if (prot == 'file:') {
32
+ prot = 'http:';
33
+ }
34
+
35
+ if (this.isIE()) {
36
+ if (prot == 'https:') {
37
+ return prot + '//tablet.sigwebtablet.com:47290/SigWeb/';
38
+ } else {
39
+ return prot + '//tablet.sigwebtablet.com:47289/SigWeb/';
40
+ }
41
+ }
42
+
43
+ if (this.isChrome()) {
44
+ if (prot == 'https:') {
45
+ return prot + '//tablet.sigwebtablet.com:47290/SigWeb/';
46
+ } else {
47
+ return prot + '//tablet.sigwebtablet.com:47289/SigWeb/';
48
+ }
49
+ } else {
50
+ //FIREFOX
51
+ if (prot == 'https:') {
52
+ return prot + '//tablet.sigwebtablet.com:47290/SigWeb/';
53
+ } else {
54
+ return prot + '//tablet.sigwebtablet.com:47289/SigWeb/';
55
+ }
56
+ }
57
+ }
58
+
59
+ private static generateUUID(): string {
60
+ return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(
61
+ /[xy]/g,
62
+ function (c) {
63
+ const r = (Math.random() * 16) | 0;
64
+ const v = c === 'x' ? r : (r & 0x3) | 0x8;
65
+ return v.toString(16);
66
+ }
67
+ );
68
+ }
69
+
70
+ static isSigWebInstalled(): boolean {
71
+ const xhr = new XMLHttpRequest();
72
+ try {
73
+ xhr.open(
74
+ 'GET',
75
+ `${this.baseUri}TabletState?noCache=${this.generateUUID()}`,
76
+ false
77
+ );
78
+ xhr.send();
79
+ return xhr.status !== 404 && xhr.status !== 0;
80
+ } catch (e) {
81
+ console.log('Error checking SigWeb installation', e);
82
+ return false;
83
+ }
84
+ }
85
+
86
+ static isIE(): boolean {
87
+ return (
88
+ navigator.appName === 'Microsoft Internet Explorer' ||
89
+ (navigator.appName === 'Netscape' &&
90
+ new RegExp('Trident/.*rv:([0-9]{1,}[.0-9]{0,})').exec(
91
+ navigator.userAgent
92
+ ) != null)
93
+ );
94
+ }
95
+
96
+ static isChrome(): boolean {
97
+ return navigator.userAgent.lastIndexOf('Chrome/') > 0;
98
+ }
99
+
100
+ static SigWebcreateXHR(): XMLHttpRequest | null {
101
+ const xhr = new XMLHttpRequest();
102
+ if (!xhr) {
103
+ throw new Error('No se pudo crear XMLHttpRequest');
104
+ }
105
+
106
+ return xhr;
107
+ }
108
+
109
+ static SigWebSetProperty(prop: string): string {
110
+ const xhr: XMLHttpRequest | null = this.SigWebcreateXHR();
111
+
112
+ if (xhr) {
113
+ xhr.open('POST', this.baseUri + prop, true);
114
+ xhr.send(null);
115
+ if (xhr.readyState === 4 && xhr.status === 200) {
116
+ return xhr.responseText;
117
+ }
118
+ }
119
+ return '';
120
+ }
121
+
122
+ static SigWebSetPropertySync(prop: string): string {
123
+ const xhr: XMLHttpRequest | null = this.SigWebcreateXHR();
124
+
125
+ if (xhr) {
126
+ xhr.open('POST', this.baseUri + prop, false);
127
+ xhr.send();
128
+ if (xhr.readyState === 4 && xhr.status === 200) {
129
+ return xhr.responseText;
130
+ }
131
+ }
132
+ return '';
133
+ }
134
+
135
+ static SigWebSetStreamProperty(prop: string, strm: any): string {
136
+ const xhr: XMLHttpRequest | null = this.SigWebcreateXHR();
137
+
138
+ if (xhr) {
139
+ xhr.open('POST', this.baseUri + prop);
140
+ xhr.setRequestHeader('Content-Type', 'text/plain');
141
+ xhr.send(strm);
142
+ }
143
+ return '';
144
+ }
145
+
146
+ static SigWebSyncSetStreamProperty(prop: string, strm: any): string {
147
+ const xhr: XMLHttpRequest | null = this.SigWebcreateXHR();
148
+
149
+ if (xhr) {
150
+ xhr.open('POST', this.baseUri + prop, false);
151
+ xhr.setRequestHeader('Content-Type', 'text/plain');
152
+ xhr.send(strm);
153
+ if (xhr.readyState === 4 && xhr.status === 200) {
154
+ return xhr.responseText;
155
+ }
156
+ }
157
+ return '';
158
+ }
159
+
160
+ static SigWebSetImageStreamProperty(prop: string, strm: any): string {
161
+ const xhr: XMLHttpRequest | null = this.SigWebcreateXHR();
162
+
163
+ if (xhr) {
164
+ xhr.open('POST', this.baseUri + prop, false);
165
+ xhr.setRequestHeader('Content-Type', 'image/png');
166
+ xhr.send(strm);
167
+ if (xhr.readyState === 4 && xhr.status === 200) {
168
+ return xhr.responseText;
169
+ }
170
+ }
171
+ return '';
172
+ }
173
+
174
+ static SigWebSetImageBlobProperty(prop, strm) {
175
+ var xhr = this.SigWebcreateXHR();
176
+ if (xhr) {
177
+ xhr.open('POST', this.baseUri + prop, false);
178
+ xhr.setRequestHeader('Content-Type', 'blob');
179
+ xhr.send(strm);
180
+ if (xhr.readyState == 4 && xhr.status == 200) {
181
+ return xhr.responseText;
182
+ }
183
+ }
184
+ return '';
185
+ }
186
+
187
+ static SigWebGetVersion(prop) {
188
+ try {
189
+ var xhr = this.SigWebcreateXHR();
190
+ if (xhr) {
191
+ xhr.open(
192
+ 'GET',
193
+ this.baseUri + prop + '?noCache=' + this.generateUUID(),
194
+ false
195
+ );
196
+ xhr.send(null);
197
+ if (xhr.readyState == 4 && xhr.status == 200) {
198
+ return xhr.responseText;
199
+ }
200
+ }
201
+ } catch (error) {
202
+ console.error('Error en SigWebGetVersion:', error);
203
+ return null;
204
+ }
205
+ return null;
206
+ }
207
+
208
+ static SigWebGetProperty(prop) {
209
+ var xhr = this.SigWebcreateXHR();
210
+
211
+ if (xhr) {
212
+ xhr.open(
213
+ 'GET',
214
+ this.baseUri + prop + '?noCache=' + this.generateUUID(),
215
+ false
216
+ );
217
+ xhr.send(null);
218
+ if (xhr.readyState == 4 && xhr.status == 200) {
219
+ return xhr.responseText;
220
+ }
221
+ }
222
+ return '';
223
+ }
224
+
225
+ static GetSigImageB64(callback) {
226
+ var cvs = document.createElement('canvas');
227
+ var width = this.GetImageXSize();
228
+ var height = this.GetImageYSize();
229
+ cvs.width = width == '' || width == null ? 0 : Number(width);
230
+ cvs.height = height == '' || height == null ? 0 : Number(height);
231
+
232
+ var xhr2 = new XMLHttpRequest();
233
+ xhr2.open(
234
+ 'GET',
235
+ this.baseUri + 'SigImage/1' + '?noCache=' + this.generateUUID(),
236
+ true
237
+ );
238
+ xhr2.responseType = 'blob';
239
+ xhr2.send(null);
240
+ xhr2.onload = () => {
241
+ var cntx = cvs.getContext('2d');
242
+ var img = new Image();
243
+ img.src = this.getBlobURL(xhr2.response);
244
+ img.onload = () => {
245
+ cntx.drawImage(img, 0, 0);
246
+ var b64String = cvs.toDataURL('image/png');
247
+ var loc = b64String.search('base64,');
248
+ var retstring = b64String.slice(loc + 7, b64String.length);
249
+ if (callback) {
250
+ callback(retstring);
251
+ }
252
+ };
253
+ };
254
+ }
255
+
256
+ static SigWebWaitForPenDown(callback) {
257
+ var xhr = this.SigWebcreateXHR();
258
+
259
+ if (xhr) {
260
+ xhr.open(
261
+ 'GET',
262
+ this.baseUri + 'WaitForPenDown' + '?noCache=' + this.generateUUID()
263
+ );
264
+ xhr.timeout = 10000;
265
+ xhr.onreadystatechange = () => {
266
+ if (xhr.readyState != 4) return;
267
+ if (xhr.status == 200) callback();
268
+ };
269
+ xhr.send(null);
270
+ }
271
+ }
272
+
273
+ static GetSigImage(ctx) {
274
+ var xhr2 = new XMLHttpRequest();
275
+ xhr2.open(
276
+ 'GET',
277
+ this.baseUri + 'SigImage/1' + '?noCache=' + this.generateUUID(),
278
+ true
279
+ );
280
+ xhr2.responseType = 'blob';
281
+ xhr2.send(null);
282
+ xhr2.onload = () => {
283
+ var img = new Image();
284
+ img.src = this.getBlobURL(xhr2.response);
285
+ img.onload = () => {
286
+ ctx.drawImage(img, 0, 0);
287
+ this.revokeBlobURL(img.src);
288
+ img = null;
289
+ };
290
+ };
291
+ }
292
+
293
+ static SigWebSetDisplayTarget(obj) {
294
+ this.ctx = obj;
295
+ }
296
+
297
+ static SigWebRefresh() {
298
+ var NumPoints = Number(this.NumberOfTabletPoints());
299
+ if (NumPoints == this.NumPointsLastTime) {
300
+ return;
301
+ }
302
+ this.NumPointsLastTime = NumPoints;
303
+
304
+ var xhr2 = new XMLHttpRequest();
305
+ xhr2.open(
306
+ 'GET',
307
+ this.baseUri + 'SigImage/0' + '?noCache=' + this.generateUUID(),
308
+ true
309
+ );
310
+ xhr2.responseType = 'blob';
311
+ xhr2.onload = () => {
312
+ var img = new Image();
313
+ img.src = this.getBlobURL(xhr2.response);
314
+ // img.src = window.URL.createObjectURL(xhr2.response);
315
+ img.onload = () => {
316
+ this.ctx.drawImage(img, 0, 0);
317
+ this.revokeBlobURL(img.src);
318
+ img = null;
319
+ };
320
+ };
321
+ xhr2.send(null);
322
+ }
323
+
324
+ static SigWebEvent() {
325
+ var OldEvStatus = this.EvStatus;
326
+
327
+ var xhr = this.SigWebcreateXHR();
328
+
329
+ if (xhr) {
330
+ xhr.open(
331
+ 'GET',
332
+ this.baseUri + 'EventStatus' + '?noCache=' + this.generateUUID(),
333
+ true
334
+ );
335
+ xhr.onload = () => {
336
+ this.EvStatus = xhr.responseText;
337
+ if (OldEvStatus & 0x01 && this.EvStatus & 0x02) {
338
+ if (this.onSigPenDown) {
339
+ this.onSigPenDown();
340
+ }
341
+ }
342
+
343
+ if (OldEvStatus & 0x02 && this.EvStatus & 0x01) {
344
+ if (this.onSigPenUp) {
345
+ this.onSigPenUp();
346
+ }
347
+ }
348
+ };
349
+ xhr.send(null);
350
+ }
351
+ }
352
+
353
+ static setSigWebFontThreshold(v) {
354
+ this.SigWebFontThreshold = v;
355
+ }
356
+
357
+ static createLcdBitmapFromCanvas(ourCanvas, xp, yp, width, height) {
358
+ var canvasCtx = ourCanvas.getContext('2d');
359
+ var imgData = canvasCtx.getImageData(0, 0, width, height);
360
+ var j = 0;
361
+ var sVal = 0;
362
+ var outData = '';
363
+ var outIdx = 0;
364
+ var data = imgData.data;
365
+
366
+ for (var y = 0; y < height; y++)
367
+ for (var x = 0; x < width; x++) {
368
+ var tmp1 = data[j];
369
+ var tmp2 = data[j + 1];
370
+ var tmp3 = data[j + 2];
371
+ var tmp4 = data[j + 3];
372
+
373
+ // sVal = tmp1 + (tmp2 << 8 ) + ( tmp3 << 16 ) + (tmp4 << 24 );
374
+ j = j + 4;
375
+ if (tmp1 < this.SigWebFontThreshold) {
376
+ outData += 'B';
377
+ } else {
378
+ outData += 'W';
379
+ }
380
+ }
381
+
382
+ return outData;
383
+ }
384
+
385
+ static toHex(NibVal) {
386
+ switch (NibVal) {
387
+ case 0:
388
+ return '0';
389
+ case 1:
390
+ return '1';
391
+ case 2:
392
+ return '2';
393
+ case 3:
394
+ return '3';
395
+ case 4:
396
+ return '4';
397
+ case 5:
398
+ return '5';
399
+ case 6:
400
+ return '6';
401
+ case 7:
402
+ return '7';
403
+ case 8:
404
+ return '8';
405
+ case 9:
406
+ return '9';
407
+ case 10:
408
+ return 'A';
409
+ case 11:
410
+ return 'B';
411
+ case 12:
412
+ return 'C';
413
+ case 13:
414
+ return 'D';
415
+ case 14:
416
+ return 'E';
417
+ case 15:
418
+ return 'F';
419
+ default:
420
+ return '';
421
+ }
422
+ }
423
+ static ToHexString(ByteVal) {
424
+ var Str = '';
425
+ Str += this.toHex((ByteVal >> 4) & 0x0f);
426
+ Str += this.toHex(ByteVal & 0x0f);
427
+ return Str;
428
+ }
429
+
430
+ static textToTablet(x, y, height, str, fnt) {
431
+ var c = document.createElement('canvas');
432
+ var cntx = c.getContext('2d');
433
+ cntx.font = fnt;
434
+ var txt = str;
435
+ var xs = Math.round(cntx.measureText(txt).width);
436
+ var ys = height;
437
+ c.width = xs;
438
+ c.height = ys;
439
+
440
+ cntx.font = fnt;
441
+ cntx.fillStyle = '#FFFFFF';
442
+ cntx.rect(0, 0, xs, ys);
443
+ cntx.fill();
444
+
445
+ cntx.fillStyle = '#000000';
446
+ cntx.textBaseline = 'top';
447
+ cntx.fillText(txt, 0, 0);
448
+
449
+ cntx.drawImage(cntx.canvas, 0, 0, xs, ys);
450
+
451
+ var Gstr = this.createLcdBitmapFromCanvas(c, 0, 0, xs, ys);
452
+
453
+ this.LcdWriteImageStream(0, 2, x, y, xs, ys, Gstr);
454
+ }
455
+
456
+ static LcdWriteImage(Dst, Mode, Xp, Yp, Url) {
457
+ var Prop = 'LcdWriteImage/';
458
+ var NewUrl = Url.replace(/\//g, '_');
459
+
460
+ Prop = Prop + Dst + ',' + Mode + ',' + Xp + ',' + Yp + ',' + NewUrl;
461
+ this.SigWebSetPropertySync(Prop);
462
+ }
463
+
464
+ static LcdWriteLocalImage(Dst, Mode, Xp, Yp, Url) {
465
+ var Prop = 'LcdWriteImage/';
466
+
467
+ Prop = Prop + Dst + ',' + Mode + ',' + Xp + ',' + Yp + ',' + Url;
468
+ this.SigWebSetProperty(Prop);
469
+ }
470
+
471
+ static LcdWriteImageStream(Dst, Mode, Xp, Yp, Xs, Ys, Url) {
472
+ var Prop1 =
473
+ 'LcdWriteImageStreamParams/' +
474
+ Dst +
475
+ ',' +
476
+ Mode +
477
+ ',' +
478
+ Xp +
479
+ ',' +
480
+ Yp +
481
+ ',' +
482
+ Xs +
483
+ ',' +
484
+ Ys;
485
+ var Prop2 = 'LcdWriteImageStream/';
486
+
487
+ this.SigWebSetPropertySync(Prop1);
488
+ this.SigWebSetImageStreamProperty(Prop2, Url);
489
+ }
490
+
491
+ static LcdWriteImageBlob(Dst, Mode, Xp, Yp, Xs, Ys, Url) {
492
+ var Prop = 'LcdWriteImageStream/';
493
+
494
+ Prop = Prop + Dst + ',' + Mode + ',' + Xp + ',' + Yp + ',' + Xs + ',' + Ys;
495
+ this.SigWebSetImageBlobProperty(Prop, Url);
496
+ }
497
+
498
+ static measureText(pText, pFontSize, pStyle) {
499
+ var lDiv = document.createElement('lDiv');
500
+
501
+ document.body.appendChild(lDiv);
502
+
503
+ if (pStyle != null) {
504
+ lDiv.setAttribute('style', pStyle);
505
+ }
506
+ lDiv.style.fontSize = '' + pFontSize + 'px';
507
+ lDiv.style.position = 'absolute';
508
+ lDiv.style.left = '-1000';
509
+ lDiv.style.top = '-1000';
510
+
511
+ lDiv.innerHTML = pText;
512
+
513
+ var lResult = {
514
+ width: lDiv.clientWidth,
515
+ height: lDiv.clientHeight,
516
+ };
517
+
518
+ document.body.removeChild(lDiv);
519
+ lDiv = null;
520
+
521
+ return lResult;
522
+ }
523
+ static GetVersionString() {
524
+ var Prop = 'Version';
525
+
526
+ Prop = Prop;
527
+ var Str = this.SigWebGetVersion(Prop);
528
+ if(Str == null)
529
+ return Str;
530
+
531
+ var trimStr = Str.slice(1, Str.length - 2);
532
+ return trimStr;
533
+ }
534
+
535
+ static IsPenDown() {
536
+ return this.EvStatus & 0x01;
537
+ }
538
+
539
+ //
540
+ // SigPlusNETSig.cs
541
+ //
542
+ static ClearTablet() {
543
+ var Prop = 'ClearSignature';
544
+
545
+ Prop = Prop;
546
+ return this.SigWebGetProperty(Prop);
547
+ }
548
+
549
+ static NumberOfTabletPoints() {
550
+ var Prop = 'TotalPoints';
551
+
552
+ Prop = Prop;
553
+ return this.SigWebGetProperty(Prop);
554
+ }
555
+
556
+ static SetSigString(sigStr, ctx) {
557
+ var Prop = 'SigString';
558
+
559
+ Prop = Prop;
560
+ var xhr = this.SigWebcreateXHR();
561
+
562
+ if (xhr) {
563
+ xhr.open('POST', this.baseUri + Prop);
564
+ xhr.setRequestHeader('Content-Type', 'text/plain');
565
+ xhr.send(sigStr);
566
+ xhr.onload = () => {
567
+ if (ctx) {
568
+ var can = ctx.canvas;
569
+ this.SetImageXSize(can.width);
570
+ this.SetImageYSize(can.height);
571
+ this.GetSigImage(ctx);
572
+ }
573
+ };
574
+ }
575
+ return '';
576
+ }
577
+
578
+ static GetSigString() {
579
+ var Prop = 'SigString';
580
+
581
+ Prop = Prop;
582
+ var Str = this.SigWebGetProperty(Prop);
583
+
584
+ return Str.slice(1, Str.length - 1);
585
+ }
586
+
587
+ static SetSigCompressionMode(v) {
588
+ var Prop = 'CompressionMode/';
589
+
590
+ Prop = Prop + v;
591
+ this.SigWebSetPropertySync(Prop);
592
+ }
593
+
594
+ static GetSigCompressionMode() {
595
+ var Prop = 'CompressionMode';
596
+
597
+ Prop = Prop;
598
+ return this.SigWebGetProperty(Prop);
599
+ }
600
+
601
+ static SetEncryptionMode(v) {
602
+ var Prop = 'EncryptionMode/';
603
+
604
+ Prop = Prop + v;
605
+ this.SigWebSetPropertySync(Prop);
606
+ }
607
+
608
+ static GetEncryptionMode() {
609
+ var Prop = 'EncryptionMode';
610
+
611
+ Prop = Prop;
612
+ return this.SigWebGetProperty(Prop);
613
+ }
614
+
615
+ static SetKeyString(keyString) {
616
+ var Prop = 'KeyString';
617
+
618
+ Prop = Prop;
619
+ this.SigWebSetStreamProperty(Prop, keyString);
620
+ }
621
+
622
+ static GetKeyString() {
623
+ var Prop = 'KeyString';
624
+
625
+ Prop = Prop;
626
+ var Str = this.SigWebGetProperty(Prop);
627
+
628
+ return Str.slice(1, Str.length - 1);
629
+ }
630
+
631
+ static AutoKeyStart() {
632
+ var Prop = 'AutoKeyStart';
633
+
634
+ Prop = Prop;
635
+ this.SigWebSetPropertySync(Prop);
636
+ }
637
+
638
+ static AutoKeyFinish() {
639
+ var Prop = 'AutoKeyFinish';
640
+
641
+ Prop = Prop;
642
+ this.SigWebSetPropertySync(Prop);
643
+ }
644
+
645
+ static SetAutoKeyData(keyData) {
646
+ var Prop = 'SetAutoKeyData';
647
+
648
+ Prop = Prop;
649
+ this.SigWebSetStreamProperty(Prop, keyData);
650
+ }
651
+
652
+ static AutoKeyAddData(keyData) {
653
+ var Prop = 'AutoKeyAddData';
654
+
655
+ Prop = Prop;
656
+ this.SigWebSetStreamProperty(Prop, keyData);
657
+ return this.GetKeyString();
658
+ }
659
+
660
+ // function GetKeyReceipt( ) {}
661
+
662
+ static GetKeyReceiptAscii() {
663
+ var Prop = 'KeyReceiptAscii';
664
+
665
+ Prop = Prop;
666
+ var Str = this.SigWebGetProperty(Prop);
667
+
668
+ return Str.slice(1, Str.length - 1);
669
+ }
670
+
671
+ // function GetSigReceipt( ) {}
672
+
673
+ static GetSigReceiptAscii() {
674
+ var Prop = 'SigReceiptAscii';
675
+
676
+ Prop = Prop;
677
+ var Str = this.SigWebGetProperty(Prop);
678
+
679
+ return Str.slice(1, Str.length - 1);
680
+ }
681
+
682
+ static SetTimeStamp(timeStamp) {
683
+ var Prop = 'TimeStamp';
684
+
685
+ Prop = Prop;
686
+ this.SigWebSetStreamProperty(Prop, timeStamp);
687
+ }
688
+
689
+ static GetTimeStamp() {
690
+ var Prop = 'TimeStamp';
691
+
692
+ Prop = Prop;
693
+ var Str = this.SigWebGetProperty(Prop);
694
+
695
+ return Str.slice(1, Str.length - 1);
696
+ }
697
+
698
+ static SetAnnotate(annotate) {
699
+ var Prop = 'Annotate';
700
+
701
+ Prop = Prop;
702
+ this.SigWebSetStreamProperty(Prop, annotate);
703
+ }
704
+
705
+ static GetAnnotate() {
706
+ var Prop = 'Annotate';
707
+
708
+ Prop = Prop;
709
+ var Str = this.SigWebGetProperty(Prop);
710
+
711
+ return Str.slice(1, Str.length - 1);
712
+ }
713
+
714
+ static SetSaveSigInfo(v) {
715
+ var Prop = 'SaveSigInfo/';
716
+
717
+ Prop = Prop + v;
718
+ this.SigWebSetPropertySync(Prop);
719
+ }
720
+
721
+ static GetSaveSigInfo() {
722
+ var Prop = 'SaveSigInfo';
723
+
724
+ Prop = Prop;
725
+ return this.SigWebGetProperty(Prop);
726
+ }
727
+
728
+ static SetSavePressureData(v) {
729
+ var Prop = 'SavePressureData/';
730
+
731
+ Prop = Prop + v;
732
+ this.SigWebSetPropertySync(Prop);
733
+ }
734
+
735
+ static GetSavePressureData() {
736
+ var Prop = 'SavePressureData';
737
+
738
+ Prop = Prop;
739
+ return this.SigWebGetProperty(Prop);
740
+ }
741
+
742
+ static SetSaveTimeData(v) {
743
+ var Prop = 'SaveTimeData/';
744
+
745
+ Prop = Prop + v;
746
+ this.SigWebSetPropertySync(Prop);
747
+ }
748
+
749
+ static GetSaveTimeData() {
750
+ var Prop = 'SaveTimeData';
751
+
752
+ Prop = Prop;
753
+ return this.SigWebGetProperty(Prop);
754
+ }
755
+
756
+ static SetAntiAliasSpotSize(v) {
757
+ var Prop = 'AntiAliasSpotSize/';
758
+
759
+ Prop = Prop + v;
760
+ this.SigWebSetPropertySync(Prop);
761
+ }
762
+
763
+ static GetAntiAliasSpotSize() {
764
+ var Prop = 'AntiAliasSpotSize';
765
+
766
+ Prop = Prop;
767
+ return this.SigWebGetProperty(Prop);
768
+ }
769
+
770
+ static SetAntiAliasLineScale(v) {
771
+ var Prop = 'AntiAliasLineScale/';
772
+
773
+ Prop = Prop + v;
774
+ this.SigWebSetPropertySync(Prop);
775
+ }
776
+
777
+ static GetAntiAliasLineScale() {
778
+ var Prop = 'AntiAliasLineScale';
779
+
780
+ Prop = Prop;
781
+ return this.SigWebGetProperty(Prop);
782
+ }
783
+
784
+ static GetNumberOfStrokes() {
785
+ var Prop = 'NumberOfStrokes';
786
+
787
+ Prop = Prop;
788
+ return this.SigWebGetProperty(Prop);
789
+ }
790
+
791
+ static GetNumPointsForStroke(v) {
792
+ var Prop = 'NumberOfPointsInStroke/';
793
+
794
+ Prop = Prop + v;
795
+ return this.SigWebGetProperty(Prop);
796
+ }
797
+
798
+ static GetPointXValue(v1, v2) {
799
+ var Prop = 'PointXValue/';
800
+
801
+ Prop = Prop + v1 + '/' + v2;
802
+ return this.SigWebGetProperty(Prop);
803
+ }
804
+
805
+ static GetPointYValue(v1, v2) {
806
+ var Prop = 'PointYValue/';
807
+
808
+ Prop = Prop + v1 + '/' + v2;
809
+ return this.SigWebGetProperty(Prop);
810
+ }
811
+
812
+ static SetAntiAliasEnable(v) {
813
+ var Prop = 'AntiAliasEnable/';
814
+
815
+ Prop = Prop + v;
816
+ this.SigWebSetPropertySync(Prop);
817
+ }
818
+
819
+ static GetAntiAliasEnable() {
820
+ var Prop = 'AntiAliasEnable';
821
+
822
+ Prop = Prop;
823
+ return this.SigWebGetProperty(Prop);
824
+ }
825
+
826
+ static SetUseAmbientColors(v) {
827
+ var Prop = 'UseAmbientColors/';
828
+
829
+ Prop = Prop + v;
830
+ this.SigWebSetPropertySync(Prop);
831
+ }
832
+
833
+ //
834
+ // SigPlusNETDisplay.cs
835
+ //
836
+ static SetDisplayXSize(v) {
837
+ var Prop = 'DisplayXSize/';
838
+
839
+ Prop = Prop + v;
840
+ this.SigWebSetPropertySync(Prop);
841
+ }
842
+
843
+ static GetDisplayXSize() {
844
+ var Prop = 'DisplayXSize';
845
+
846
+ Prop = Prop;
847
+ return this.SigWebGetProperty(Prop);
848
+ }
849
+
850
+ static SetDisplayYSize(v) {
851
+ var Prop = 'DisplayYSize/';
852
+
853
+ Prop = Prop + v;
854
+ this.SigWebSetPropertySync(Prop);
855
+ }
856
+
857
+ static GetDisplayYSize() {
858
+ var Prop = 'DisplayYSize';
859
+
860
+ Prop = Prop;
861
+ return this.SigWebGetProperty(Prop);
862
+ }
863
+
864
+ static SetDisplayPenWidth(v) {
865
+ var Prop = 'DisplayPenWidth/';
866
+
867
+ Prop = Prop + v;
868
+ this.SigWebSetPropertySync(Prop);
869
+ }
870
+
871
+ static GetDisplayPenWidth() {
872
+ var Prop = 'DisplayPenWidth';
873
+
874
+ Prop = Prop;
875
+ return this.SigWebGetProperty(Prop);
876
+ }
877
+
878
+ static SetDisplayTimeStamp(v) {
879
+ var Prop = 'DisplayTimeStamp/';
880
+
881
+ Prop = Prop + v;
882
+ this.SigWebSetPropertySync(Prop);
883
+ }
884
+
885
+ static GetDisplayTimeStamp() {
886
+ var Prop = 'DisplayTimeStamp';
887
+
888
+ Prop = Prop;
889
+ return this.SigWebGetProperty(Prop);
890
+ }
891
+
892
+ static SetDisplayTimeStampPosX(v) {
893
+ var Prop = 'DisplayTimeStampPosX/';
894
+
895
+ Prop = Prop + v;
896
+ this.SigWebSetPropertySync(Prop);
897
+ }
898
+
899
+ static GetDisplayTimeStampPosX() {
900
+ var Prop = 'DisplayTimeStampPosX';
901
+
902
+ Prop = Prop;
903
+ return this.SigWebGetProperty(Prop);
904
+ }
905
+
906
+ static SetDisplayTimeStampPosY(v) {
907
+ var Prop = 'DisplayTimeStampPosY/';
908
+
909
+ Prop = Prop + v;
910
+ this.SigWebSetPropertySync(Prop);
911
+ }
912
+
913
+ static GetDisplayTimeStampPosY() {
914
+ var Prop = 'DisplayTimeStampPosY';
915
+
916
+ Prop = Prop;
917
+ return this.SigWebGetProperty(Prop);
918
+ }
919
+
920
+ static SetDisplayTimeStampSize(v) {
921
+ var Prop = 'DisplayTimeStampSize/';
922
+
923
+ Prop = Prop + v;
924
+ this.SigWebSetPropertySync(Prop);
925
+ }
926
+
927
+ static GetDisplayTimeStampSize() {
928
+ var Prop = 'DisplayTimeStampSize';
929
+
930
+ Prop = Prop;
931
+ return this.SigWebGetProperty(Prop);
932
+ }
933
+
934
+ static SetDisplayAnnotate(v) {
935
+ var Prop = 'DisplayAnnotate/';
936
+
937
+ Prop = Prop + v;
938
+ this.SigWebSetPropertySync(Prop);
939
+ }
940
+
941
+ static GetDisplayAnnotate() {
942
+ var Prop = 'DisplayAnnotate';
943
+
944
+ Prop = Prop;
945
+ return this.SigWebGetProperty(Prop);
946
+ }
947
+
948
+ static SetDisplayAnnotatePosX(v) {
949
+ var Prop = 'DisplayAnnotatePosX/';
950
+
951
+ Prop = Prop + v;
952
+ this.SigWebSetPropertySync(Prop);
953
+ }
954
+
955
+ static GetDisplayAnnotatePosX() {
956
+ var Prop = 'DisplayAnnotatePosX';
957
+
958
+ Prop = Prop;
959
+ return this.SigWebGetProperty(Prop);
960
+ }
961
+
962
+ static SetDisplayAnnotatePosY(v) {
963
+ var Prop = 'DisplayAnnotatePosY/';
964
+
965
+ Prop = Prop + v;
966
+ this.SigWebSetPropertySync(Prop);
967
+ }
968
+
969
+ static GetDisplayAnnotatePosY() {
970
+ var Prop = 'DisplayAnnotatePosY';
971
+
972
+ Prop = Prop;
973
+ return this.SigWebGetProperty(Prop);
974
+ }
975
+
976
+ static SetDisplayAnnotateSize(v) {
977
+ var Prop = 'DisplayAnnotateSize/';
978
+
979
+ Prop = Prop + v;
980
+ this.SigWebSetPropertySync(Prop);
981
+ }
982
+
983
+ static GetDisplayAnnotateSize() {
984
+ var Prop = 'DisplayAnnotateSize';
985
+
986
+ Prop = Prop;
987
+ return this.SigWebGetProperty(Prop);
988
+ }
989
+
990
+ //
991
+ // SigPlusNETImage.cs
992
+ //
993
+ // function GetSigImageB64( )
994
+ // {
995
+ // var xhr2 = new XMLHttpRequest();
996
+ // xhr2.open("GET", baseUri + "SigImage/1", false );
997
+ // xhr2.responseType = "blob"
998
+ // xhr2.send(null);
999
+ // if (xhr2.readyState == 4 && xhr.status == 200)
1000
+ // {
1001
+ // return window.URL.createObjectURL(xhr2.response);
1002
+ // }
1003
+ // return null;
1004
+ // }
1005
+
1006
+ static SetImageXSize(v) {
1007
+ var Prop = 'ImageXSize/';
1008
+
1009
+ Prop = Prop + v;
1010
+ this.SigWebSetPropertySync(Prop);
1011
+ }
1012
+
1013
+ static GetImageXSize() {
1014
+ var Prop = 'ImageXSize';
1015
+
1016
+ Prop = Prop;
1017
+ return this.SigWebGetProperty(Prop);
1018
+ }
1019
+
1020
+ static SetImageYSize(v) {
1021
+ var Prop = 'ImageYSize/';
1022
+
1023
+ Prop = Prop + v;
1024
+ this.SigWebSetPropertySync(Prop);
1025
+ }
1026
+
1027
+ static GetImageYSize() {
1028
+ var Prop = 'ImageYSize';
1029
+
1030
+ Prop = Prop;
1031
+ return this.SigWebGetProperty(Prop);
1032
+ }
1033
+
1034
+ static SetImagePenWidth(v) {
1035
+ var Prop = 'ImagePenWidth/';
1036
+
1037
+ Prop = Prop + v;
1038
+ this.SigWebSetPropertySync(Prop);
1039
+ }
1040
+
1041
+ static GetImagePenWidth() {
1042
+ var Prop = 'ImagePenWidth';
1043
+
1044
+ Prop = Prop;
1045
+ return this.SigWebGetProperty(Prop);
1046
+ }
1047
+
1048
+ static SetImageTimeStamp(v) {
1049
+ var Prop = 'ImageTimeStamp/';
1050
+
1051
+ Prop = Prop + v;
1052
+ this.SigWebSetPropertySync(Prop);
1053
+ }
1054
+
1055
+ static GetImageTimeStamp() {
1056
+ var Prop = 'ImageTimeStamp';
1057
+
1058
+ Prop = Prop;
1059
+ return this.SigWebGetProperty(Prop);
1060
+ }
1061
+
1062
+ static SetImageTimeStampPosX(v) {
1063
+ var Prop = 'ImageTimeStampPosX/';
1064
+
1065
+ Prop = Prop + v;
1066
+ this.SigWebSetPropertySync(Prop);
1067
+ }
1068
+
1069
+ static GetImageTimeStampPosX() {
1070
+ var Prop = 'ImageTimeStampPosX';
1071
+
1072
+ Prop = Prop;
1073
+ return this.SigWebGetProperty(Prop);
1074
+ }
1075
+
1076
+ static SetImageTimeStampPosY(v) {
1077
+ var Prop = 'ImageTimeStampPosY/';
1078
+
1079
+ Prop = Prop + v;
1080
+ this.SigWebSetPropertySync(Prop);
1081
+ }
1082
+
1083
+ static GetImageTimeStampPosY() {
1084
+ var Prop = 'ImageTimeStampPosY';
1085
+
1086
+ Prop = Prop;
1087
+ return this.SigWebGetProperty(Prop);
1088
+ }
1089
+
1090
+ static SetImageTimeStampSize(v) {
1091
+ var Prop = 'ImageTimeStampSize/';
1092
+
1093
+ Prop = Prop + v;
1094
+ this.SigWebSetPropertySync(Prop);
1095
+ }
1096
+
1097
+ static GetImageTimeStampSize() {
1098
+ var Prop = 'ImageTimeStampSize';
1099
+
1100
+ Prop = Prop;
1101
+ return this.SigWebGetProperty(Prop);
1102
+ }
1103
+
1104
+ static SetImageAnnotate(v) {
1105
+ var Prop = 'ImageAnnotate/';
1106
+
1107
+ Prop = Prop + v;
1108
+ this.SigWebSetPropertySync(Prop);
1109
+ }
1110
+
1111
+ static GetImageAnnotate() {
1112
+ var Prop = 'ImageAnnotate';
1113
+
1114
+ Prop = Prop;
1115
+ return this.SigWebGetProperty(Prop);
1116
+ }
1117
+
1118
+ static SetImageAnnotatePosX(v) {
1119
+ var Prop = 'ImageAnnotatePosX/';
1120
+
1121
+ Prop = Prop + v;
1122
+ this.SigWebSetPropertySync(Prop);
1123
+ }
1124
+
1125
+ static GetImageAnnotatePosX() {
1126
+ var Prop = 'ImageAnnotatePosX';
1127
+
1128
+ Prop = Prop;
1129
+ return this.SigWebGetProperty(Prop);
1130
+ }
1131
+
1132
+ static SetImageAnnotatePosY(v) {
1133
+ var Prop = 'ImageAnnotatePosY/';
1134
+
1135
+ Prop = Prop + v;
1136
+ this.SigWebSetPropertySync(Prop);
1137
+ }
1138
+
1139
+ static GetImageAnnotatePosY() {
1140
+ var Prop = 'ImageAnnotatePosY';
1141
+
1142
+ Prop = Prop;
1143
+ return this.SigWebGetProperty(Prop);
1144
+ }
1145
+
1146
+ static SetImageAnnotateSize(v) {
1147
+ var Prop = 'ImageAnnotateSize/';
1148
+
1149
+ Prop = Prop + v;
1150
+ this.SigWebSetPropertySync(Prop);
1151
+ }
1152
+
1153
+ static GetImageAnnotateSize() {
1154
+ var Prop = 'ImageAnnotateSize';
1155
+
1156
+ Prop = Prop;
1157
+ return this.SigWebGetProperty(Prop);
1158
+ }
1159
+
1160
+ static SetJustifyX(v) {
1161
+ var Prop = 'JustifyX/';
1162
+
1163
+ Prop = Prop + v;
1164
+ this.SigWebSetPropertySync(Prop);
1165
+ }
1166
+
1167
+ static GetJustifyX() {
1168
+ var Prop = 'JustifyX';
1169
+
1170
+ Prop = Prop;
1171
+ return this.SigWebGetProperty(Prop);
1172
+ }
1173
+
1174
+ static SetJustifyY(v) {
1175
+ var Prop = 'JustifyY/';
1176
+
1177
+ Prop = Prop + v;
1178
+ this.SigWebSetPropertySync(Prop);
1179
+ }
1180
+
1181
+ static GetJustifyY() {
1182
+ var Prop = 'JustifyY';
1183
+
1184
+ Prop = Prop;
1185
+ return this.SigWebGetProperty(Prop);
1186
+ }
1187
+
1188
+ static SetJustifyMode(v) {
1189
+ var Prop = 'JustifyMode/';
1190
+
1191
+ Prop = Prop + v;
1192
+ this.SigWebSetPropertySync(Prop);
1193
+ }
1194
+
1195
+ static GetJustifyMode() {
1196
+ var Prop = 'JustifyMode';
1197
+
1198
+ Prop = Prop;
1199
+ return this.SigWebGetProperty(Prop);
1200
+ }
1201
+
1202
+ //
1203
+ // SigPlusNETKeyPad.cs
1204
+ //
1205
+ static KeyPadAddHotSpot(key, coord, xp, yp, xs, ys) {
1206
+ var Prop = 'KeyPadAddHotSpot/';
1207
+ Prop = Prop + key + ',' + coord + ',' + xp + ',' + yp + ',' + xs + ',' + ys;
1208
+ this.SigWebSetPropertySync(Prop);
1209
+ }
1210
+
1211
+ static KeyPadMarkHotSpot(key, coord, xp, yp, xs, ys) {
1212
+ this.LCDWriteString(0, 2, xp, yp, '16pt sans-serif', 32, '+');
1213
+ this.LCDWriteString(0, 2, xp + xs, yp, '16pt sans-serif', 32, '+');
1214
+ this.LCDWriteString(0, 2, xp, yp + ys, '16pt sans-serif', 32, '+');
1215
+ this.LCDWriteString(0, 2, xp + xs, yp + ys, '16pt sans-serif', 32, '+');
1216
+ }
1217
+
1218
+ static KeyPadQueryHotSpot(key) {
1219
+ var Prop = 'KeyPadQueryHotSpot/';
1220
+ Prop = Prop + key;
1221
+ return this.SigWebGetProperty(Prop);
1222
+ }
1223
+
1224
+ static KeyPadClearHotSpotList() {
1225
+ var Prop = 'KeyPadClearHotSpotList';
1226
+ this.SigWebSetPropertySync(Prop);
1227
+ }
1228
+
1229
+ static SetSigWindow(coords, xp, yp, xs, ys) {
1230
+ var Prop = 'SigWindow/';
1231
+ Prop = Prop + coords + ',' + xp + ',' + yp + ',' + xs + ',' + ys;
1232
+ this.SigWebSetPropertySync(Prop);
1233
+ }
1234
+
1235
+ static ClearSigWindow(inside) {
1236
+ var Prop = 'ClearSigWindow/';
1237
+ Prop = Prop + inside;
1238
+ this.SigWebSetPropertySync(Prop);
1239
+ }
1240
+
1241
+ //
1242
+ // SigPlusNETLCD.cs
1243
+ //
1244
+ static SetLCDCaptureMode(v) {
1245
+ var Prop = 'CaptureMode/';
1246
+
1247
+ Prop = Prop + v;
1248
+ this.SigWebSetPropertySync(Prop);
1249
+ }
1250
+
1251
+ static GetLCDCaptureMode() {
1252
+ var Prop = 'CaptureMode';
1253
+
1254
+ Prop = Prop;
1255
+ return this.SigWebGetProperty(Prop);
1256
+ }
1257
+
1258
+ static LCDSetWindow(xP, yP, xS, yS) {
1259
+ var Prop = 'LCDSetWindow/';
1260
+ Prop = Prop + xP + ',' + yP + ',' + xS + ',' + yS;
1261
+ this.SigWebSetPropertySync(Prop);
1262
+ }
1263
+
1264
+ static LCDWriteString(dest, mode, x, y, fnt, size, str) {
1265
+ var c = document.createElement('canvas');
1266
+ var cntx = c.getContext('2d');
1267
+ cntx.font = fnt;
1268
+ var txt = str;
1269
+ var xs = Math.round(cntx.measureText(txt).width);
1270
+ var ys = size;
1271
+ c.width = xs;
1272
+ c.height = ys;
1273
+
1274
+ if (xs == 0) {
1275
+ return;
1276
+ }
1277
+
1278
+ cntx.font = fnt;
1279
+ cntx.fillStyle = '#FFFFFF';
1280
+ cntx.rect(0, 0, xs, ys);
1281
+ cntx.fill();
1282
+
1283
+ cntx.fillStyle = '#000000';
1284
+ cntx.textBaseline = 'top';
1285
+ cntx.fillText(txt, 0, 0);
1286
+
1287
+ cntx.drawImage(cntx.canvas, 0, 0, xs, ys);
1288
+
1289
+ var Gstr = this.createLcdBitmapFromCanvas(c, x, y, xs, ys);
1290
+
1291
+ this.LcdWriteImageStream(dest, mode, x, y, xs, ys, Gstr);
1292
+ }
1293
+
1294
+ static LCDDrawRectangle(dest, mode, x, y, xs, ys, fill) {
1295
+ var c = document.createElement('canvas');
1296
+ var cntx = c.getContext('2d');
1297
+
1298
+ c.width = xs;
1299
+ c.height = ys;
1300
+
1301
+ cntx.fillStyle = fill;
1302
+ cntx.rect(0, 0, xs, ys);
1303
+ cntx.fill();
1304
+
1305
+ cntx.drawImage(cntx.canvas, 0, 0, xs, ys);
1306
+ var Gstr = this.createLcdBitmapFromCanvas(c, x, y, xs, ys);
1307
+ this.LcdWriteImageBlob(dest, mode, x, y, xs, ys, Gstr);
1308
+ }
1309
+
1310
+ static LCDDrawButton(dest, mode, x, y, xs, ys, strys, fill, fnt, str) {
1311
+ var c = document.createElement('canvas');
1312
+ var cntx = c.getContext('2d');
1313
+ cntx.font = fnt;
1314
+ var txt = str;
1315
+ var sxs = Math.round(cntx.measureText(txt).width);
1316
+ var sys = strys;
1317
+ c.width = xs;
1318
+ c.height = ys;
1319
+
1320
+ cntx.font = fnt;
1321
+ cntx.fillStyle = fill;
1322
+ cntx.rect(0, 0, xs, ys);
1323
+ cntx.fill();
1324
+
1325
+ cntx.fillStyle = '#FFFFFF';
1326
+ cntx.textBaseline = 'top';
1327
+ cntx.fillText(txt, (xs - sxs) / 2, (ys - sys) / 2);
1328
+
1329
+ cntx.drawImage(cntx.canvas, 0, 0, xs, ys);
1330
+
1331
+ var Gstr = this.createLcdBitmapFromCanvas(c, x, y, xs, ys);
1332
+
1333
+ this.LcdWriteImageBlob(dest, mode, x, y, xs, ys, Gstr);
1334
+ }
1335
+
1336
+ static LCDWriteStringWindow(dest, mode, x, y, fnt, xsize, ysize, str) {
1337
+ var c = document.createElement('canvas');
1338
+ var cntx = c.getContext('2d');
1339
+ cntx.font = fnt;
1340
+ var txt = str;
1341
+ var xs = xsize;
1342
+ var ys = ysize;
1343
+ c.width = xs;
1344
+ c.height = ys;
1345
+
1346
+ cntx.font = fnt;
1347
+ cntx.fillStyle = '#FFFFFF';
1348
+ cntx.rect(0, 0, xs, ys);
1349
+ cntx.fill();
1350
+
1351
+ cntx.fillStyle = '#000000';
1352
+ cntx.textBaseline = 'top';
1353
+ cntx.fillText(txt, 0, 0);
1354
+
1355
+ cntx.drawImage(cntx.canvas, 0, 0, xs, ys);
1356
+
1357
+ var Gstr = this.createLcdBitmapFromCanvas(c, x, y, xs, ys);
1358
+
1359
+ this.LcdWriteImageBlob(dest, mode, x, y, xs, ys, Gstr);
1360
+ }
1361
+
1362
+ static LCDStringWidth(fnt, str) {
1363
+ var c = document.createElement('canvas');
1364
+ var cntx = c.getContext('2d');
1365
+ cntx.font = fnt;
1366
+ var txt = str;
1367
+ var xs = Math.round(cntx.measureText(txt).width);
1368
+
1369
+ return xs;
1370
+ }
1371
+
1372
+ static LCDStringHeight(fnt, str) {
1373
+ return 16;
1374
+ }
1375
+
1376
+ static LcdRefresh(Mode, Xp, Yp, Xs, Ys) {
1377
+ var Prop = 'LcdRefresh/';
1378
+
1379
+ Prop = Prop + Mode + ',' + Xp + ',' + Yp + ',' + Xs + ',' + Ys;
1380
+ this.SigWebSetPropertySync(Prop);
1381
+ }
1382
+
1383
+ static LCDSendCmdString(CmdStr, ReturnCount, Result, TimeOut) {
1384
+ var Prop = 'LcdSendCmdString/';
1385
+
1386
+ Prop = Prop + ReturnCount + ',' + TimeOut;
1387
+ Result = this.SigWebSetStreamProperty(Prop, CmdStr);
1388
+ }
1389
+
1390
+ static LCDSendCmdData(CmdStr, ReturnCount, Result, TimeOut) {
1391
+ var Prop = 'LcdSendCmdData/';
1392
+
1393
+ Prop = Prop + ReturnCount + ',' + TimeOut;
1394
+ Result = this.SigWebSetStreamProperty(Prop, CmdStr);
1395
+ }
1396
+
1397
+ // function LCDSendWindowedGraphicCanvas( dest, mode, x, y, canvas )
1398
+ // {
1399
+ // }
1400
+
1401
+ // function LCDSendWindowedGraphicCanvas( dest, mode, x, y, xs, ys, canvas )
1402
+ // {
1403
+ // var Gstr = this.createLcdBitmapFromCanvas( canvas, 0, 0, xs, ys)
1404
+ // LcdWriteImageStream( dest, mode, x, y, xs, ys, Gstr );
1405
+ // }
1406
+
1407
+ static LCDSendWindowedGraphicCanvas(dest, mode, x, y, xs, ys, c, xps, yps) {
1408
+ var canvas = document.createElement('canvas');
1409
+ var Gstr = this.createLcdBitmapFromCanvas(canvas, xps, yps, xs, ys);
1410
+ this.LcdWriteImageStream(dest, mode, x, y, xs, ys, Gstr);
1411
+ }
1412
+
1413
+ static LCDSendGraphicUrl(dest, mode, x, y, url) {
1414
+ this.LcdWriteImage(dest, mode, x, y, url);
1415
+ }
1416
+
1417
+ // function LCDSendGraphic( Dest, Mode, XPos, YPos, ImageFileName ) {}
1418
+ // function LCDSendGraphicURL( Dest, Mode, XPos, YPos, URL ) {}
1419
+
1420
+ static LCDClear() {
1421
+ var Prop = 'LcdClear';
1422
+
1423
+ Prop = Prop;
1424
+ return this.SigWebGetProperty(Prop);
1425
+ }
1426
+
1427
+ static LCDSetTabletMap(
1428
+ LCDType,
1429
+ LCDXSize,
1430
+ LCDYSize,
1431
+ LCDXStart,
1432
+ LCDYStart,
1433
+ LCDXStop,
1434
+ LCDYStop
1435
+ ) {}
1436
+
1437
+ static LCDSetPixelDepth(v) {
1438
+ var Prop = 'LcdSetPixelDepth/';
1439
+
1440
+ Prop = Prop + v;
1441
+ this.SigWebSetPropertySync(Prop);
1442
+ }
1443
+
1444
+ static LCDGetLCDSize() {
1445
+ var Prop = 'LcdGetLcdSize';
1446
+
1447
+ Prop = Prop;
1448
+ return this.SigWebGetProperty(Prop);
1449
+ }
1450
+ static LCDGetCompressionMode() {
1451
+ var Prop = 'LcdCompressionMode';
1452
+
1453
+ Prop = Prop;
1454
+ return this.SigWebGetProperty(Prop);
1455
+ }
1456
+
1457
+ static LCDGetZCompressionMode() {
1458
+ var Prop = 'LcdZCompressionMode';
1459
+
1460
+ Prop = Prop;
1461
+ return this.SigWebGetProperty(Prop);
1462
+ }
1463
+
1464
+ //
1465
+ // SigPlusNETLCD.cs
1466
+ //
1467
+
1468
+ static SetRealTabletState(v) {
1469
+ var Prop = 'TabletState/';
1470
+
1471
+ Prop = Prop + v;
1472
+ this.SigWebSetPropertySync(Prop);
1473
+ }
1474
+
1475
+ static GetTabletState() {
1476
+ var Prop = 'TabletState';
1477
+
1478
+ Prop = Prop;
1479
+ return this.SigWebGetProperty(Prop);
1480
+ }
1481
+
1482
+ static SetTabletLogicalXSize(v) {
1483
+ var Prop = 'TabletLogicalXSize/';
1484
+
1485
+ Prop = Prop + v;
1486
+ this.SigWebSetPropertySync(Prop);
1487
+ }
1488
+
1489
+ static GetTabletLogicalXSize() {
1490
+ var Prop = 'TabletLogicalXSize';
1491
+
1492
+ Prop = Prop;
1493
+ return this.SigWebGetProperty(Prop);
1494
+ }
1495
+
1496
+ static GetTabletLogicalYSize() {
1497
+ var Prop = 'TabletLogicalYSize';
1498
+
1499
+ Prop = Prop;
1500
+ return this.SigWebGetProperty(Prop);
1501
+ }
1502
+
1503
+ static SetTabletLogicalYSize(v) {
1504
+ var Prop = 'TabletLogicalYSize/';
1505
+
1506
+ Prop = Prop + v;
1507
+ this.SigWebSetPropertySync(Prop);
1508
+ }
1509
+
1510
+ static SetTabletXStart(v) {
1511
+ var Prop = 'TabletXStart/';
1512
+
1513
+ Prop = Prop + v;
1514
+ this.SigWebSetPropertySync(Prop);
1515
+ }
1516
+
1517
+ static GetTabletXStart() {
1518
+ var Prop = 'TabletXStart';
1519
+
1520
+ Prop = Prop;
1521
+ return this.SigWebGetProperty(Prop);
1522
+ }
1523
+
1524
+ static SetTabletYStart(v) {
1525
+ var Prop = 'TabletYStart/';
1526
+
1527
+ Prop = Prop + v;
1528
+ this.SigWebSetPropertySync(Prop);
1529
+ }
1530
+
1531
+ static GetTabletYStart() {
1532
+ var Prop = 'TabletYStart';
1533
+
1534
+ Prop = Prop;
1535
+ return this.SigWebGetProperty(Prop);
1536
+ }
1537
+
1538
+ static SetTabletXStop(v) {
1539
+ var Prop = 'TabletXStop/';
1540
+
1541
+ Prop = Prop + v;
1542
+ this.SigWebSetPropertySync(Prop);
1543
+ }
1544
+
1545
+ static GetTabletXStop() {
1546
+ var Prop = 'TabletXStop';
1547
+
1548
+ Prop = Prop;
1549
+ return this.SigWebGetProperty(Prop);
1550
+ }
1551
+
1552
+ static SetTabletYStop(v) {
1553
+ var Prop = 'TabletYStop/';
1554
+
1555
+ Prop = Prop + v;
1556
+ this.SigWebSetPropertySync(Prop);
1557
+ }
1558
+
1559
+ static GetTabletYStop() {
1560
+ var Prop = 'TabletYStop';
1561
+
1562
+ Prop = Prop;
1563
+ return this.SigWebGetProperty(Prop);
1564
+ }
1565
+
1566
+ static SetTabletFilterPoints(v) {
1567
+ var Prop = 'TabletFilterPoints/';
1568
+
1569
+ Prop = Prop + v;
1570
+ this.SigWebSetPropertySync(Prop);
1571
+ }
1572
+
1573
+ static GetTabletFilterPoints() {
1574
+ var Prop = 'TabletFilterPoints';
1575
+
1576
+ Prop = Prop;
1577
+ return this.SigWebGetProperty(Prop);
1578
+ }
1579
+
1580
+ static SetTabletTimingAdvance(v) {
1581
+ var Prop = 'TabletTimingAdvance/';
1582
+
1583
+ Prop = Prop + v;
1584
+ this.SigWebSetPropertySync(Prop);
1585
+ }
1586
+
1587
+ static GetTabletTimingAdvance() {
1588
+ var Prop = 'TabletTimingAdvance';
1589
+
1590
+ Prop = Prop;
1591
+ return this.SigWebGetProperty(Prop);
1592
+ }
1593
+
1594
+ static SetTabletComPort(v) {
1595
+ var Prop = 'TabletComPort/';
1596
+
1597
+ Prop = Prop + v;
1598
+ this.SigWebSetPropertySync(Prop);
1599
+ }
1600
+
1601
+ static GetTabletComPort() {
1602
+ var Prop = 'TabletComPort';
1603
+
1604
+ Prop = Prop;
1605
+ return this.SigWebGetProperty(Prop);
1606
+ }
1607
+
1608
+ static SetTabletBaudRate(v) {
1609
+ var Prop = 'TabletBaudRate/';
1610
+
1611
+ Prop = Prop + v;
1612
+ this.SigWebSetPropertySync(Prop);
1613
+ }
1614
+
1615
+ static GetTabletBaudRate() {
1616
+ var Prop = 'TabletBaudRate';
1617
+
1618
+ Prop = Prop;
1619
+ return this.SigWebGetProperty(Prop);
1620
+ }
1621
+
1622
+ static SetTabletRotation(v) {
1623
+ var Prop = 'TabletRotation/';
1624
+
1625
+ Prop = Prop + v;
1626
+ this.SigWebSetPropertySync(Prop);
1627
+ }
1628
+
1629
+ static GetTabletRotation() {
1630
+ var Prop = 'TabletRotation';
1631
+
1632
+ Prop = Prop;
1633
+ return this.SigWebGetProperty(Prop);
1634
+ }
1635
+
1636
+ static SetTabletType(v) {
1637
+ var Prop = 'TabletType/';
1638
+
1639
+ Prop = Prop + v;
1640
+ this.SigWebSetPropertySync(Prop);
1641
+ }
1642
+
1643
+ static GetTabletType() {
1644
+ var Prop = 'TabletType';
1645
+
1646
+ Prop = Prop;
1647
+ return this.SigWebGetProperty(Prop);
1648
+ }
1649
+
1650
+ static SetServerTabletType(v) {
1651
+ var Prop = 'ServerTabletType/';
1652
+
1653
+ Prop = Prop + v;
1654
+ this.SigWebSetPropertySync(Prop);
1655
+ }
1656
+
1657
+ static GetServerTabletType() {
1658
+ var Prop = 'ServerTabletType';
1659
+
1660
+ Prop = Prop;
1661
+ return this.SigWebGetProperty(Prop);
1662
+ }
1663
+
1664
+ static SetTabletComTest(v) {
1665
+ var Prop = 'TabletComTest/';
1666
+
1667
+ Prop = Prop + v;
1668
+ this.SigWebSetPropertySync(Prop);
1669
+ }
1670
+
1671
+ static GetTabletComTest() {
1672
+ var Prop = 'TabletComTest';
1673
+
1674
+ Prop = Prop;
1675
+ return this.SigWebGetProperty(Prop);
1676
+ }
1677
+
1678
+ static SetTabletResolution(v) {
1679
+ var Prop = 'TabletResolution/';
1680
+
1681
+ Prop = Prop + v;
1682
+ this.SigWebSetPropertySync(Prop);
1683
+ }
1684
+
1685
+ static GetTabletResolution() {
1686
+ var Prop = 'TabletResolution';
1687
+
1688
+ Prop = Prop;
1689
+ return this.SigWebGetProperty(Prop);
1690
+ }
1691
+
1692
+ static TabletConnectQuery() {
1693
+ var Prop = 'TabletConnectQuery';
1694
+
1695
+ Prop = Prop;
1696
+ return this.SigWebGetProperty(Prop);
1697
+ }
1698
+
1699
+ static TabletModelNumber() {
1700
+ var Prop = 'TabletModelNumber';
1701
+
1702
+ Prop = Prop;
1703
+ return this.SigWebGetProperty(Prop);
1704
+ }
1705
+
1706
+ static TabletSerialNumber() {
1707
+ var Prop = 'TabletSerialNumber';
1708
+
1709
+ Prop = Prop;
1710
+ return this.SigWebGetProperty(Prop);
1711
+ }
1712
+
1713
+ static SetTabletPortPath(v) {
1714
+ var Prop = 'TabletPortPath/';
1715
+
1716
+ Prop = Prop + v;
1717
+ this.SigWebSetPropertySync(Prop);
1718
+ }
1719
+
1720
+ static SetTabletLocalIniFilePath(v) {
1721
+ var Prop = 'TabletLocalIniFilePath/';
1722
+
1723
+ Prop = Prop + v;
1724
+ this.SigWebSetPropertySync(Prop);
1725
+ }
1726
+
1727
+ static SetTabletModel(v) {
1728
+ var Prop = 'TabletModel/';
1729
+
1730
+ Prop = Prop + v;
1731
+ this.SigWebSetPropertySync(Prop);
1732
+ }
1733
+
1734
+ static SetSerialPortCloseDelay(v) {
1735
+ var Prop = 'SerialPortCloseDelay/';
1736
+
1737
+ Prop = Prop + v;
1738
+ this.SigWebSetPropertySync(Prop);
1739
+ }
1740
+
1741
+ static GetSerialPortCloseDelay() {
1742
+ var Prop = 'SerialPortCloseDelay';
1743
+
1744
+ Prop = Prop;
1745
+ return this.SigWebGetProperty(Prop);
1746
+ }
1747
+
1748
+ static EnableTabletEncryption() {
1749
+ var Prop = 'EnableTabletEncryption';
1750
+
1751
+ Prop = Prop;
1752
+ this.SigWebSetPropertySync(Prop);
1753
+ }
1754
+
1755
+ static SetTabletEncryptionMode(hmode, tmode) {
1756
+ var Prop = 'TabletEncryptionMode/';
1757
+
1758
+ Prop = Prop + hmode + ',' + tmode;
1759
+ this.SigWebSetPropertySync(Prop);
1760
+ }
1761
+
1762
+ static SetMaxLogFileSize(v) {
1763
+ var Prop = 'MaxLogFileSize/';
1764
+
1765
+ Prop = Prop + v;
1766
+ this.SigWebSetPropertySync(Prop);
1767
+ }
1768
+
1769
+ static GetSigSockServerPath() {
1770
+ var Prop = 'SigSockServerPath';
1771
+
1772
+ Prop = Prop;
1773
+ return this.SigWebGetProperty(Prop);
1774
+ }
1775
+
1776
+ static GetSigSockClientName() {
1777
+ var Prop = 'SigSockClientName';
1778
+
1779
+ Prop = Prop;
1780
+ return this.SigWebGetProperty(Prop);
1781
+ }
1782
+
1783
+ static GetSigSockPortNumber() {
1784
+ var Prop = 'SigSockPortNumber';
1785
+
1786
+ Prop = Prop;
1787
+ return this.SigWebGetProperty(Prop);
1788
+ }
1789
+
1790
+ static SetSigSockServerPath(v) {
1791
+ var Prop = 'SigSockServerPath/';
1792
+
1793
+ Prop = Prop + v;
1794
+ this.SigWebSetPropertySync(Prop);
1795
+ }
1796
+
1797
+ static SetSigSockClientName(v) {
1798
+ var Prop = 'SigSockClientName/';
1799
+
1800
+ Prop = Prop + v;
1801
+ this.SigWebSetPropertySync(Prop);
1802
+ }
1803
+
1804
+ static SetPortNumber(v) {
1805
+ var Prop = 'PortNumber/';
1806
+
1807
+ Prop = Prop + v;
1808
+ this.SigWebSetPropertySync(Prop);
1809
+ }
1810
+
1811
+ static SetSigSockPortNumber(v) {
1812
+ var Prop = 'SigSockPortNumber/';
1813
+
1814
+ Prop = Prop + v;
1815
+ this.SigWebSetPropertySync(Prop);
1816
+ }
1817
+
1818
+ static GetFirmwareRevision() {
1819
+ var Prop = 'FirmwareRevision';
1820
+
1821
+ Prop = Prop;
1822
+ return this.SigWebGetProperty(Prop);
1823
+ }
1824
+
1825
+ static SetTabletData(sigStr) {
1826
+ var Prop = 'TabletData';
1827
+
1828
+ Prop = Prop;
1829
+ this.SigWebSetStreamProperty(Prop, sigStr);
1830
+ }
1831
+
1832
+ static GetTabletData() {
1833
+ var Prop = 'TabletData';
1834
+
1835
+ Prop = Prop;
1836
+ var Str = this.SigWebGetProperty(Prop);
1837
+
1838
+ return Str.slice(1, Str.length - 1);
1839
+ }
1840
+
1841
+ static OpenTablet(v) {
1842
+ var Prop = 'OpenTablet/';
1843
+
1844
+ Prop = Prop + v;
1845
+ this.SigWebSetPropertySync(Prop);
1846
+ }
1847
+
1848
+ static CloseTablet() {
1849
+ var Prop = 'CloseTablet';
1850
+
1851
+ Prop = Prop;
1852
+ this.SigWebSetProperty(Prop);
1853
+ }
1854
+
1855
+ static ResetParameters() {
1856
+ var Prop = 'ResetParameters';
1857
+
1858
+ Prop = Prop;
1859
+ this.SigWebSetPropertySync(Prop);
1860
+ }
1861
+
1862
+ static testRawData() {
1863
+ this.OpenTablet(1);
1864
+ var Str1 = this.GetTabletData();
1865
+ this.CloseTablet();
1866
+ }
1867
+
1868
+ static SetTabletState(v, ctx, tv) {
1869
+ var delay;
1870
+
1871
+ if (tv) {
1872
+ delay = tv;
1873
+ } else {
1874
+ delay = 100;
1875
+ }
1876
+
1877
+ if (this.GetTabletState() != v) {
1878
+ if (v == 1) {
1879
+ if (ctx) {
1880
+ var can = ctx.canvas;
1881
+ this.SetDisplayXSize(can.width);
1882
+ this.SetDisplayYSize(can.height);
1883
+ this.SigWebSetDisplayTarget(ctx);
1884
+ }
1885
+ this.SetRealTabletState(v);
1886
+ var data = this.GetTabletState();
1887
+ var dataResult = data == '' || data == null ? 0 : Number(data);
1888
+ var tmr = null;
1889
+ if (ctx && dataResult != 0) {
1890
+ tmr = setInterval(() => this.SigWebRefresh(), delay);
1891
+ } else {
1892
+ tmr = null;
1893
+ }
1894
+
1895
+ return tmr;
1896
+ } else {
1897
+ if (ctx) {
1898
+ clearInterval(ctx);
1899
+ }
1900
+ this.SigWebSetDisplayTarget(null);
1901
+ this.SetRealTabletState(v);
1902
+ }
1903
+ }
1904
+ return null;
1905
+ }
1906
+ }