@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 @@
1
+ declare module '*.png'
package/CHANGELOG.md ADDED
@@ -0,0 +1,12 @@
1
+ # Change Log
2
+
3
+ All notable changes to this project will be documented in this file.
4
+ See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
+
6
+ ### [0.0.11](https://github.com/things-scene/operato-scene/compare/v0.0.10...v0.0.11) (2021-12-06)
7
+
8
+
9
+ ### :rocket: New Features
10
+
11
+ * add wheel-sorter, legend, timer and compass ([dc90f73](https://github.com/things-scene/operato-scene/commit/dc90f73054424c0867a1c4a28d51da6e7fab8b85))
12
+ * add wheel-sorter, legend, timer and compass ([518950c](https://github.com/things-scene/operato-scene/commit/518950cb5476048504a415a1dd0a1fd2d4359a77))
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2021 Hearty, Oh
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,33 @@
1
+ # things-scene-wheel-sorter
2
+
3
+ ## node package를 설치한다.
4
+
5
+ `$ yarn`
6
+
7
+ ## 실행
8
+
9
+ `$ yarn serve`
10
+ `$ yarn serve:dev`
11
+
12
+ ## 포트를 바꾸려면, -p 3001 식으로 추가해준다.
13
+
14
+ `$ yarn serve`
15
+ `$ yarn serve -p 3001`
16
+
17
+ ## test in browser
18
+
19
+ http://localhost:3000
20
+
21
+ ## build
22
+
23
+ `$ yarn build`
24
+
25
+ | type | filename | for | tested |
26
+ | ---- | ------------------------------- | -------------- | ------ |
27
+ | UMD | things-scene-wheel-sorter.js | modern browser | 0 |
28
+ | UMD | things-scene-wheel-sorter-ie.js | ie 11 | 0 |
29
+ | ESM | things-scene-wheel-sorter.mjs | modern browser | 0 |
30
+
31
+ ## publish
32
+
33
+ `$ yarn publish`
Binary file
Binary file
Binary file
Binary file
Binary file
@@ -0,0 +1,41 @@
1
+ declare const ConveyorJoinTrapezoid_base: {
2
+ new (...args: any[]): {
3
+ [x: string]: any;
4
+ dispose(): void;
5
+ animOnState(): void;
6
+ readonly conveyorType: any;
7
+ readonly fillStyle: {
8
+ image: any;
9
+ offsetX: number;
10
+ offsetY: number;
11
+ type: string;
12
+ };
13
+ };
14
+ };
15
+ export default class ConveyorJoinTrapezoid extends ConveyorJoinTrapezoid_base {
16
+ get nature(): {
17
+ mutable: boolean;
18
+ resizable: boolean;
19
+ rotatable: boolean;
20
+ properties: ({
21
+ type: string;
22
+ label: string;
23
+ name: string;
24
+ property: {
25
+ options: {
26
+ display: string;
27
+ value: number;
28
+ }[];
29
+ };
30
+ } | {
31
+ type: string;
32
+ label: string;
33
+ name: string;
34
+ property?: undefined;
35
+ })[];
36
+ help: string;
37
+ };
38
+ is3dish(): boolean;
39
+ render(context: CanvasRenderingContext2D): void;
40
+ }
41
+ export {};
@@ -0,0 +1,63 @@
1
+ import { Component, Polygon } from '@hatiolab/things-scene';
2
+ /*
3
+ * Copyright © HatioLab Inc. All rights reserved.
4
+ */
5
+ import MixinRoller from './mixin-conveyor';
6
+ const NATURE = {
7
+ mutable: false,
8
+ resizable: true,
9
+ rotatable: true,
10
+ properties: [
11
+ {
12
+ type: 'select',
13
+ label: 'conveyor-type',
14
+ name: 'conveyorType',
15
+ property: {
16
+ options: [
17
+ {
18
+ display: 'Roller',
19
+ value: 0
20
+ },
21
+ {
22
+ display: 'Belt',
23
+ value: 1
24
+ }
25
+ ]
26
+ }
27
+ },
28
+ {
29
+ type: 'number',
30
+ label: 'roll-width',
31
+ name: 'rollWidth'
32
+ },
33
+ {
34
+ type: 'number',
35
+ label: 'value',
36
+ name: 'value'
37
+ },
38
+ {
39
+ type: 'checkbox',
40
+ label: 'animation',
41
+ name: 'animated'
42
+ }
43
+ ],
44
+ help: 'scene/component/conveyor-join-trapezoid'
45
+ };
46
+ const STAT_IDLE = 0;
47
+ const STAT_RUN = 1;
48
+ const STAT_CHUTE_FULL = 3;
49
+ const STAT_ERROR = 4;
50
+ export default class ConveyorJoinTrapezoid extends MixinRoller(Polygon) {
51
+ get nature() {
52
+ return NATURE;
53
+ }
54
+ is3dish() {
55
+ return false;
56
+ }
57
+ render(context) {
58
+ this.get('animated') && this.animOnState();
59
+ super.render(context);
60
+ }
61
+ }
62
+ Component.register('conveyor-join-trapezoid', ConveyorJoinTrapezoid);
63
+ //# sourceMappingURL=conveyor-join-trapezoid.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"conveyor-join-trapezoid.js","sourceRoot":"","sources":["../src/conveyor-join-trapezoid.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAA;AAE3D;;GAEG;AACH,OAAO,WAAW,MAAM,kBAAkB,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,eAAe;YACtB,IAAI,EAAE,cAAc;YACpB,QAAQ,EAAE;gBACR,OAAO,EAAE;oBACP;wBACE,OAAO,EAAE,QAAQ;wBACjB,KAAK,EAAE,CAAC;qBACT;oBACD;wBACE,OAAO,EAAE,MAAM;wBACf,KAAK,EAAE,CAAC;qBACT;iBACF;aACF;SACF;QACD;YACE,IAAI,EAAE,QAAQ;YACd,KAAK,EAAE,YAAY;YACnB,IAAI,EAAE,WAAW;SAClB;QACD;YACE,IAAI,EAAE,QAAQ;YACd,KAAK,EAAE,OAAO;YACd,IAAI,EAAE,OAAO;SACd;QACD;YACE,IAAI,EAAE,UAAU;YAChB,KAAK,EAAE,WAAW;YAClB,IAAI,EAAE,UAAU;SACjB;KACF;IACD,IAAI,EAAE,yCAAyC;CAChD,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,qBAAsB,SAAQ,WAAW,CAAC,OAAO,CAAC;IACrE,IAAI,MAAM;QACR,OAAO,MAAM,CAAA;IACf,CAAC;IAED,OAAO;QACL,OAAO,KAAK,CAAA;IACd,CAAC;IAED,MAAM,CAAC,OAAiC;QACtC,IAAI,CAAC,GAAG,CAAC,UAAU,CAAC,IAAI,IAAI,CAAC,WAAW,EAAE,CAAA;QAC1C,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,CAAA;IACvB,CAAC;CACF;AAED,SAAS,CAAC,QAAQ,CAAC,yBAAyB,EAAE,qBAA4B,CAAC,CAAA","sourcesContent":["import { Component, Polygon } from '@hatiolab/things-scene'\n\n/*\n * Copyright © HatioLab Inc. All rights reserved.\n */\nimport MixinRoller from './mixin-conveyor'\n\nconst NATURE = {\n mutable: false,\n resizable: true,\n rotatable: true,\n properties: [\n {\n type: 'select',\n label: 'conveyor-type',\n name: 'conveyorType',\n property: {\n options: [\n {\n display: 'Roller',\n value: 0\n },\n {\n display: 'Belt',\n value: 1\n }\n ]\n }\n },\n {\n type: 'number',\n label: 'roll-width',\n name: 'rollWidth'\n },\n {\n type: 'number',\n label: 'value',\n name: 'value'\n },\n {\n type: 'checkbox',\n label: 'animation',\n name: 'animated'\n }\n ],\n help: 'scene/component/conveyor-join-trapezoid'\n}\n\nconst STAT_IDLE = 0\nconst STAT_RUN = 1\nconst STAT_CHUTE_FULL = 3\nconst STAT_ERROR = 4\n\nexport default class ConveyorJoinTrapezoid extends MixinRoller(Polygon) {\n get nature() {\n return NATURE\n }\n\n is3dish() {\n return false\n }\n\n render(context: CanvasRenderingContext2D) {\n this.get('animated') && this.animOnState()\n super.render(context)\n }\n}\n\nComponent.register('conveyor-join-trapezoid', ConveyorJoinTrapezoid as any)\n"]}
@@ -0,0 +1,49 @@
1
+ import { Component } from '@hatiolab/things-scene';
2
+ declare const ConveyorJoin_base: {
3
+ new (...args: any[]): {
4
+ [x: string]: any;
5
+ dispose(): void;
6
+ animOnState(): void;
7
+ readonly conveyorType: any;
8
+ readonly fillStyle: {
9
+ image: any;
10
+ offsetX: number;
11
+ offsetY: number;
12
+ type: string;
13
+ };
14
+ };
15
+ };
16
+ export default class ConveyorJoin extends ConveyorJoin_base {
17
+ get nature(): {
18
+ mutable: boolean;
19
+ resizable: boolean;
20
+ rotatable: boolean;
21
+ properties: ({
22
+ type: string;
23
+ label: string;
24
+ name: string;
25
+ property: {
26
+ options: {
27
+ display: string;
28
+ value: number;
29
+ }[];
30
+ };
31
+ } | {
32
+ type: string;
33
+ label: string;
34
+ name: string;
35
+ property?: undefined;
36
+ })[];
37
+ help: string;
38
+ };
39
+ is3dish(): boolean;
40
+ render(ctx: CanvasRenderingContext2D): void;
41
+ get controls(): {
42
+ x: any;
43
+ y: any;
44
+ handler: {
45
+ ondragmove: (point: import("@hatiolab/things-scene").DIMENSION, index: number, component: Component) => void;
46
+ };
47
+ }[];
48
+ }
49
+ export {};
@@ -0,0 +1,142 @@
1
+ import { Component, Donut } from '@hatiolab/things-scene';
2
+ /*
3
+ * Copyright © HatioLab Inc. All rights reserved.
4
+ */
5
+ import MixinRoller from './mixin-conveyor';
6
+ const NATURE = {
7
+ mutable: false,
8
+ resizable: true,
9
+ rotatable: true,
10
+ properties: [
11
+ {
12
+ type: 'select',
13
+ label: 'conveyor-type',
14
+ name: 'conveyorType',
15
+ property: {
16
+ options: [
17
+ {
18
+ display: 'Roller',
19
+ value: 0
20
+ },
21
+ {
22
+ display: 'Belt',
23
+ value: 1
24
+ }
25
+ ]
26
+ }
27
+ },
28
+ {
29
+ type: 'angle',
30
+ label: 'start-angle',
31
+ name: 'startAngle'
32
+ },
33
+ {
34
+ type: 'angle',
35
+ label: 'end-angle',
36
+ name: 'endAngle'
37
+ },
38
+ {
39
+ type: 'number',
40
+ label: 'ratio',
41
+ name: 'ratio'
42
+ },
43
+ {
44
+ type: 'number',
45
+ label: 'roll-width',
46
+ name: 'rollWidth'
47
+ },
48
+ {
49
+ type: 'number',
50
+ label: 'value',
51
+ name: 'value'
52
+ },
53
+ {
54
+ type: 'checkbox',
55
+ label: 'animation',
56
+ name: 'animated'
57
+ }
58
+ ],
59
+ help: 'scene/component/conveyor-join'
60
+ };
61
+ const RADIAN = 0.0174533 / Math.PI;
62
+ var controlHandler = {
63
+ ondragmove: function (point, index, component) {
64
+ var { cx, rx } = component.model;
65
+ var transcoorded = component.transcoordP2S(point.x, point.y);
66
+ var ratio = ((transcoorded.x - cx) / rx) * 100;
67
+ ratio = ratio >= 100 || ratio <= -100 ? 100 : Math.abs(ratio);
68
+ component.set({ ratio });
69
+ }
70
+ };
71
+ var antiClockWiseControlHandler = {
72
+ ondragmove: function (point, index, component) {
73
+ var { cx, cy } = component.model;
74
+ var transcoorded = component.transcoordP2S(point.x, point.y);
75
+ var theta = Math.atan2(-(transcoorded.y - cy), transcoorded.x - cx);
76
+ if (theta > 0)
77
+ if (theta <= Math.PI / 2)
78
+ theta = Math.PI / 2;
79
+ if (theta < 0)
80
+ if (theta >= -Math.PI / 2)
81
+ theta = -Math.PI / 2;
82
+ var startAngle = -theta + Math.PI / 2;
83
+ component.set({ startAngle });
84
+ }
85
+ };
86
+ var clockwiseControlHandler = {
87
+ ondragmove: function (point, index, component) {
88
+ var { cx, cy } = component.model;
89
+ var transcoorded = component.transcoordP2S(point.x, point.y);
90
+ var theta = Math.atan2(-(transcoorded.y - cy), transcoorded.x - cx);
91
+ if (theta > 0)
92
+ if (theta >= Math.PI / 2)
93
+ theta = Math.PI / 2;
94
+ if (theta < 0)
95
+ if (theta <= -Math.PI / 2)
96
+ theta = -Math.PI / 2;
97
+ var endAngle = -theta + Math.PI / 2;
98
+ component.set({ endAngle });
99
+ }
100
+ };
101
+ export default class ConveyorJoin extends MixinRoller(Donut) {
102
+ get nature() {
103
+ return NATURE;
104
+ }
105
+ is3dish() {
106
+ return false;
107
+ }
108
+ render(ctx) {
109
+ var { ratio = 50, cx, cy, rx, ry, startAngle = 0, endAngle = Math.PI / 2, animated = false } = this.model;
110
+ animated && this.animOnState();
111
+ ctx.beginPath();
112
+ startAngle -= Math.PI / 2;
113
+ endAngle -= Math.PI / 2;
114
+ ctx.ellipse(cx, cy, Math.abs(rx), Math.abs(ry), 0, startAngle, endAngle);
115
+ // ctx.moveTo(cx + (rx / 100) * ratio ,cy);
116
+ // 맨 마지막 속성이 true면 원의 범위만큼 공백이 됨
117
+ ctx.ellipse(cx, cy, Math.abs((rx / 100) * ratio), Math.abs((ry / 100) * ratio), 0, endAngle, startAngle, true);
118
+ ctx.lineTo(rx * Math.cos(startAngle) + cx, rx * Math.sin(startAngle) + cy);
119
+ }
120
+ get controls() {
121
+ var { cx, cy, rx, ratio, startAngle, endAngle } = this.model;
122
+ var controls = [];
123
+ controls.push({
124
+ x: cx + ((rx + (rx * ratio) / 100) / 2) * Math.sin(startAngle),
125
+ y: cy - ((rx + (rx * ratio) / 100) / 2) * Math.cos(startAngle),
126
+ handler: antiClockWiseControlHandler
127
+ });
128
+ controls.push({
129
+ x: cx + ((rx + (rx * ratio) / 100) / 2) * Math.sin(endAngle),
130
+ y: cy - ((rx + (rx * ratio) / 100) / 2) * Math.cos(endAngle),
131
+ handler: clockwiseControlHandler
132
+ });
133
+ controls.push({
134
+ x: cx + (rx / 100) * ratio,
135
+ y: cy,
136
+ handler: controlHandler
137
+ });
138
+ return controls;
139
+ }
140
+ }
141
+ Component.register('conveyor-join', ConveyorJoin);
142
+ //# sourceMappingURL=conveyor-join.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"conve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,EAAE,EAAE,GAAG,CAAC,CAAC,EAAE,GAAG,CAAC,EAAE,GAAG,KAAK,CAAC,GAAG,GAAG,CAAC,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,UAAU,CAAC;YAC9D,CAAC,EAAE,EAAE,GAAG,CAAC,CAAC,EAAE,GAAG,CAAC,EAAE,GAAG,KAAK,CAAC,GAAG,GAAG,CAAC,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,UAAU,CAAC;YAC9D,OAAO,EAAE,2BAA2B;SACrC,CAAC,CAAA;QAEF,QAAQ,CAAC,IAAI,CAAC;YACZ,CAAC,EAAE,EAAE,GAAG,CAAC,CAAC,EAAE,GAAG,CAAC,EAAE,GAAG,KAAK,CAAC,GAAG,GAAG,CAAC,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC;YAC5D,CAAC,EAAE,EAAE,GAAG,CAAC,CAAC,EAAE,GAAG,CAAC,EAAE,GAAG,KAAK,CAAC,GAAG,GAAG,CAAC,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC;YAC5D,OAAO,EAAE,uBAAuB;SACjC,CAAC,CAAA;QAEF,QAAQ,CAAC,IAAI,CAAC;YACZ,CAAC,EAAE,EAAE,GAAG,CAAC,EAAE,GAAG,GAAG,CAAC,GAAG,KAAK;YAC1B,CAAC,EAAE,EAAE;YACL,OAAO,EAAE,cAAc;SACxB,CAAC,CAAA;QAEF,OAAO,QAAQ,CAAA;IACjB,CAAC;CACF;AAED,SAAS,CAAC,QAAQ,CAAC,eAAe,EAAE,YAAmB,CAAC,CAAA","sourcesContent":["import { Component, Donut, POSITION, Rect } from '@hatiolab/things-scene'\n\n/*\n * Copyright © HatioLab Inc. All rights reserved.\n */\nimport MixinRoller from './mixin-conveyor'\n\nconst NATURE = {\n mutable: false,\n resizable: true,\n rotatable: true,\n properties: [\n {\n type: 'select',\n label: 'conveyor-type',\n name: 'conveyorType',\n property: {\n options: [\n {\n display: 'Roller',\n value: 0\n },\n {\n display: 'Belt',\n value: 1\n }\n ]\n }\n },\n {\n type: 'angle',\n label: 'start-angle',\n name: 'startAngle'\n },\n {\n type: 'angle',\n label: 'end-angle',\n name: 'endAngle'\n },\n {\n type: 'number',\n label: 'ratio',\n name: 'ratio'\n },\n {\n type: 'number',\n label: 'roll-width',\n name: 'rollWidth'\n },\n {\n type: 'number',\n label: 'value',\n name: 'value'\n },\n {\n type: 'checkbox',\n label: 'animation',\n name: 'animated'\n }\n ],\n help: 'scene/component/conveyor-join'\n}\n\nconst RADIAN = 0.0174533 / Math.PI\n\nvar controlHandler = {\n ondragmove: function (point: POSITION, index: number, component: Component) {\n var { cx, rx } = component.model\n\n var transcoorded = component.transcoordP2S(point.x, point.y)\n\n var ratio = ((transcoorded.x - cx) / rx) * 100\n\n ratio = ratio >= 100 || ratio <= -100 ? 100 : Math.abs(ratio)\n\n component.set({ ratio })\n }\n}\n\nvar antiClockWiseControlHandler = {\n ondragmove: function (point: POSITION, index: number, component: Component) {\n var { cx, cy } = component.model\n\n var transcoorded = component.transcoordP2S(point.x, point.y)\n\n var theta = Math.atan2(-(transcoorded.y - cy), transcoorded.x - cx)\n\n if (theta > 0) if (theta <= Math.PI / 2) theta = Math.PI / 2\n if (theta < 0) if (theta >= -Math.PI / 2) theta = -Math.PI / 2\n\n var startAngle = -theta + Math.PI / 2\n\n component.set({ startAngle })\n }\n}\n\nvar clockwiseControlHandler = {\n ondragmove: function (point: POSITION, index: number, component: Component) {\n var { cx, cy } = component.model\n\n var transcoorded = component.transcoordP2S(point.x, point.y)\n\n var theta = Math.atan2(-(transcoorded.y - cy), transcoorded.x - cx)\n\n if (theta > 0) if (theta >= Math.PI / 2) theta = Math.PI / 2\n if (theta < 0) if (theta <= -Math.PI / 2) theta = -Math.PI / 2\n\n var endAngle = -theta + Math.PI / 2\n\n component.set({ endAngle })\n }\n}\n\nexport default class ConveyorJoin extends MixinRoller(Donut) {\n get nature() {\n return NATURE\n }\n\n is3dish() {\n return false\n }\n\n render(ctx: CanvasRenderingContext2D) {\n var { ratio = 50, cx, cy, rx, ry, startAngle = 0, endAngle = Math.PI / 2, animated = false } = this.model\n\n animated && this.animOnState()\n\n ctx.beginPath()\n\n startAngle -= Math.PI / 2\n endAngle -= Math.PI / 2\n\n ctx.ellipse(cx, cy, Math.abs(rx), Math.abs(ry), 0, startAngle, endAngle)\n\n // ctx.moveTo(cx + (rx / 100) * ratio ,cy);\n // 맨 마지막 속성이 true면 원의 범위만큼 공백이 됨\n\n ctx.ellipse(cx, cy, Math.abs((rx / 100) * ratio), Math.abs((ry / 100) * ratio), 0, endAngle, startAngle, true)\n\n ctx.lineTo(rx * Math.cos(startAngle) + cx, rx * Math.sin(startAngle) + cy)\n }\n\n get controls() {\n var { cx, cy, rx, ratio, startAngle, endAngle } = this.model\n\n var controls = []\n\n controls.push({\n x: cx + ((rx + (rx * ratio) / 100) / 2) * Math.sin(startAngle),\n y: cy - ((rx + (rx * ratio) / 100) / 2) * Math.cos(startAngle),\n handler: antiClockWiseControlHandler\n })\n\n controls.push({\n x: cx + ((rx + (rx * ratio) / 100) / 2) * Math.sin(endAngle),\n y: cy - ((rx + (rx * ratio) / 100) / 2) * Math.cos(endAngle),\n handler: clockwiseControlHandler\n })\n\n controls.push({\n x: cx + (rx / 100) * ratio,\n y: cy,\n handler: controlHandler\n })\n\n return controls\n }\n}\n\nComponent.register('conveyor-join', ConveyorJoin as any)\n"]}
@@ -0,0 +1,41 @@
1
+ declare const Conveyor_base: {
2
+ new (...args: any[]): {
3
+ [x: string]: any;
4
+ dispose(): void;
5
+ animOnState(): void;
6
+ readonly conveyorType: any;
7
+ readonly fillStyle: {
8
+ image: any;
9
+ offsetX: number;
10
+ offsetY: number;
11
+ type: string;
12
+ };
13
+ };
14
+ };
15
+ export default class Conveyor extends Conveyor_base {
16
+ get nature(): {
17
+ mutable: boolean;
18
+ resizable: boolean;
19
+ rotatable: boolean;
20
+ properties: ({
21
+ type: string;
22
+ label: string;
23
+ name: string;
24
+ property: {
25
+ options: {
26
+ display: string;
27
+ value: number;
28
+ }[];
29
+ };
30
+ } | {
31
+ type: string;
32
+ label: string;
33
+ name: string;
34
+ property?: undefined;
35
+ })[];
36
+ help: string;
37
+ };
38
+ render(ctx: CanvasRenderingContext2D): void;
39
+ is3dish(): boolean;
40
+ }
41
+ export {};
@@ -0,0 +1,62 @@
1
+ import { Component, RectPath, Shape } from '@hatiolab/things-scene';
2
+ /*
3
+ * Copyright © HatioLab Inc. All rights reserved.
4
+ */
5
+ import MixinRoller from './mixin-conveyor';
6
+ const NATURE = {
7
+ mutable: false,
8
+ resizable: true,
9
+ rotatable: true,
10
+ properties: [
11
+ {
12
+ type: 'select',
13
+ label: 'conveyor-type',
14
+ name: 'conveyorType',
15
+ property: {
16
+ options: [
17
+ {
18
+ display: 'Roller',
19
+ value: 0
20
+ },
21
+ {
22
+ display: 'Belt',
23
+ value: 1
24
+ }
25
+ ]
26
+ }
27
+ },
28
+ {
29
+ type: 'number',
30
+ label: 'roll-width',
31
+ name: 'rollWidth'
32
+ },
33
+ {
34
+ type: 'number',
35
+ label: 'value',
36
+ name: 'value'
37
+ },
38
+ {
39
+ type: 'checkbox',
40
+ label: 'animation',
41
+ name: 'animated'
42
+ }
43
+ ],
44
+ help: 'scene/component/conveyor'
45
+ };
46
+ export default class Conveyor extends MixinRoller(RectPath(Shape)) {
47
+ get nature() {
48
+ return NATURE;
49
+ }
50
+ render(ctx) {
51
+ var { width, height, left, top, animated = false } = this.model;
52
+ animated && this.animOnState();
53
+ ctx.beginPath();
54
+ ctx.rect(left, top, width, height);
55
+ }
56
+ is3dish() {
57
+ return false;
58
+ }
59
+ }
60
+ Component.register('conveyor', Conveyor);
61
+ Component.register('conveyor-belt', Conveyor);
62
+ //# sourceMappingURL=conveyor.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"conveyor.js","sourceRoot":"","sources":["../src/conveyor.ts"],"names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,CAAA;IACpC,CAAC;IAED,OAAO;QACL,OAAO,KAAK,CAAA;IACd,CAAC;CACF;AAED,SAAS,CAAC,QAAQ,CAAC,UAAU,EAAE,QAAe,CAAC,CAAA;AAC/C,SAAS,CAAC,QAAQ,CAAC,eAAe,EAAE,QAAe,CAAC,CAAA","sourcesContent":["import { Component, RectPath, Shape } from '@hatiolab/things-scene'\n\n/*\n * Copyright © HatioLab Inc. All rights reserved.\n */\nimport MixinRoller from './mixin-conveyor'\n\nconst NATURE = {\n mutable: false,\n resizable: true,\n rotatable: true,\n properties: [\n {\n type: 'select',\n label: 'conveyor-type',\n name: 'conveyorType',\n property: {\n options: [\n {\n display: 'Roller',\n value: 0\n },\n {\n display: 'Belt',\n value: 1\n }\n ]\n }\n },\n {\n type: 'number',\n label: 'roll-width',\n name: 'rollWidth'\n },\n {\n type: 'number',\n label: 'value',\n name: 'value'\n },\n {\n type: 'checkbox',\n label: 'animation',\n name: 'animated'\n }\n ],\n help: 'scene/component/conveyor'\n}\n\nexport default class Conveyor extends MixinRoller(RectPath(Shape)) {\n get nature() {\n return NATURE\n }\n\n render(ctx: CanvasRenderingContext2D) {\n var { width, height, left, top, animated = false } = this.model\n\n animated && this.animOnState()\n\n ctx.beginPath()\n ctx.rect(left, top, width, height)\n }\n\n is3dish() {\n return false\n }\n}\n\nComponent.register('conveyor', Conveyor as any)\nComponent.register('conveyor-belt', Conveyor as any)\n"]}
@@ -0,0 +1,5 @@
1
+ export { default as Conveyor } from './conveyor';
2
+ export { default as ConveyorJoin } from './conveyor-join';
3
+ export { default as ConveyorJoinTrapezoid } from './conveyor-join-trapezoid';
4
+ export { default as WheelSorter } from './wheel-sorter';
5
+ export { default as Scanner } from './scanner';
package/dist/index.js ADDED
@@ -0,0 +1,9 @@
1
+ /*
2
+ * Copyright © HatioLab Inc. All rights reserved.
3
+ */
4
+ export { default as Conveyor } from './conveyor';
5
+ export { default as ConveyorJoin } from './conveyor-join';
6
+ export { default as ConveyorJoinTrapezoid } from './conveyor-join-trapezoid';
7
+ export { default as WheelSorter } from './wheel-sorter';
8
+ export { default as Scanner } from './scanner';
9
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,YAAY,CAAA;AAChD,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,iBAAiB,CAAA;AACzD,OAAO,EAAE,OAAO,IAAI,qBAAqB,EAAE,MAAM,2BAA2B,CAAA;AAC5E,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,gBAAgB,CAAA;AACvD,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,MAAM,WAAW,CAAA","sourcesContent":["/*\n * Copyright © HatioLab Inc. All rights reserved.\n */\nexport { default as Conveyor } from './conveyor'\nexport { default as ConveyorJoin } from './conveyor-join'\nexport { default as ConveyorJoinTrapezoid } from './conveyor-join-trapezoid'\nexport { default as WheelSorter } from './wheel-sorter'\nexport { default as Scanner } from './scanner'\n"]}
@@ -0,0 +1,16 @@
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
+ animOnState(): void;
7
+ readonly conveyorType: any;
8
+ readonly fillStyle: {
9
+ image: any;
10
+ offsetX: number;
11
+ offsetY: number;
12
+ type: string;
13
+ };
14
+ };
15
+ };
16
+ export default _default;