@operato/scene-wheel-sorter 0.0.11

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 (70) hide show
  1. package/@types/global/index.d.ts +1 -0
  2. package/CHANGELOG.md +12 -0
  3. package/LICENSE +21 -0
  4. package/README.md +33 -0
  5. package/assets/conveyor-belt.png +0 -0
  6. package/assets/conveyor-join-trapezoid.png +0 -0
  7. package/assets/conveyor-join.png +0 -0
  8. package/assets/conveyor.png +0 -0
  9. package/assets/scanner.png +0 -0
  10. package/assets/wheel-sorter.png +0 -0
  11. package/dist/conveyor-join-trapezoid.d.ts +41 -0
  12. package/dist/conveyor-join-trapezoid.js +63 -0
  13. package/dist/conveyor-join-trapezoid.js.map +1 -0
  14. package/dist/conveyor-join.d.ts +49 -0
  15. package/dist/conveyor-join.js +142 -0
  16. package/dist/conveyor-join.js.map +1 -0
  17. package/dist/conveyor.d.ts +41 -0
  18. package/dist/conveyor.js +62 -0
  19. package/dist/conveyor.js.map +1 -0
  20. package/dist/index.d.ts +5 -0
  21. package/dist/index.js +9 -0
  22. package/dist/index.js.map +1 -0
  23. package/dist/mixin-conveyor.d.ts +16 -0
  24. package/dist/mixin-conveyor.js +121 -0
  25. package/dist/mixin-conveyor.js.map +1 -0
  26. package/dist/mixin-scanner.d.ts +15 -0
  27. package/dist/mixin-scanner.js +99 -0
  28. package/dist/mixin-scanner.js.map +1 -0
  29. package/dist/mixin-wheel-sorter.d.ts +12 -0
  30. package/dist/mixin-wheel-sorter.js +92 -0
  31. package/dist/mixin-wheel-sorter.js.map +1 -0
  32. package/dist/scanner.d.ts +28 -0
  33. package/dist/scanner.js +46 -0
  34. package/dist/scanner.js.map +1 -0
  35. package/dist/templates/index.d.ts +173 -0
  36. package/dist/templates/index.js +123 -0
  37. package/dist/templates/index.js.map +1 -0
  38. package/dist/wheel-sorter.d.ts +27 -0
  39. package/dist/wheel-sorter.js +54 -0
  40. package/dist/wheel-sorter.js.map +1 -0
  41. package/helps/scene/component/conveyor-join-trapezoid.ko.md +6 -0
  42. package/helps/scene/component/conveyor-join-trapezoid.md +6 -0
  43. package/helps/scene/component/conveyor-join-trapezoid.zh.md +6 -0
  44. package/helps/scene/component/conveyor-join.ko.md +6 -0
  45. package/helps/scene/component/conveyor-join.md +6 -0
  46. package/helps/scene/component/conveyor-join.zh.md +6 -0
  47. package/helps/scene/component/conveyor.ko.md +6 -0
  48. package/helps/scene/component/conveyor.md +6 -0
  49. package/helps/scene/component/conveyor.zh.md +6 -0
  50. package/helps/scene/component/wheel-sorter.ko.md +6 -0
  51. package/helps/scene/component/wheel-sorter.md +6 -0
  52. package/helps/scene/component/wheel-sorter.zh.md +6 -0
  53. package/package.json +62 -0
  54. package/src/conveyor-join-trapezoid.ts +69 -0
  55. package/src/conveyor-join.ts +170 -0
  56. package/src/conveyor.ts +69 -0
  57. package/src/index.ts +8 -0
  58. package/src/mixin-conveyor.ts +169 -0
  59. package/src/mixin-scanner.ts +122 -0
  60. package/src/mixin-wheel-sorter.ts +117 -0
  61. package/src/scanner.ts +54 -0
  62. package/src/templates/index.ts +123 -0
  63. package/src/wheel-sorter.ts +63 -0
  64. package/test/basic-test.html +67 -0
  65. package/test/index.html +22 -0
  66. package/test/unit/test-conveyor.js +35 -0
  67. package/test/unit/util.js +21 -0
  68. package/things-scene.config.js +5 -0
  69. package/tsconfig.json +23 -0
  70. package/tsconfig.tsbuildinfo +1 -0
