@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,123 @@
1
+ import conveyor from '../../assets/conveyor.png';
2
+ import conveyorBelt from '../../assets/conveyor-belt.png';
3
+ import conveyorJoin from '../../assets/conveyor-join.png';
4
+ import conveyorJoinTrapezoid from '../../assets/conveyor-join-trapezoid.png';
5
+ import scanner from '../../assets/scanner.png';
6
+ import wheelSorter from '../../assets/wheel-sorter.png';
7
+ export default [
8
+ {
9
+ type: 'conveyor',
10
+ description: 'roller type conveyor',
11
+ group: 'warehouse',
12
+ icon: conveyor,
13
+ model: {
14
+ type: 'conveyor',
15
+ top: 350,
16
+ left: 100,
17
+ width: 500,
18
+ height: 100,
19
+ strokeStyle: '#999',
20
+ lineWidth: 1,
21
+ lineStyle: '#999',
22
+ value: 1,
23
+ rollWidth: 13
24
+ }
25
+ },
26
+ {
27
+ type: 'conveyor-belt',
28
+ description: 'belt type conveyor',
29
+ group: 'warehouse',
30
+ icon: conveyorBelt,
31
+ model: {
32
+ type: 'conveyor-belt',
33
+ top: 500,
34
+ left: 100,
35
+ width: 500,
36
+ height: 100,
37
+ strokeStyle: '#999',
38
+ lineWidth: 1,
39
+ lineStyle: '#999',
40
+ value: 1,
41
+ conveyorType: 1,
42
+ rollWidth: 13
43
+ }
44
+ },
45
+ {
46
+ type: 'conveyor-join',
47
+ description: 'join shaped conveyor',
48
+ group: 'warehouse',
49
+ icon: conveyorJoin,
50
+ model: {
51
+ type: 'conveyor-join',
52
+ cx: 100,
53
+ cy: 150,
54
+ rx: 100,
55
+ ry: 100,
56
+ startAngle: -Math.PI / 4,
57
+ endAngle: Math.PI / 4,
58
+ ratio: 34,
59
+ lineWidth: 1,
60
+ strokeStyle: 'black',
61
+ value: 2,
62
+ rollWidth: 12
63
+ }
64
+ },
65
+ {
66
+ type: 'scanner',
67
+ description: 'box scanner',
68
+ group: 'warehouse',
69
+ icon: scanner,
70
+ model: {
71
+ type: 'scanner',
72
+ top: 100,
73
+ left: 450,
74
+ width: 150,
75
+ height: 100,
76
+ lineWidth: 1,
77
+ strokeStyle: '#999',
78
+ fillStyle: 'transparent',
79
+ value: 2,
80
+ rollWidth: 3
81
+ }
82
+ },
83
+ {
84
+ type: 'conveyor-join-trapezoid',
85
+ description: 'conveyor join trapezoid',
86
+ group: 'warehouse',
87
+ icon: conveyorJoinTrapezoid,
88
+ model: {
89
+ type: 'conveyor-join-trapezoid',
90
+ lineWidth: 1,
91
+ path: [
92
+ { x: 50, y: 150 },
93
+ { x: 150, y: 150 },
94
+ { x: 150, y: 250 },
95
+ { x: 100, y: 300 },
96
+ { x: 50, y: 250 }
97
+ ],
98
+ strokeStyle: '#999',
99
+ fillStyle: 'transparent',
100
+ value: 3,
101
+ rollWidth: 10
102
+ }
103
+ },
104
+ {
105
+ type: 'wheel-sorter',
106
+ description: 'wheel sorter',
107
+ group: 'warehouse',
108
+ icon: wheelSorter,
109
+ model: {
110
+ type: 'wheel-sorter',
111
+ top: 50,
112
+ left: 200,
113
+ width: 200,
114
+ height: 200,
115
+ strokeStyle: '#999',
116
+ fillStyle: 'transparent',
117
+ lineWidth: 2,
118
+ value: 1,
119
+ tilt: 1
120
+ }
121
+ }
122
+ ];
123
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/templates/index.ts"],"names":[],"mappings":"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","sourcesContent":["import conveyor from '../../assets/conveyor.png'\nimport conveyorBelt from '../../assets/conveyor-belt.png'\nimport conveyorJoin from '../../assets/conveyor-join.png'\nimport conveyorJoinTrapezoid from '../../assets/conveyor-join-trapezoid.png'\nimport scanner from '../../assets/scanner.png'\nimport wheelSorter from '../../assets/wheel-sorter.png'\n\nexport default [\n {\n type: 'conveyor',\n description: 'roller type conveyor',\n group: 'warehouse',\n icon: conveyor,\n model: {\n type: 'conveyor',\n top: 350,\n left: 100,\n width: 500,\n height: 100,\n strokeStyle: '#999',\n lineWidth: 1,\n lineStyle: '#999',\n value: 1,\n rollWidth: 13\n }\n },\n {\n type: 'conveyor-belt',\n description: 'belt type conveyor',\n group: 'warehouse',\n icon: conveyorBelt,\n model: {\n type: 'conveyor-belt',\n top: 500,\n left: 100,\n width: 500,\n height: 100,\n strokeStyle: '#999',\n lineWidth: 1,\n lineStyle: '#999',\n value: 1,\n conveyorType: 1,\n rollWidth: 13\n }\n },\n {\n type: 'conveyor-join',\n description: 'join shaped conveyor',\n group: 'warehouse',\n icon: conveyorJoin,\n model: {\n type: 'conveyor-join',\n cx: 100,\n cy: 150,\n rx: 100,\n ry: 100,\n startAngle: -Math.PI / 4,\n endAngle: Math.PI / 4,\n ratio: 34,\n lineWidth: 1,\n strokeStyle: 'black',\n value: 2,\n rollWidth: 12\n }\n },\n {\n type: 'scanner',\n description: 'box scanner',\n group: 'warehouse',\n icon: scanner,\n model: {\n type: 'scanner',\n top: 100,\n left: 450,\n width: 150,\n height: 100,\n lineWidth: 1,\n strokeStyle: '#999',\n fillStyle: 'transparent',\n value: 2,\n rollWidth: 3\n }\n },\n {\n type: 'conveyor-join-trapezoid',\n description: 'conveyor join trapezoid',\n group: 'warehouse',\n icon: conveyorJoinTrapezoid,\n model: {\n type: 'conveyor-join-trapezoid',\n lineWidth: 1,\n path: [\n { x: 50, y: 150 },\n { x: 150, y: 150 },\n { x: 150, y: 250 },\n { x: 100, y: 300 },\n { x: 50, y: 250 }\n ],\n strokeStyle: '#999',\n fillStyle: 'transparent',\n value: 3,\n rollWidth: 10\n }\n },\n {\n type: 'wheel-sorter',\n description: 'wheel sorter',\n group: 'warehouse',\n icon: wheelSorter,\n model: {\n type: 'wheel-sorter',\n top: 50,\n left: 200,\n width: 200,\n height: 200,\n strokeStyle: '#999',\n fillStyle: 'transparent',\n lineWidth: 2,\n value: 1,\n tilt: 1\n }\n }\n]\n"]}
@@ -0,0 +1,27 @@
1
+ declare const WheelSorter_base: {
2
+ new (...args: any[]): {
3
+ [x: string]: any;
4
+ animOnState(): void;
5
+ _draw_pattern(ctx: CanvasRenderingContext2D): void;
6
+ _draw_circle(ctx: CanvasRenderingContext2D, size: number): void;
7
+ _draw_inner(ctx: CanvasRenderingContext2D, size: number, tilt: number): void;
8
+ _draw_wheel(ctx: CanvasRenderingContext2D, size: number, tilt: number): void;
9
+ };
10
+ };
11
+ export default class WheelSorter extends WheelSorter_base {
12
+ get nature(): {
13
+ mutable: boolean;
14
+ resizable: boolean;
15
+ rotatable: boolean;
16
+ properties: {
17
+ type: string;
18
+ label: string;
19
+ name: string;
20
+ }[];
21
+ help: string;
22
+ };
23
+ render(ctx: CanvasRenderingContext2D): void;
24
+ postrender(ctx: CanvasRenderingContext2D): void;
25
+ is3dish(): boolean;
26
+ }
27
+ export {};
@@ -0,0 +1,54 @@
1
+ import { Component, RectPath, Shape } from '@hatiolab/things-scene';
2
+ /*
3
+ * Copyright © HatioLab Inc. All rights reserved.
4
+ */
5
+ import MixinWheelSorter from './mixin-wheel-sorter';
6
+ const NATURE = {
7
+ mutable: false,
8
+ resizable: true,
9
+ rotatable: true,
10
+ properties: [
11
+ {
12
+ type: 'number',
13
+ label: 'tilt',
14
+ name: 'tilt'
15
+ },
16
+ {
17
+ type: 'number',
18
+ label: 'wheel-size',
19
+ name: 'wheelSize'
20
+ },
21
+ {
22
+ type: 'number',
23
+ label: 'value',
24
+ name: 'value'
25
+ },
26
+ {
27
+ type: 'checkbox',
28
+ label: 'animation',
29
+ name: 'animated'
30
+ }
31
+ ],
32
+ help: 'scene/component/wheel-sorter'
33
+ };
34
+ export default class WheelSorter extends MixinWheelSorter(RectPath(Shape)) {
35
+ get nature() {
36
+ return NATURE;
37
+ }
38
+ render(ctx) {
39
+ var { width, height, left, top, animated } = this.model;
40
+ animated && this.animOnState();
41
+ ctx.beginPath();
42
+ ctx.rect(left, top, width, height);
43
+ ctx.clip(); // bound를 벗어난 영역에도 그려지는 것을 예방.
44
+ }
45
+ postrender(ctx) {
46
+ super.postrender(ctx);
47
+ this._draw_pattern(ctx);
48
+ }
49
+ is3dish() {
50
+ return false;
51
+ }
52
+ }
53
+ Component.register('wheel-sorter', WheelSorter);
54
+ //# sourceMappingURL=wheel-sorter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"wheel-sorter.js","sourceRoot":"","sources":["../src/wheel-sorter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAA;AAEnE;;GAEG;AACH,OAAO,gBAAgB,MAAM,sBAAsB,CAAA;AAEnD,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,MAAM;YACb,IAAI,EAAE,MAAM;SACb;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,8BAA8B;CACrC,CAAA;AAED,MAAM,CAAC,OAAO,OAAO,WAAY,SAAQ,gBAAgB,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;IACxE,IAAI,MAAM;QACR,OAAO,MAAM,CAAA;IACf,CAAC;IAED,MAAM,CAAC,GAA6B;QAClC,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,EAAE,QAAQ,EAAE,GAAG,IAAI,CAAC,KAAK,CAAA;QAEvD,QAAQ,IAAI,IAAI,CAAC,WAAW,EAAE,CAAA;QAE9B,GAAG,CAAC,SAAS,EAAE,CAAA;QACf,GAAG,CAAC,IAAI,CAAC,IAAI,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,CAAC,CAAA;QAElC,GAAG,CAAC,IAAI,EAAE,CAAA,CAAC,8BAA8B;IAC3C,CAAC;IAED,UAAU,CAAC,GAA6B;QACtC,KAAK,CAAC,UAAU,CAAC,GAAG,CAAC,CAAA;QACrB,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,CAAA;IACzB,CAAC;IAED,OAAO;QACL,OAAO,KAAK,CAAA;IACd,CAAC;CACF;AAED,SAAS,CAAC,QAAQ,CAAC,cAAc,EAAE,WAAkB,CAAC,CAAA","sourcesContent":["import { Component, RectPath, Shape } from '@hatiolab/things-scene'\n\n/*\n * Copyright © HatioLab Inc. All rights reserved.\n */\nimport MixinWheelSorter from './mixin-wheel-sorter'\n\nconst NATURE = {\n mutable: false,\n resizable: true,\n rotatable: true,\n properties: [\n {\n type: 'number',\n label: 'tilt',\n name: 'tilt'\n },\n {\n type: 'number',\n label: 'wheel-size',\n name: 'wheelSize'\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/wheel-sorter'\n}\n\nexport default class WheelSorter extends MixinWheelSorter(RectPath(Shape)) {\n get nature() {\n return NATURE\n }\n\n render(ctx: CanvasRenderingContext2D) {\n var { width, height, left, top, animated } = this.model\n\n animated && this.animOnState()\n\n ctx.beginPath()\n ctx.rect(left, top, width, height)\n\n ctx.clip() // bound를 벗어난 영역에도 그려지는 것을 예방.\n }\n\n postrender(ctx: CanvasRenderingContext2D) {\n super.postrender(ctx)\n this._draw_pattern(ctx)\n }\n\n is3dish() {\n return false\n }\n}\n\nComponent.register('wheel-sorter', WheelSorter as any)\n"]}
@@ -0,0 +1,6 @@
1
+ # conveyor-join-trapezoid[ko]
2
+
3
+
4
+ ## properties
5
+
6
+ ###
@@ -0,0 +1,6 @@
1
+ # conveyor-join-trapezoid[en]
2
+
3
+
4
+ ## properties
5
+
6
+ ###
@@ -0,0 +1,6 @@
1
+ # conveyor-join-trapezoid[zh]
2
+
3
+
4
+ ## properties
5
+
6
+ ###
@@ -0,0 +1,6 @@
1
+ # conveyor-join[ko]
2
+
3
+
4
+ ## properties
5
+
6
+ ###
@@ -0,0 +1,6 @@
1
+ # conveyor-join[en]
2
+
3
+
4
+ ## properties
5
+
6
+ ###
@@ -0,0 +1,6 @@
1
+ # conveyor-join[zh]
2
+
3
+
4
+ ## properties
5
+
6
+ ###
@@ -0,0 +1,6 @@
1
+ # conveyor[ko]
2
+
3
+
4
+ ## properties
5
+
6
+ ###
@@ -0,0 +1,6 @@
1
+ # conveyor[en]
2
+
3
+
4
+ ## properties
5
+
6
+ ###
@@ -0,0 +1,6 @@
1
+ # conveyor[zh]
2
+
3
+
4
+ ## properties
5
+
6
+ ###
@@ -0,0 +1,6 @@
1
+ # wheel-sorter[ko]
2
+
3
+
4
+ ## properties
5
+
6
+ ###
@@ -0,0 +1,6 @@
1
+ # wheel-sorter[en]
2
+
3
+
4
+ ## properties
5
+
6
+ ###
@@ -0,0 +1,6 @@
1
+ # wheel-sorter[zh]
2
+
3
+
4
+ ## properties
5
+
6
+ ###
package/package.json ADDED
@@ -0,0 +1,62 @@
1
+ {
2
+ "name": "@operato/scene-wheel-sorter",
3
+ "description": "The wheel sorter component for things-scene",
4
+ "license": "MIT",
5
+ "author": "heartyoh",
6
+ "version": "0.0.11",
7
+ "main": "dist/index.js",
8
+ "module": "dist/index.js",
9
+ "things-scene": true,
10
+ "publishConfig": {
11
+ "access": "public",
12
+ "@oprato:registry": "https://registry.npmjs.org"
13
+ },
14
+ "repository": {
15
+ "type": "git",
16
+ "url": "git+https://github.com/things-scene/operato-scene.git",
17
+ "directory": "packages/wheel-sorter"
18
+ },
19
+ "scripts": {
20
+ "serve": "tsc && things-factory-dev",
21
+ "start": "tsc && concurrently -k -r \"tsc --watch --preserveWatchOutput\" \"wds\"",
22
+ "build": "tsc",
23
+ "prepublish": "tsc",
24
+ "lint": "eslint --ext .ts,.html . --ignore-path .gitignore && prettier \"**/*.ts\" --check --ignore-path .gitignore",
25
+ "format": "eslint --ext .ts,.html . --fix --ignore-path .gitignore && prettier \"**/*.ts\" --write --ignore-path .gitignore",
26
+ "migration": "things-factory-migration"
27
+ },
28
+ "dependencies": {
29
+ "@hatiolab/things-scene": "^2.7.23"
30
+ },
31
+ "devDependencies": {
32
+ "@hatiolab/prettier-config": "^1.0.0",
33
+ "@hatiolab/things-scene": "^2.7.23",
34
+ "@operato/board": "^0.2.35",
35
+ "@things-factory/builder": "^4.0.10",
36
+ "@things-factory/operato-board": "^4.0.10",
37
+ "@typescript-eslint/eslint-plugin": "^4.33.0",
38
+ "@typescript-eslint/parser": "^4.33.0",
39
+ "@web/dev-server": "^0.1.28",
40
+ "concurrently": "^5.3.0",
41
+ "eslint": "^7.32.0",
42
+ "eslint-config-prettier": "^8.3.0",
43
+ "husky": "^4.3.8",
44
+ "lint-staged": "^10.5.4",
45
+ "prettier": "^2.4.1",
46
+ "tslib": "^2.3.1",
47
+ "typescript": "^4.5.2"
48
+ },
49
+ "prettier": "@hatiolab/prettier-config",
50
+ "husky": {
51
+ "hooks": {
52
+ "pre-commit": "lint-staged"
53
+ }
54
+ },
55
+ "lint-staged": {
56
+ "*.ts": [
57
+ "eslint --fix",
58
+ "prettier --write"
59
+ ]
60
+ },
61
+ "gitHead": "1421380ee3530169c280b01a21c81af8d1b9f9c4"
62
+ }
@@ -0,0 +1,69 @@
1
+ import { Component, Polygon } from '@hatiolab/things-scene'
2
+
3
+ /*
4
+ * Copyright © HatioLab Inc. All rights reserved.
5
+ */
6
+ import MixinRoller from './mixin-conveyor'
7
+
8
+ const NATURE = {
9
+ mutable: false,
10
+ resizable: true,
11
+ rotatable: true,
12
+ properties: [
13
+ {
14
+ type: 'select',
15
+ label: 'conveyor-type',
16
+ name: 'conveyorType',
17
+ property: {
18
+ options: [
19
+ {
20
+ display: 'Roller',
21
+ value: 0
22
+ },
23
+ {
24
+ display: 'Belt',
25
+ value: 1
26
+ }
27
+ ]
28
+ }
29
+ },
30
+ {
31
+ type: 'number',
32
+ label: 'roll-width',
33
+ name: 'rollWidth'
34
+ },
35
+ {
36
+ type: 'number',
37
+ label: 'value',
38
+ name: 'value'
39
+ },
40
+ {
41
+ type: 'checkbox',
42
+ label: 'animation',
43
+ name: 'animated'
44
+ }
45
+ ],
46
+ help: 'scene/component/conveyor-join-trapezoid'
47
+ }
48
+
49
+ const STAT_IDLE = 0
50
+ const STAT_RUN = 1
51
+ const STAT_CHUTE_FULL = 3
52
+ const STAT_ERROR = 4
53
+
54
+ export default class ConveyorJoinTrapezoid extends MixinRoller(Polygon) {
55
+ get nature() {
56
+ return NATURE
57
+ }
58
+
59
+ is3dish() {
60
+ return false
61
+ }
62
+
63
+ render(context: CanvasRenderingContext2D) {
64
+ this.get('animated') && this.animOnState()
65
+ super.render(context)
66
+ }
67
+ }
68
+
69
+ Component.register('conveyor-join-trapezoid', ConveyorJoinTrapezoid as any)
@@ -0,0 +1,170 @@
1
+ import { Component, Donut, POSITION, Rect } from '@hatiolab/things-scene'
2
+
3
+ /*
4
+ * Copyright © HatioLab Inc. All rights reserved.
5
+ */
6
+ import MixinRoller from './mixin-conveyor'
7
+
8
+ const NATURE = {
9
+ mutable: false,
10
+ resizable: true,
11
+ rotatable: true,
12
+ properties: [
13
+ {
14
+ type: 'select',
15
+ label: 'conveyor-type',
16
+ name: 'conveyorType',
17
+ property: {
18
+ options: [
19
+ {
20
+ display: 'Roller',
21
+ value: 0
22
+ },
23
+ {
24
+ display: 'Belt',
25
+ value: 1
26
+ }
27
+ ]
28
+ }
29
+ },
30
+ {
31
+ type: 'angle',
32
+ label: 'start-angle',
33
+ name: 'startAngle'
34
+ },
35
+ {
36
+ type: 'angle',
37
+ label: 'end-angle',
38
+ name: 'endAngle'
39
+ },
40
+ {
41
+ type: 'number',
42
+ label: 'ratio',
43
+ name: 'ratio'
44
+ },
45
+ {
46
+ type: 'number',
47
+ label: 'roll-width',
48
+ name: 'rollWidth'
49
+ },
50
+ {
51
+ type: 'number',
52
+ label: 'value',
53
+ name: 'value'
54
+ },
55
+ {
56
+ type: 'checkbox',
57
+ label: 'animation',
58
+ name: 'animated'
59
+ }
60
+ ],
61
+ help: 'scene/component/conveyor-join'
62
+ }
63
+
64
+ const RADIAN = 0.0174533 / Math.PI
65
+
66
+ var controlHandler = {
67
+ ondragmove: function (point: POSITION, index: number, component: Component) {
68
+ var { cx, rx } = component.model
69
+
70
+ var transcoorded = component.transcoordP2S(point.x, point.y)
71
+
72
+ var ratio = ((transcoorded.x - cx) / rx) * 100
73
+
74
+ ratio = ratio >= 100 || ratio <= -100 ? 100 : Math.abs(ratio)
75
+
76
+ component.set({ ratio })
77
+ }
78
+ }
79
+
80
+ var antiClockWiseControlHandler = {
81
+ ondragmove: function (point: POSITION, index: number, component: Component) {
82
+ var { cx, cy } = component.model
83
+
84
+ var transcoorded = component.transcoordP2S(point.x, point.y)
85
+
86
+ var theta = Math.atan2(-(transcoorded.y - cy), transcoorded.x - cx)
87
+
88
+ if (theta > 0) if (theta <= Math.PI / 2) theta = Math.PI / 2
89
+ if (theta < 0) if (theta >= -Math.PI / 2) theta = -Math.PI / 2
90
+
91
+ var startAngle = -theta + Math.PI / 2
92
+
93
+ component.set({ startAngle })
94
+ }
95
+ }
96
+
97
+ var clockwiseControlHandler = {
98
+ ondragmove: function (point: POSITION, index: number, component: Component) {
99
+ var { cx, cy } = component.model
100
+
101
+ var transcoorded = component.transcoordP2S(point.x, point.y)
102
+
103
+ var theta = Math.atan2(-(transcoorded.y - cy), transcoorded.x - cx)
104
+
105
+ if (theta > 0) if (theta >= Math.PI / 2) theta = Math.PI / 2
106
+ if (theta < 0) if (theta <= -Math.PI / 2) theta = -Math.PI / 2
107
+
108
+ var endAngle = -theta + Math.PI / 2
109
+
110
+ component.set({ endAngle })
111
+ }
112
+ }
113
+
114
+ export default class ConveyorJoin extends MixinRoller(Donut) {
115
+ get nature() {
116
+ return NATURE
117
+ }
118
+
119
+ is3dish() {
120
+ return false
121
+ }
122
+
123
+ render(ctx: CanvasRenderingContext2D) {
124
+ var { ratio = 50, cx, cy, rx, ry, startAngle = 0, endAngle = Math.PI / 2, animated = false } = this.model
125
+
126
+ animated && this.animOnState()
127
+
128
+ ctx.beginPath()
129
+
130
+ startAngle -= Math.PI / 2
131
+ endAngle -= Math.PI / 2
132
+
133
+ ctx.ellipse(cx, cy, Math.abs(rx), Math.abs(ry), 0, startAngle, endAngle)
134
+
135
+ // ctx.moveTo(cx + (rx / 100) * ratio ,cy);
136
+ // 맨 마지막 속성이 true면 원의 범위만큼 공백이 됨
137
+
138
+ ctx.ellipse(cx, cy, Math.abs((rx / 100) * ratio), Math.abs((ry / 100) * ratio), 0, endAngle, startAngle, true)
139
+
140
+ ctx.lineTo(rx * Math.cos(startAngle) + cx, rx * Math.sin(startAngle) + cy)
141
+ }
142
+
143
+ get controls() {
144
+ var { cx, cy, rx, ratio, startAngle, endAngle } = this.model
145
+
146
+ var controls = []
147
+
148
+ controls.push({
149
+ x: cx + ((rx + (rx * ratio) / 100) / 2) * Math.sin(startAngle),
150
+ y: cy - ((rx + (rx * ratio) / 100) / 2) * Math.cos(startAngle),
151
+ handler: antiClockWiseControlHandler
152
+ })
153
+
154
+ controls.push({
155
+ x: cx + ((rx + (rx * ratio) / 100) / 2) * Math.sin(endAngle),
156
+ y: cy - ((rx + (rx * ratio) / 100) / 2) * Math.cos(endAngle),
157
+ handler: clockwiseControlHandler
158
+ })
159
+
160
+ controls.push({
161
+ x: cx + (rx / 100) * ratio,
162
+ y: cy,
163
+ handler: controlHandler
164
+ })
165
+
166
+ return controls
167
+ }
168
+ }
169
+
170
+ Component.register('conveyor-join', ConveyorJoin as any)
@@ -0,0 +1,69 @@
1
+ import { Component, RectPath, Shape } from '@hatiolab/things-scene'
2
+
3
+ /*
4
+ * Copyright © HatioLab Inc. All rights reserved.
5
+ */
6
+ import MixinRoller from './mixin-conveyor'
7
+
8
+ const NATURE = {
9
+ mutable: false,
10
+ resizable: true,
11
+ rotatable: true,
12
+ properties: [
13
+ {
14
+ type: 'select',
15
+ label: 'conveyor-type',
16
+ name: 'conveyorType',
17
+ property: {
18
+ options: [
19
+ {
20
+ display: 'Roller',
21
+ value: 0
22
+ },
23
+ {
24
+ display: 'Belt',
25
+ value: 1
26
+ }
27
+ ]
28
+ }
29
+ },
30
+ {
31
+ type: 'number',
32
+ label: 'roll-width',
33
+ name: 'rollWidth'
34
+ },
35
+ {
36
+ type: 'number',
37
+ label: 'value',
38
+ name: 'value'
39
+ },
40
+ {
41
+ type: 'checkbox',
42
+ label: 'animation',
43
+ name: 'animated'
44
+ }
45
+ ],
46
+ help: 'scene/component/conveyor'
47
+ }
48
+
49
+ export default class Conveyor extends MixinRoller(RectPath(Shape)) {
50
+ get nature() {
51
+ return NATURE
52
+ }
53
+
54
+ render(ctx: CanvasRenderingContext2D) {
55
+ var { width, height, left, top, animated = false } = this.model
56
+
57
+ animated && this.animOnState()
58
+
59
+ ctx.beginPath()
60
+ ctx.rect(left, top, width, height)
61
+ }
62
+
63
+ is3dish() {
64
+ return false
65
+ }
66
+ }
67
+
68
+ Component.register('conveyor', Conveyor as any)
69
+ Component.register('conveyor-belt', Conveyor as any)