@@ -0,0 +1,121 @@
1
+ /*
2
+ * Copyright © HatioLab Inc. All rights reserved.
3
+ */
4
+ import { Component, ValueHolder } from '@hatiolab/things-scene';
5
+ const TYPE_ROLLER = 0;
6
+ const TYPE_BELT = 1;
7
+ const FILL_STYLES = ['#ccc', '#afd0f1', '#afd0f1', '#ffba00', '#e9746b']; // IDLE, RUN, RUN(REVERSE), WARN, ERROR
8
+ const STROKE_STYLES = ['#999', '#87b1db', '#87b1db', '#d96f21', '#a73928']; // IDLE, RUN, RUN(REVERSE), WARN, ERROR
9
+ function pattern_for_belt_type(component) {
10
+ var { height } = component.bounds;
11
+ var { rollWidth = 10 } = component.model;
12
+ var width = Math.max(rollWidth, 1);
13
+ var color = FILL_STYLES[component.value] || FILL_STYLES[0];
14
+ var stroke = STROKE_STYLES[component.value] || STROKE_STYLES[0];
15
+ var lineWidth = 1;
16
+ if (!component._roller_pattern)
17
+ component._roller_pattern = document.createElement('canvas');
18
+ component._roller_pattern.width = width;
19
+ component._roller_pattern.height = height;
20
+ var context = component._roller_pattern.getContext('2d');
21
+ context.beginPath();
22
+ context.fillStyle = color;
23
+ context.strokeStyle = stroke;
24
+ context.lineWidth = lineWidth;
25
+ context.moveTo(0, 0);
26
+ context.lineTo(width, 0);
27
+ context.lineTo(width, height);
28
+ context.lineTo(0, height);
29
+ context.lineTo(0, 0);
30
+ context.fill();
31
+ context.beginPath();
32
+ context.globalAlpha = 0.2;
33
+ var x_for_belt = (component._step || 0) % width;
34
+ if (component.value == 2)
35
+ x_for_belt = width - x_for_belt;
36
+ context.moveTo(x_for_belt, height);
37
+ context.lineTo(x_for_belt, 0);
38
+ context.stroke();
39
+ return component._roller_pattern;
40
+ }
41
+ function pattern_for_roller_type(component) {
42
+ var { height } = component.bounds;
43
+ var { rollWidth = 10, animated } = component.model;
44
+ // var modelWidth = component.model.width;
45
+ var width = Math.max(rollWidth, 1);
46
+ var color = FILL_STYLES[component.value] || FILL_STYLES[0];
47
+ var stroke = STROKE_STYLES[component.value] || STROKE_STYLES[0];
48
+ var lineWidth = Math.min(1, width / 10);
49
+ width += lineWidth * 2;
50
+ if (!component._roller_pattern)
51
+ component._roller_pattern = document.createElement('canvas');
52
+ var gap = Math.floor((width * 2) / 3);
53
+ // while (Math.round(modelWidth - width) % (width + gap) > gap) {
54
+ // gap++
55
+ // console.log(gap, Math.round(modelWidth - width) % (width + gap))
56
+ // }
57
+ component._roller_pattern.width = width + gap;
58
+ component._roller_pattern.height = height;
59
+ var context = component._roller_pattern.getContext('2d');
60
+ context.beginPath();
61
+ context.fillStyle = color;
62
+ context.strokeStyle = stroke;
63
+ context.lineWidth = lineWidth;
64
+ context.ellipse(lineWidth + width / 2, height - width / 4 - lineWidth, width / 2, width / 4, 0, 0, Math.PI);
65
+ context.moveTo(lineWidth, height - width / 4);
66
+ context.lineTo(lineWidth, width / 4);
67
+ context.ellipse(lineWidth + width / 2, width / 4 + lineWidth, width / 2, width / 4, 0, Math.PI, 0);
68
+ context.lineTo(lineWidth + width, height - width / 4);
69
+ context.fill();
70
+ context.stroke();
71
+ context.globalAlpha = 0.2;
72
+ context.lineWidth = width / 3;
73
+ if (animated) {
74
+ var x_for_roll = component._step % width;
75
+ if (component.value == 2)
76
+ x_for_roll = width - x_for_roll;
77
+ context.moveTo(x_for_roll, height - width / 4);
78
+ context.lineTo(x_for_roll, width / 4);
79
+ context.stroke();
80
+ }
81
+ return component._roller_pattern;
82
+ }
83
+ const patterns = [pattern_for_roller_type, pattern_for_belt_type];
84
+ export default (superclass) => {
85
+ var A = class extends ValueHolder(superclass) {
86
+ dispose() {
87
+ super.dispose();
88
+ delete this._roller_pattern;
89
+ }
90
+ animOnState() {
91
+ if ((this.value !== 1 && this.value !== 2) || this.disposed)
92
+ return;
93
+ if (!this._step || this._step > 40000)
94
+ this._step = this.value == 0;
95
+ this._step++;
96
+ var self = this;
97
+ requestAnimationFrame(function () {
98
+ self.clearCache('fillStyle');
99
+ self.invalidate();
100
+ });
101
+ }
102
+ get conveyorType() {
103
+ var conveyorType = this.get('conveyorType');
104
+ if (conveyorType != TYPE_BELT && conveyorType != TYPE_ROLLER)
105
+ conveyorType = TYPE_ROLLER;
106
+ return conveyorType;
107
+ }
108
+ get fillStyle() {
109
+ return {
110
+ image: patterns[this.conveyorType](this),
111
+ offsetX: 0,
112
+ offsetY: 0,
113
+ type: 'pattern'
114
+ };
115
+ }
116
+ };
117
+ Component.memoize(A.prototype, 'fillStyle', false);
118
+ Component.memoize(A.prototype, 'conveyorType', false);
119
+ return A;
120
+ };
121
+ //# sourceM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class, Component, ValueHolder } from '@hatiolab/things-scene'\n\nconst TYPE_ROLLER = 0\nconst TYPE_BELT = 1\n\nconst FILL_STYLES = ['#ccc', '#afd0f1', '#afd0f1', '#ffba00', '#e9746b'] // IDLE, RUN, RUN(REVERSE), WARN, ERROR\nconst STROKE_STYLES = ['#999', '#87b1db', '#87b1db', '#d96f21', '#a73928'] // IDLE, RUN, RUN(REVERSE), WARN, ERROR\n\ntype RollerPattern = {\n width: number\n height: number\n}\n\nfunction pattern_for_belt_type(component: any) {\n var { height } = component.bounds\n\n var { rollWidth = 10 } = component.model\n\n var width = Math.max(rollWidth, 1)\n\n var color = FILL_STYLES[component.value] || FILL_STYLES[0]\n var stroke = STROKE_STYLES[component.value] || STROKE_STYLES[0]\n var lineWidth = 1\n\n if (!component._roller_pattern) component._roller_pattern = document.createElement('canvas')\n\n component._roller_pattern.width = width\n component._roller_pattern.height = height\n\n var context = component._roller_pattern.getContext('2d')\n\n context.beginPath()\n context.fillStyle = color\n context.strokeStyle = stroke\n context.lineWidth = lineWidth\n\n context.moveTo(0, 0)\n context.lineTo(width, 0)\n context.lineTo(width, height)\n context.lineTo(0, height)\n context.lineTo(0, 0)\n context.fill()\n\n context.beginPath()\n\n context.globalAlpha = 0.2\n\n var x_for_belt = (component._step || 0) % width\n if (component.value == 2) x_for_belt = width - x_for_belt\n\n context.moveTo(x_for_belt, height)\n context.lineTo(x_for_belt, 0)\n\n context.stroke()\n\n return component._roller_pattern\n}\n\nfunction pattern_for_roller_type(component: any) {\n var { height } = component.bounds\n\n var { rollWidth = 10, animated } = component.model\n\n // var modelWidth = component.model.width;\n\n var width = Math.max(rollWidth, 1)\n\n var color = FILL_STYLES[component.value] || FILL_STYLES[0]\n var stroke = STROKE_STYLES[component.value] || STROKE_STYLES[0]\n var lineWidth = Math.min(1, width / 10)\n\n width += lineWidth * 2\n\n if (!component._roller_pattern) component._roller_pattern = document.createElement('canvas')\n\n var gap = Math.floor((width * 2) / 3)\n\n // while (Math.round(modelWidth - width) % (width + gap) > gap) {\n // gap++\n // console.log(gap, Math.round(modelWidth - width) % (width + gap))\n // }\n\n component._roller_pattern.width = width + gap\n component._roller_pattern.height = height\n\n var context = component._roller_pattern.getContext('2d')\n\n context.beginPath()\n context.fillStyle = color\n context.strokeStyle = stroke\n context.lineWidth = lineWidth\n\n context.ellipse(lineWidth + width / 2, height - width / 4 - lineWidth, width / 2, width / 4, 0, 0, Math.PI)\n\n context.moveTo(lineWidth, height - width / 4)\n context.lineTo(lineWidth, width / 4)\n\n context.ellipse(lineWidth + width / 2, width / 4 + lineWidth, width / 2, width / 4, 0, Math.PI, 0)\n\n context.lineTo(lineWidth + width, height - width / 4)\n\n context.fill()\n context.stroke()\n\n context.globalAlpha = 0.2\n\n context.lineWidth = width / 3\n\n if (animated) {\n var x_for_roll = component._step % width\n if (component.value == 2) x_for_roll = width - x_for_roll\n\n context.moveTo(x_for_roll, height - width / 4)\n context.lineTo(x_for_roll, width / 4)\n\n context.stroke()\n }\n\n return component._roller_pattern\n}\n\nconst patterns = [pattern_for_roller_type, pattern_for_belt_type]\n\nexport default (superclass: Class) => {\n var A = class extends ValueHolder(superclass) {\n dispose() {\n super.dispose()\n delete this._roller_pattern\n }\n\n animOnState() {\n if ((this.value !== 1 && this.value !== 2) || this.disposed) return\n\n if (!this._step || this._step > 40000) this._step = this.value == 0\n\n this._step++\n\n var self = this\n\n requestAnimationFrame(function () {\n self.clearCache('fillStyle')\n self.invalidate()\n })\n }\n\n get conveyorType() {\n var conveyorType = this.get('conveyorType')\n if (conveyorType != TYPE_BELT && conveyorType != TYPE_ROLLER) conveyorType = TYPE_ROLLER\n return conveyorType\n }\n\n get fillStyle() {\n return {\n image: patterns[this.conveyorType](this),\n offsetX: 0,\n offsetY: 0,\n type: 'pattern'\n }\n }\n }\n\n Component.memoize(A.prototype, 'fillStyle', false)\n Component.memoize(A.prototype, 'conveyorType', false)\n\n return A\n}\n"]}
@@ -0,0 +1,15 @@
1
+ import { Class } from '@hatiolab/things-scene';
2
+ declare const _default: (superclass: Class) => {
3
+ new (...args: any[]): {
4
+ [x: string]: any;
5
+ dispose(): void;
6
+ readonly fillStyle: {
7
+ image: any;
8
+ offsetX: number;
9
+ offsetY: number;
10
+ type: string;
11
+ fitPattern: boolean;
12
+ };
13
+ };
14
+ };
15
+ export default _default;
@@ -0,0 +1,99 @@
1
+ /*
2
+ * Copyright © HatioLab Inc. All rights reserved.
3
+ */
4
+ import { Component, ValueHolder } from '@hatiolab/things-scene';
5
+ const FILL_STYLES = ['rgba(0,0,0,.4)', 'rgba(175,208,241,.7)', 'rgba(255,186,0,.7)', 'rgba(198,50,40,.7)']; // IDLE, RUN, WARN, ERROR
6
+ const STROKE_STYLES = ['rgba(0,0,0,.7)', 'rgba(175,208,241,1)', 'rgba(255,186,0,1)', 'rgba(198,50,40,1)']; // IDLE, RUN, WARN, ERROR
7
+ function pattern(component) {
8
+ var { width, height } = component.bounds;
9
+ var color = FILL_STYLES[component.value] || FILL_STYLES[0];
10
+ var stroke = STROKE_STYLES[component.value] || STROKE_STYLES[0];
11
+ var lineWidth = 1;
12
+ if (!component._scanner_pattern)
13
+ component._scanner_pattern = document.createElement('canvas');
14
+ component._scanner_pattern.width = width;
15
+ component._scanner_pattern.height = height;
16
+ var ctx = component._scanner_pattern.getContext('2d');
17
+ var radius = width / 10;
18
+ var left = 0;
19
+ var top = 0;
20
+ // outer box
21
+ ctx.beginPath();
22
+ ctx.fillStyle = color;
23
+ ctx.strokeStyle = stroke;
24
+ ctx.rect(0, 0, width, height);
25
+ ctx.fill();
26
+ // ctx.stroke();
27
+ // inner box
28
+ radius = width / 40;
29
+ left = width / 4;
30
+ top = height / 4;
31
+ ctx.beginPath();
32
+ ctx.fillStyle = 'rgba(0,0,0,.7)';
33
+ ctx.strokeStyle = null;
34
+ ctx.moveTo(left + radius, top);
35
+ ctx.lineTo(left + width / 2 - radius, top);
36
+ ctx.quadraticCurveTo(left + width / 2, top, left + width / 2, top + radius);
37
+ ctx.lineTo(left + width / 2, top + height / 2 - radius);
38
+ ctx.quadraticCurveTo(left + width / 2, top + height / 2, left + width / 2 - radius, top + height / 2);
39
+ ctx.lineTo(left + radius, top + height / 2);
40
+ ctx.quadraticCurveTo(left, top + height / 2, left, top + height / 2 - radius);
41
+ ctx.lineTo(left, top + radius);
42
+ ctx.quadraticCurveTo(left, top, left + radius, top);
43
+ ctx.fill();
44
+ // barcode
45
+ left = left + width * 0.1;
46
+ top = top + height * 0.05;
47
+ var offsetTop = 0;
48
+ var barcodeAreaWidth = width * 0.3;
49
+ var barcodeAreaHeight = height * 0.4;
50
+ ctx.beginPath();
51
+ ctx.fillStyle = '#fff';
52
+ ctx.moveTo(left, top);
53
+ ctx.rect(left, top + offsetTop, barcodeAreaWidth, (barcodeAreaHeight / 14) * 0.9);
54
+ offsetTop = (barcodeAreaHeight / 14) * 2;
55
+ ctx.rect(left, top + offsetTop, barcodeAreaWidth, (barcodeAreaHeight / 14) * 0.3);
56
+ offsetTop = (barcodeAreaHeight / 14) * 4;
57
+ ctx.rect(left, top + offsetTop, barcodeAreaWidth, (barcodeAreaHeight / 14) * 0.4);
58
+ offsetTop = (barcodeAreaHeight / 14) * 6;
59
+ ctx.rect(left, top + offsetTop, barcodeAreaWidth, (barcodeAreaHeight / 14) * 0.8);
60
+ offsetTop = (barcodeAreaHeight / 14) * 8;
61
+ ctx.rect(left, top + offsetTop, barcodeAreaWidth, (barcodeAreaHeight / 14) * 0.6);
62
+ offsetTop = (barcodeAreaHeight / 14) * 10;
63
+ ctx.rect(left, top + offsetTop, barcodeAreaWidth, barcodeAreaHeight / 14);
64
+ offsetTop = (barcodeAreaHeight / 14) * 11;
65
+ ctx.rect(left, top + offsetTop, barcodeAreaWidth, barcodeAreaHeight / 14);
66
+ offsetTop = (barcodeAreaHeight / 14) * 14;
67
+ ctx.rect(left, top + offsetTop, barcodeAreaWidth, (barcodeAreaHeight / 14) * 0.3);
68
+ ctx.fill();
69
+ // lazer
70
+ ctx.beginPath();
71
+ left = width / 2;
72
+ top = height * 0.1;
73
+ ctx.strokeStyle = '#cc3300';
74
+ ctx.lineWidth = 1;
75
+ ctx.moveTo(left, top);
76
+ ctx.lineTo(left, height * 0.9);
77
+ ctx.stroke();
78
+ return component._scanner_pattern;
79
+ }
80
+ export default (superclass) => {
81
+ var A = class extends ValueHolder(superclass) {
82
+ dispose() {
83
+ super.dispose();
84
+ delete this._scanner_pattern;
85
+ }
86
+ get fillStyle() {
87
+ return {
88
+ image: pattern(this),
89
+ offsetX: 0,
90
+ offsetY: 0,
91
+ type: 'pattern',
92
+ fitPattern: true
93
+ };
94
+ }
95
+ };
96
+ Component.memoize(A.prototype, 'fillStyle', false);
97
+ return A;
98
+ };
99
+ //# sourceMappingURL=mixin-scanner.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mixin-scanner.js","sourceRoot":"","sources":["../src/mixin-scanner.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAS,SAAS,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAA;AAEtE,MAAM,WAAW,GAAG,CAAC,gBAAgB,EAAE,sBAAsB,EAAE,oBAAoB,EAAE,oBAAoB,CAAC,CAAA,CAAC,yBAAyB;AACpI,MAAM,aAAa,GAAG,CAAC,gBAAgB,EAAE,qBAAqB,EAAE,mBAAmB,EAAE,mBAAmB,CAAC,CAAA,CAAC,yBAAyB;AAEnI,SAAS,OAAO,CAAC,SAAc;IAC7B,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,SAAS,CAAC,MAAM,CAAA;IAExC,IAAI,KAAK,GAAG,WAAW,CAAC,SAAS,CAAC,KAAK,CAAC,IAAI,WAAW,CAAC,CAAC,CAAC,CAAA;IAC1D,IAAI,MAAM,GAAG,aAAa,CAAC,SAAS,CAAC,KAAK,CAAC,IAAI,aAAa,CAAC,CAAC,CAAC,CAAA;IAC/D,IAAI,SAAS,GAAG,CAAC,CAAA;IAEjB,IAAI,CAAC,SAAS,CAAC,gBAAgB;QA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A","sourcesContent":["/*\n * Copyright © HatioLab Inc. All rights reserved.\n */\nimport { Class, Component, ValueHolder } from '@hatiolab/things-scene'\n\nconst FILL_STYLES = ['rgba(0,0,0,.4)', 'rgba(175,208,241,.7)', 'rgba(255,186,0,.7)', 'rgba(198,50,40,.7)'] // IDLE, RUN, WARN, ERROR\nconst STROKE_STYLES = ['rgba(0,0,0,.7)', 'rgba(175,208,241,1)', 'rgba(255,186,0,1)', 'rgba(198,50,40,1)'] // IDLE, RUN, WARN, ERROR\n\nfunction pattern(component: any) {\n var { width, height } = component.bounds\n\n var color = FILL_STYLES[component.value] || FILL_STYLES[0]\n var stroke = STROKE_STYLES[component.value] || STROKE_STYLES[0]\n var lineWidth = 1\n\n if (!component._scanner_pattern) component._scanner_pattern = document.createElement('canvas')\n\n component._scanner_pattern.width = width\n component._scanner_pattern.height = height\n\n var ctx = component._scanner_pattern.getContext('2d')\n\n var radius = width / 10\n var left = 0\n var top = 0\n\n // outer box\n ctx.beginPath()\n ctx.fillStyle = color\n ctx.strokeStyle = stroke\n\n ctx.rect(0, 0, width, height)\n ctx.fill()\n // ctx.stroke();\n\n // inner box\n radius = width / 40\n left = width / 4\n top = height / 4\n\n ctx.beginPath()\n ctx.fillStyle = 'rgba(0,0,0,.7)'\n ctx.strokeStyle = null\n\n ctx.moveTo(left + radius, top)\n ctx.lineTo(left + width / 2 - radius, top)\n ctx.quadraticCurveTo(left + width / 2, top, left + width / 2, top + radius)\n ctx.lineTo(left + width / 2, top + height / 2 - radius)\n ctx.quadraticCurveTo(left + width / 2, top + height / 2, left + width / 2 - radius, top + height / 2)\n ctx.lineTo(left + radius, top + height / 2)\n ctx.quadraticCurveTo(left, top + height / 2, left, top + height / 2 - radius)\n ctx.lineTo(left, top + radius)\n ctx.quadraticCurveTo(left, top, left + radius, top)\n ctx.fill()\n\n // barcode\n left = left + width * 0.1\n top = top + height * 0.05\n\n var offsetTop = 0\n var barcodeAreaWidth = width * 0.3\n var barcodeAreaHeight = height * 0.4\n\n ctx.beginPath()\n ctx.fillStyle = '#fff'\n\n ctx.moveTo(left, top)\n ctx.rect(left, top + offsetTop, barcodeAreaWidth, (barcodeAreaHeight / 14) * 0.9)\n offsetTop = (barcodeAreaHeight / 14) * 2\n ctx.rect(left, top + offsetTop, barcodeAreaWidth, (barcodeAreaHeight / 14) * 0.3)\n offsetTop = (barcodeAreaHeight / 14) * 4\n ctx.rect(left, top + offsetTop, barcodeAreaWidth, (barcodeAreaHeight / 14) * 0.4)\n offsetTop = (barcodeAreaHeight / 14) * 6\n ctx.rect(left, top + offsetTop, barcodeAreaWidth, (barcodeAreaHeight / 14) * 0.8)\n offsetTop = (barcodeAreaHeight / 14) * 8\n ctx.rect(left, top + offsetTop, barcodeAreaWidth, (barcodeAreaHeight / 14) * 0.6)\n offsetTop = (barcodeAreaHeight / 14) * 10\n ctx.rect(left, top + offsetTop, barcodeAreaWidth, barcodeAreaHeight / 14)\n offsetTop = (barcodeAreaHeight / 14) * 11\n ctx.rect(left, top + offsetTop, barcodeAreaWidth, barcodeAreaHeight / 14)\n offsetTop = (barcodeAreaHeight / 14) * 14\n ctx.rect(left, top + offsetTop, barcodeAreaWidth, (barcodeAreaHeight / 14) * 0.3)\n\n ctx.fill()\n\n // lazer\n ctx.beginPath()\n left = width / 2\n top = height * 0.1\n\n ctx.strokeStyle = '#cc3300'\n ctx.lineWidth = 1\n ctx.moveTo(left, top)\n ctx.lineTo(left, height * 0.9)\n\n ctx.stroke()\n\n return component._scanner_pattern\n}\n\nexport default (superclass: Class) => {\n var A = class extends ValueHolder(superclass) {\n dispose() {\n super.dispose()\n delete this._scanner_pattern\n }\n\n get fillStyle() {\n return {\n image: pattern(this),\n offsetX: 0,\n offsetY: 0,\n type: 'pattern',\n fitPattern: true\n }\n }\n }\n\n Component.memoize(A.prototype, 'fillStyle', false)\n\n return A\n}\n"]}
@@ -0,0 +1,12 @@
1
+ import { Class } from '@hatiolab/things-scene';
2
+ declare const _default: (superclass: Class) => {
3
+ new (...args: any[]): {
4
+ [x: string]: any;
5
+ animOnState(): void;
6
+ _draw_pattern(ctx: CanvasRenderingContext2D): void;
7
+ _draw_circle(ctx: CanvasRenderingContext2D, size: number): void;
8
+ _draw_inner(ctx: CanvasRenderingContext2D, size: number, tilt: number): void;
9
+ _draw_wheel(ctx: CanvasRenderingContext2D, size: number, tilt: number): void;
10
+ };
11
+ };
12
+ export default _default;
@@ -0,0 +1,92 @@
1
+ /*
2
+ * Copyright © HatioLab Inc. All rights reserved.
3
+ */
4
+ import { Component, ValueHolder } from '@hatiolab/things-scene';
5
+ const FILL_STYLES = ['#ccc', '#afd0f1', '#ffba00', '#e9746b']; // IDLE, RUN, WARN, ERROR
6
+ const STROKE_STYLES = ['#999', '#87b1db', '#d96f21', '#a73928']; // IDLE, RUN, WARN, ERROR
7
+ export default (superclass) => {
8
+ var A = class extends ValueHolder(superclass) {
9
+ animOnState() {
10
+ if (this.value !== 1 || this.disposed)
11
+ return;
12
+ var self = this;
13
+ var alpha = Math.floor(Math.random() * 100);
14
+ if (alpha < 10)
15
+ alpha = 2;
16
+ else if (alpha > 90)
17
+ alpha = 1;
18
+ else
19
+ alpha = 0;
20
+ requestAnimationFrame(function () {
21
+ self.delta('tilt', alpha);
22
+ self.clearCache('fillStyle');
23
+ self.invalidate();
24
+ });
25
+ }
26
+ _draw_pattern(ctx) {
27
+ var { width, height, left, top } = this.bounds;
28
+ var { tilt = 0, wheelSize = 3 } = this.model;
29
+ tilt += this.delta('tilt') || 0;
30
+ tilt %= 3;
31
+ tilt -= 1;
32
+ var color = FILL_STYLES[this.value] || FILL_STYLES[0];
33
+ var stroke = STROKE_STYLES[this.value] || STROKE_STYLES[0];
34
+ var lineWidth = 1;
35
+ var pattern_size = wheelSize * 10 || Math.min(width / 5, height / 5);
36
+ ctx.beginPath();
37
+ ctx.fillStyle = color;
38
+ ctx.rect(left, top, width, height);
39
+ ctx.fill();
40
+ ctx.strokeStyle = stroke;
41
+ ctx.lineWidth = lineWidth;
42
+ this._draw_wheel(ctx, pattern_size, tilt);
43
+ }
44
+ _draw_circle(ctx, size) {
45
+ var { width, height } = this.bounds;
46
+ var offsetX = 0, offsetY = 0;
47
+ while (offsetY < height) {
48
+ offsetX = 0;
49
+ while (offsetX < width) {
50
+ ctx.moveTo(offsetX + size / 2 + size / 3, offsetY + size / 2);
51
+ ctx.ellipse(offsetX + size / 2, offsetY + size / 2, size / 3, size / 3, 0, 0, 2 * Math.PI, false);
52
+ offsetX += size;
53
+ }
54
+ offsetY += size;
55
+ }
56
+ ctx.stroke();
57
+ }
58
+ _draw_inner(ctx, size, tilt) {
59
+ var { width, height } = this.bounds;
60
+ var offsetX = 0, offsetY = 0;
61
+ while (offsetY < height) {
62
+ offsetX = 0;
63
+ while (offsetX < width) {
64
+ ctx.translate(offsetX, offsetY);
65
+ ctx.beginPath();
66
+ ctx.translate(size / 2, size / 2);
67
+ ctx.rotate(tilt);
68
+ ctx.moveTo(-size / 6, -size / 6);
69
+ ctx.lineTo(-size / 6, size / 6);
70
+ ctx.moveTo(size / 6, -size / 6);
71
+ ctx.lineTo(size / 6, size / 6);
72
+ ctx.stroke();
73
+ ctx.rotate(-tilt);
74
+ ctx.translate(-size / 2, -size / 2);
75
+ ctx.translate(-offsetX, -offsetY);
76
+ offsetX += size;
77
+ }
78
+ offsetY += size;
79
+ }
80
+ }
81
+ _draw_wheel(ctx, size, tilt) {
82
+ var { left, top } = this.bounds;
83
+ ctx.beginPath();
84
+ ctx.translate(left, top);
85
+ this._draw_circle(ctx, size);
86
+ this._draw_inner(ctx, size, tilt);
87
+ }
88
+ };
89
+ Component.memoize(A.prototype, 'fillStyle', false);
90
+ return A;
91
+ };
92
+ //# sourceMappingURL=mixin-wheel-sorter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mixin-wheel-sorter.js","sourceRoot":"","sources":["../src/mixin-wheel-sorter.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAS,SAAS,EAAE,WAAW,EAAE,MAAM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AAC,IAAI,CAAC,CAAA;oBACjB,GAAG,CAAC,SAAS,CAAC,CAAC,IAAI,GAAG,CAAC,EAAE,CAAC,IAAI,GAAG,CAAC,CAAC,CAAA;oBACnC,GAAG,CAAC,SAAS,CAAC,CAAC,OAAO,EAAE,CAAC,OAAO,CAAC,CAAA;oBAEjC,OAAO,IAAI,IAAI,CAAA;iBAChB;gBACD,OAAO,IAAI,IAAI,CAAA;aAChB;QACH,CAAC;QAED,WAAW,CAAC,GAA6B,EAAE,IAAY,EAAE,IAAY;YACnE,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC,MAAM,CAAA;YAE/B,GAAG,CAAC,SAAS,EAAE,CAAA;YACf,GAAG,CAAC,SAAS,CAAC,IAAI,EAAE,GAAG,CAAC,CAAA;YACxB,IAAI,CAAC,YAAY,CAAC,GAAG,EAAE,IAAI,CAAC,CAAA;YAC5B,IAAI,CAAC,WAAW,CAAC,GAAG,EAAE,IAAI,EAAE,IAAI,CAAC,CAAA;QACnC,CAAC;KACF,CAAA;IAED,SAAS,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS,EAAE,WAAW,EAAE,KAAK,CAAC,CAAA;IAElD,OAAO,CAAC,CAAA;AACV,CAAC,CAAA","sourcesContent":["/*\n * Copyright © HatioLab Inc. All rights reserved.\n */\nimport { Class, Component, ValueHolder } from '@hatiolab/things-scene'\n\nconst FILL_STYLES = ['#ccc', '#afd0f1', '#ffba00', '#e9746b'] // IDLE, RUN, WARN, ERROR\nconst STROKE_STYLES = ['#999', '#87b1db', '#d96f21', '#a73928'] // IDLE, RUN, WARN, ERROR\n\nexport default (superclass: Class) => {\n var A = class extends ValueHolder(superclass) {\n animOnState() {\n if (this.value !== 1 || this.disposed) return\n\n var self = this\n\n var alpha = Math.floor(Math.random() * 100)\n if (alpha < 10) alpha = 2\n else if (alpha > 90) alpha = 1\n else alpha = 0\n\n requestAnimationFrame(function () {\n self.delta('tilt', alpha)\n self.clearCache('fillStyle')\n self.invalidate()\n })\n }\n\n _draw_pattern(ctx: CanvasRenderingContext2D) {\n var { width, height, left, top } = this.bounds\n\n var { tilt = 0, wheelSize = 3 } = this.model\n\n tilt += this.delta('tilt') || 0\n tilt %= 3\n tilt -= 1\n\n var color = FILL_STYLES[this.value] || FILL_STYLES[0]\n var stroke = STROKE_STYLES[this.value] || STROKE_STYLES[0]\n var lineWidth = 1\n\n var pattern_size = wheelSize * 10 || Math.min(width / 5, height / 5)\n\n ctx.beginPath()\n ctx.fillStyle = color\n ctx.rect(left, top, width, height)\n ctx.fill()\n\n ctx.strokeStyle = stroke\n ctx.lineWidth = lineWidth\n\n this._draw_wheel(ctx, pattern_size, tilt)\n }\n\n _draw_circle(ctx: CanvasRenderingContext2D, size: number) {\n var { width, height } = this.bounds\n\n var offsetX = 0,\n offsetY = 0\n\n while (offsetY < height) {\n offsetX = 0\n while (offsetX < width) {\n ctx.moveTo(offsetX + size / 2 + size / 3, offsetY + size / 2)\n ctx.ellipse(offsetX + size / 2, offsetY + size / 2, size / 3, size / 3, 0, 0, 2 * Math.PI, false)\n\n offsetX += size\n }\n offsetY += size\n }\n\n ctx.stroke()\n }\n\n _draw_inner(ctx: CanvasRenderingContext2D, size: number, tilt: number) {\n var { width, height } = this.bounds\n\n var offsetX = 0,\n offsetY = 0\n\n while (offsetY < height) {\n offsetX = 0\n while (offsetX < width) {\n ctx.translate(offsetX, offsetY)\n ctx.beginPath()\n ctx.translate(size / 2, size / 2)\n ctx.rotate(tilt)\n\n ctx.moveTo(-size / 6, -size / 6)\n ctx.lineTo(-size / 6, size / 6)\n ctx.moveTo(size / 6, -size / 6)\n ctx.lineTo(size / 6, size / 6)\n\n ctx.stroke()\n ctx.rotate(-tilt)\n ctx.translate(-size / 2, -size / 2)\n ctx.translate(-offsetX, -offsetY)\n\n offsetX += size\n }\n offsetY += size\n }\n }\n\n _draw_wheel(ctx: CanvasRenderingContext2D, size: number, tilt: number) {\n var { left, top } = this.bounds\n\n ctx.beginPath()\n ctx.translate(left, top)\n this._draw_circle(ctx, size)\n this._draw_inner(ctx, size, tilt)\n }\n }\n\n Component.memoize(A.prototype, 'fillStyle', false)\n\n return A\n}\n"]}
@@ -0,0 +1,28 @@
1
+ declare const Scanner_base: {
2
+ new (...args: any[]): {
3
+ [x: string]: any;
4
+ dispose(): void;
5
+ readonly fillStyle: {
6
+ image: any;
7
+ offsetX: number;
8
+ offsetY: number;
9
+ type: string;
10
+ fitPattern: boolean;
11
+ };
12
+ };
13
+ };
14
+ export default class Scanner extends Scanner_base {
15
+ get nature(): {
16
+ mutable: boolean;
17
+ resizable: boolean;
18
+ rotatable: boolean;
19
+ properties: {
20
+ type: string;
21
+ label: string;
22
+ name: string;
23
+ }[];
24
+ };
25
+ render(ctx: CanvasRenderingContext2D): void;
26
+ is3dish(): boolean;
27
+ }
28
+ export {};
@@ -0,0 +1,46 @@
1
+ import { Component, RectPath, Shape } from '@hatiolab/things-scene';
2
+ /*
3
+ * Copyright © HatioLab Inc. All rights reserved.
4
+ */
5
+ import MixinScanner from './mixin-scanner';
6
+ const NATURE = {
7
+ mutable: false,
8
+ resizable: true,
9
+ rotatable: true,
10
+ properties: [
11
+ {
12
+ type: 'number',
13
+ label: 'value',
14
+ name: 'value'
15
+ }
16
+ ]
17
+ };
18
+ const STAT_IDLE = 0;
19
+ const STAT_RUN = 1;
20
+ const STAT_CHUTE_FULL = 2;
21
+ const STAT_ERROR = 3;
22
+ export default class Scanner extends MixinScanner(RectPath(Shape)) {
23
+ get nature() {
24
+ return NATURE;
25
+ }
26
+ render(ctx) {
27
+ var { width, height, left, top } = this.model;
28
+ var radius = width / 10;
29
+ ctx.beginPath();
30
+ ctx.moveTo(left + radius, top);
31
+ ctx.lineTo(left + width - radius, top);
32
+ ctx.quadraticCurveTo(left + width, top, left + width, top + radius);
33
+ ctx.lineTo(left + width, top + height - radius);
34
+ ctx.quadraticCurveTo(left + width, top + height, left + width - radius, top + height);
35
+ ctx.lineTo(left + radius, top + height);
36
+ ctx.quadraticCurveTo(left, top + height, left, top + height - radius);
37
+ ctx.lineTo(left, top + radius);
38
+ ctx.quadraticCurveTo(left, top, left + radius, top);
39
+ ctx.clip();
40
+ }
41
+ is3dish() {
42
+ return false;
43
+ }
44
+ }
45
+ Component.register('scanner', Scanner);
46
+ //# sourceMappingURL=scanner.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"scanner.js","sourceRoot":"","sources":["../src/scanner.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAA;AAEnE;;GAEG;AACH,OAAO,YAAY,MAAM,iBAAiB,CAAA;AAE1C,MAAM,MAAM,GAAG;IACb,OAAO,EAAE,KAAK;IACd,SAAS,EAAE,IAAI;IACf,SAAS,EAAE,IAAI;IACf,UAAU,EAAE;QACV;YACE,IAAI,EAAE,QAAQ;YACd,KAAK,EAAE,OAAO;YACd,IAAI,EAAE,OAAO;SACd;KACF;CACF,CAAA;AAED,MAAM,SAAS,GAAG,CAAC,CAAA;AACnB,MAAM,QAAQ,GAAG,CAAC,CAAA;AAClB,MAAM,eAAe,GAAG,CAAC,CAAA;AACzB,MAAM,UAAU,GAAG,CAAC,CAAA;AAEpB,MAAM,CAAC,OAAO,OAAO,OAAQ,SAAQ,YAAY,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;IAChE,IAAI,MAAM;QACR,OAAO,MAAM,CAAA;IACf,CAAC;IAED,MAAM,CAAC,GAA6B;QAClC,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC,KAAK,CAAA;QAE7C,IAAI,MAAM,GAAG,KAAK,GAAG,EAAE,CAAA;QAEvB,GAAG,CAAC,SAAS,EAAE,CAAA;QACf,GAAG,CAAC,MAAM,CAAC,IAAI,GAAG,MAAM,EAAE,GAAG,CAAC,CAAA;QAC9B,GAAG,CAAC,MAAM,CAAC,IAAI,GAAG,KAAK,GAAG,MAAM,EAAE,GAAG,CAAC,CAAA;QACtC,GAAG,CAAC,gBAAgB,CAAC,IAAI,GAAG,KAAK,EAAE,GAAG,EAAE,IAAI,GAAG,KAAK,EAAE,GAAG,GAAG,MAAM,CAAC,CAAA;QACnE,GAAG,CAAC,MAAM,CAAC,IAAI,GAAG,KAAK,EAAE,GAAG,GAAG,MAAM,GAAG,MAAM,CAAC,CAAA;QAC/C,GAAG,CAAC,gBAAgB,CAAC,IAAI,GAAG,KAAK,EAAE,GAAG,GAAG,MAAM,EAAE,IAAI,GAAG,KAAK,GAAG,MAAM,EAAE,GAAG,GAAG,MAAM,CAAC,CAAA;QACrF,GAAG,CAAC,MAAM,CAAC,IAAI,GAAG,MAAM,EAAE,GAAG,GAAG,MAAM,CAAC,CAAA;QACvC,GAAG,CAAC,gBAAgB,CAAC,IAAI,EAAE,GAAG,GAAG,MAAM,EAAE,IAAI,EAAE,GAAG,GAAG,MAAM,GAAG,MAAM,CAAC,CAAA;QACrE,GAAG,CAAC,MAAM,CAAC,IAAI,EAAE,GAAG,GAAG,MAAM,CAAC,CAAA;QAC9B,GAAG,CAAC,gBAAgB,CAAC,IAAI,EAAE,GAAG,EAAE,IAAI,GAAG,MAAM,EAAE,GAAG,CAAC,CAAA;QACnD,GAAG,CAAC,IAAI,EAAE,CAAA;IACZ,CAAC;IAED,OAAO;QACL,OAAO,KAAK,CAAA;IACd,CAAC;CACF;AAED,SAAS,CAAC,QAAQ,CAAC,SAAS,EAAE,OAAc,CAAC,CAAA","sourcesContent":["import { Component, RectPath, Shape } from '@hatiolab/things-scene'\n\n/*\n * Copyright © HatioLab Inc. All rights reserved.\n */\nimport MixinScanner from './mixin-scanner'\n\nconst NATURE = {\n mutable: false,\n resizable: true,\n rotatable: true,\n properties: [\n {\n type: 'number',\n label: 'value',\n name: 'value'\n }\n ]\n}\n\nconst STAT_IDLE = 0\nconst STAT_RUN = 1\nconst STAT_CHUTE_FULL = 2\nconst STAT_ERROR = 3\n\nexport default class Scanner extends MixinScanner(RectPath(Shape)) {\n get nature() {\n return NATURE\n }\n\n render(ctx: CanvasRenderingContext2D) {\n var { width, height, left, top } = this.model\n\n var radius = width / 10\n\n ctx.beginPath()\n ctx.moveTo(left + radius, top)\n ctx.lineTo(left + width - radius, top)\n ctx.quadraticCurveTo(left + width, top, left + width, top + radius)\n ctx.lineTo(left + width, top + height - radius)\n ctx.quadraticCurveTo(left + width, top + height, left + width - radius, top + height)\n ctx.lineTo(left + radius, top + height)\n ctx.quadraticCurveTo(left, top + height, left, top + height - radius)\n ctx.lineTo(left, top + radius)\n ctx.quadraticCurveTo(left, top, left + radius, top)\n ctx.clip()\n }\n\n is3dish() {\n return false\n }\n}\n\nComponent.register('scanner', Scanner as any)\n"]}
@@ -0,0 +1,173 @@
1
+ declare const _default: ({
2
+ type: string;
3
+ description: string;
4
+ group: string;
5
+ icon: any;
6
+ model: {
7
+ type: string;
8
+ top: number;
9
+ left: number;
10
+ width: number;
11
+ height: number;
12
+ strokeStyle: string;
13
+ lineWidth: number;
14
+ lineStyle: string;
15
+ value: number;
16
+ rollWidth: number;
17
+ conveyorType?: undefined;
18
+ cx?: undefined;
19
+ cy?: undefined;
20
+ rx?: undefined;
21
+ ry?: undefined;
22
+ startAngle?: undefined;
23
+ endAngle?: undefined;
24
+ ratio?: undefined;
25
+ fillStyle?: undefined;
26
+ path?: undefined;
27
+ tilt?: undefined;
28
+ };
29
+ } | {
30
+ type: string;
31
+ description: string;
32
+ group: string;
33
+ icon: any;
34
+ model: {
35
+ type: string;
36
+ top: number;
37
+ left: number;
38
+ width: number;
39
+ height: number;
40
+ strokeStyle: string;
41
+ lineWidth: number;
42
+ lineStyle: string;
43
+ value: number;
44
+ conveyorType: number;
45
+ rollWidth: number;
46
+ cx?: undefined;
47
+ cy?: undefined;
48
+ rx?: undefined;
49
+ ry?: undefined;
50
+ startAngle?: undefined;
51
+ endAngle?: undefined;
52
+ ratio?: undefined;
53
+ fillStyle?: undefined;
54
+ path?: undefined;
55
+ tilt?: undefined;
56
+ };
57
+ } | {
58
+ type: string;
59
+ description: string;
60
+ group: string;
61
+ icon: any;
62
+ model: {
63
+ type: string;
64
+ cx: number;
65
+ cy: number;
66
+ rx: number;
67
+ ry: number;
68
+ startAngle: number;
69
+ endAngle: number;
70
+ ratio: number;
71
+ lineWidth: number;
72
+ strokeStyle: string;
73
+ value: number;
74
+ rollWidth: number;
75
+ top?: undefined;
76
+ left?: undefined;
77
+ width?: undefined;
78
+ height?: undefined;
79
+ lineStyle?: undefined;
80
+ conveyorType?: undefined;
81
+ fillStyle?: undefined;
82
+ path?: undefined;
83
+ tilt?: undefined;
84
+ };
85
+ } | {
86
+ type: string;
87
+ description: string;
88
+ group: string;
89
+ icon: any;
90
+ model: {
91
+ type: string;
92
+ top: number;
93
+ left: number;
94
+ width: number;
95
+ height: number;
96
+ lineWidth: number;
97
+ strokeStyle: string;
98
+ fillStyle: string;
99
+ value: number;
100
+ rollWidth: number;
101
+ lineStyle?: undefined;
102
+ conveyorType?: undefined;
103
+ cx?: undefined;
104
+ cy?: undefined;
105
+ rx?: undefined;
106
+ ry?: undefined;
107
+ startAngle?: undefined;
108
+ endAngle?: undefined;
109
+ ratio?: undefined;
110
+ path?: undefined;
111
+ tilt?: undefined;
112
+ };
113
+ } | {
114
+ type: string;
115
+ description: string;
116
+ group: string;
117
+ icon: any;
118
+ model: {
119
+ type: string;
120
+ lineWidth: number;
121
+ path: {
122
+ x: number;
123
+ y: number;
124
+ }[];
125
+ strokeStyle: string;
126
+ fillStyle: string;
127
+ value: number;
128
+ rollWidth: number;
129
+ top?: undefined;
130
+ left?: undefined;
131
+ width?: undefined;
132
+ height?: undefined;
133
+ lineStyle?: undefined;
134
+ conveyorType?: undefined;
135
+ cx?: undefined;
136
+ cy?: undefined;
137
+ rx?: undefined;
138
+ ry?: undefined;
139
+ startAngle?: undefined;
140
+ endAngle?: undefined;
141
+ ratio?: undefined;
142
+ tilt?: undefined;
143
+ };
144
+ } | {
145
+ type: string;
146
+ description: string;
147
+ group: string;
148
+ icon: any;
149
+ model: {
150
+ type: string;
151
+ top: number;
152
+ left: number;
153
+ width: number;
154
+ height: number;
155
+ strokeStyle: string;
156
+ fillStyle: string;
157
+ lineWidth: number;
158
+ value: number;
159
+ tilt: number;
160
+ lineStyle?: undefined;
161
+ rollWidth?: undefined;
162
+ conveyorType?: undefined;
163
+ cx?: undefined;
164
+ cy?: undefined;
165
+ rx?: undefined;
166
+ ry?: undefined;
167
+ startAngle?: undefined;
168
+ endAngle?: undefined;
169
+ ratio?: undefined;
170
+ path?: undefined;
171
+ };
172
+ })[];
173
+ export default _default;