@operato/scene-visualizer 1.2.36 → 1.2.39

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 (96) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/db.sqlite +0 -0
  3. package/dist/camera copy.d.ts +20 -0
  4. package/dist/camera copy.js +103 -0
  5. package/dist/camera copy.js.map +1 -0
  6. package/dist/camera.d.ts +1 -1
  7. package/dist/index.d.ts +1 -0
  8. package/dist/index.js +1 -0
  9. package/dist/index.js.map +1 -1
  10. package/dist/light.d.ts +15 -0
  11. package/dist/light.js +131 -0
  12. package/dist/light.js.map +1 -0
  13. package/dist/point-light.d.ts +14 -0
  14. package/dist/point-light.js +77 -0
  15. package/dist/point-light.js.map +1 -0
  16. package/dist/rack.d.ts +2 -2
  17. package/dist/stock.d.ts +1 -1
  18. package/dist/templates/index.d.ts +20 -0
  19. package/dist/templates/index.js +2 -0
  20. package/dist/templates/index.js.map +1 -1
  21. package/dist/templates/light.d.ts +22 -0
  22. package/dist/templates/light.js +23 -0
  23. package/dist/templates/light.js.map +1 -0
  24. package/dist/templates/point-light.d.ts +22 -0
  25. package/dist/templates/point-light.js +23 -0
  26. package/dist/templates/point-light.js.map +1 -0
  27. package/dist/templates/sprite.js +1 -1
  28. package/dist/templates/sprite.js.map +1 -1
  29. package/dist/templates/wall copy.d.ts +19 -0
  30. package/dist/templates/wall copy.js +20 -0
  31. package/dist/templates/wall copy.js.map +1 -0
  32. package/dist/three-container.js +0 -18
  33. package/dist/three-container.js.map +1 -1
  34. package/dist/three-modeller.d.ts +0 -0
  35. package/dist/three-modeller.js +2 -0
  36. package/dist/three-modeller.js.map +1 -0
  37. package/dist/three-space.d.ts +86 -0
  38. package/dist/three-space.js +566 -0
  39. package/dist/three-space.js.map +1 -0
  40. package/dist/threed/real-object-camera-meshed.d.ts +1 -1
  41. package/dist/threed/real-object-dom-element.d.ts +1 -0
  42. package/dist/threed/real-object-dom-element.js +6 -0
  43. package/dist/threed/real-object-dom-element.js.map +1 -1
  44. package/dist/threed/real-object-extrude.d.ts +1 -1
  45. package/dist/threed/real-object-mesh.d.ts +2 -2
  46. package/dist/threed/real-object-sprite.d.ts +1 -0
  47. package/dist/threed/real-object-sprite.js +6 -0
  48. package/dist/threed/real-object-sprite.js.map +1 -1
  49. package/dist/threed/texture/canvas-texture.js +25 -7
  50. package/dist/threed/texture/canvas-texture.js.map +1 -1
  51. package/helps/scene/component/light.ko.md +12 -0
  52. package/helps/scene/component/light.md +12 -0
  53. package/helps/scene/component/light.zh.md +12 -0
  54. package/icons/light.png +0 -0
  55. package/logs/.08636eb59927f12972f6774f5947c8507b3564c2-audit.json +9 -24
  56. package/logs/.5e5d741d8b7784a2fbad65eedc0fd46946aaf6f2-audit.json +12 -42
  57. package/logs/application-2023-05-23-21.log +6 -0
  58. package/logs/application-2023-05-24-21.log +6 -0
  59. package/logs/application-2023-05-25-00.log +20 -0
  60. package/logs/connections-2023-05-20-07.log +41 -0
  61. package/logs/connections-2023-05-23-21.log +41 -0
  62. package/logs/connections-2023-05-24-21.log +41 -0
  63. package/logs/connections-2023-05-25-00.log +123 -0
  64. package/package.json +3 -3
  65. package/schema.gql +10 -0
  66. package/src/index.ts +1 -0
  67. package/src/light.ts +155 -0
  68. package/src/templates/index.ts +2 -0
  69. package/src/templates/light.ts +23 -0
  70. package/src/templates/sprite.ts +1 -1
  71. package/src/three-container.ts +0 -21
  72. package/src/three-space.ts +732 -0
  73. package/src/threed/real-object-dom-element.ts +9 -4
  74. package/src/threed/real-object-sprite.ts +9 -0
  75. package/src/threed/texture/canvas-texture.ts +32 -6
  76. package/translations/en.json +6 -1
  77. package/translations/ko.json +6 -1
  78. package/translations/ms.json +6 -1
  79. package/translations/zh.json +6 -1
  80. package/tsconfig.tsbuildinfo +1 -1
  81. package/logs/application-2023-04-30-10.log +0 -6
  82. package/logs/application-2023-04-30-12.log +0 -6
  83. package/logs/application-2023-04-30-14.log +0 -6
  84. package/logs/application-2023-04-30-16.log +0 -15
  85. package/logs/application-2023-04-30-20.log +0 -6
  86. package/logs/application-2023-04-30-22.log +0 -6
  87. package/logs/connections-2023-04-22-10.log +0 -82
  88. package/logs/connections-2023-04-22-11.log +0 -41
  89. package/logs/connections-2023-04-24-13.log +0 -82
  90. package/logs/connections-2023-04-24-14.log +0 -82
  91. package/logs/connections-2023-04-30-10.log +0 -41
  92. package/logs/connections-2023-04-30-12.log +0 -41
  93. package/logs/connections-2023-04-30-14.log +0 -41
  94. package/logs/connections-2023-04-30-16.log +0 -41
  95. package/logs/connections-2023-04-30-20.log +0 -41
  96. package/logs/connections-2023-04-30-22.log +0 -41
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@operato/scene-visualizer",
3
3
  "description": "visualizer component for operato-scene",
4
4
  "author": "heartyoh",
5
- "version": "1.2.36",
5
+ "version": "1.2.39",
6
6
  "main": "dist/index.js",
7
7
  "module": "dist/index.js",
8
8
  "license": "MIT",
@@ -36,7 +36,7 @@
36
36
  "@hatiolab/prettier-config": "^1.0.0",
37
37
  "@things-factory/builder": "^6.0.0",
38
38
  "@things-factory/operato-board": "^6.0.0",
39
- "@types/three": "^0.151.0",
39
+ "@types/three": "^0.152.0",
40
40
  "@types/tinycolor2": "^1.4.3",
41
41
  "@typescript-eslint/eslint-plugin": "^4.33.0",
42
42
  "@typescript-eslint/parser": "^4.33.0",
@@ -62,5 +62,5 @@
62
62
  "prettier --write"
63
63
  ]
64
64
  },
65
- "gitHead": "65a40a190365b3b6256409b6491af360e36d1a98"
65
+ "gitHead": "b9e52c76a2cd160a6f7341aa26694c928ed1051a"
66
66
  }
package/schema.gql CHANGED
@@ -1360,9 +1360,15 @@ type Mutation {
1360
1360
  """To start new scenario instance"""
1361
1361
  startScenario(instanceName: String, scenarioName: String!, variables: Object): ScenarioInstance!
1362
1362
 
1363
+ """To start posting scenario based on the schedule of the given scenario"""
1364
+ startScenarioSchedule(scenarioId: String!): Scenario!
1365
+
1363
1366
  """To start new scenario instance"""
1364
1367
  stopScenario(instanceName: String): ScenarioInstance
1365
1368
 
1369
+ """To stop posting scenario based on the schedule of the given scenario"""
1370
+ stopScenarioSchedule(scenarioId: String!): Scenario
1371
+
1366
1372
  """
1367
1373
  To synchronize privilege master from graphql directives. Only superuser is permitted.
1368
1374
  """
@@ -2193,6 +2199,9 @@ type Query {
2193
2199
 
2194
2200
  """To fetch multiple Fonts"""
2195
2201
  fonts(filters: [Filter!], pagination: Pagination, sortings: [Sorting!]): FontList!
2202
+
2203
+ """To fetch a Global Board Model"""
2204
+ globalBoardByName(name: String!): Board
2196
2205
  grantedRoles: [GrantedRole!]!
2197
2206
  grantingRoles(customerId: String!): [GrantedRole!]!
2198
2207
 
@@ -2398,6 +2407,7 @@ type Scenario {
2398
2407
  instances: [ScenarioInstance!]
2399
2408
  name: String!
2400
2409
  schedule: String
2410
+ scheduleId: String
2401
2411
  state: String
2402
2412
  steps: [Step!]
2403
2413
  timezone: String
package/src/index.ts CHANGED
@@ -26,3 +26,4 @@ export * from './sphere'
26
26
  export * from './visualizer'
27
27
  export * from './three-container'
28
28
  export * from './wall'
29
+ export * from './light'
package/src/light.ts ADDED
@@ -0,0 +1,155 @@
1
+ /*
2
+ * Copyright © HatioLab Inc. All rights reserved.
3
+ */
4
+ import { Anchor, Component, ComponentNature, Ellipse } from '@hatiolab/things-scene'
5
+ import * as THREE from 'three'
6
+ import { RealObject } from './threed/real-object'
7
+
8
+ const NATURE = {
9
+ mutable: false,
10
+ resizable: true,
11
+ rotatable: true,
12
+ properties: [
13
+ {
14
+ type: 'select',
15
+ label: 'light-type',
16
+ name: 'lightType',
17
+ property: {
18
+ options: ['', 'point', 'directional']
19
+ }
20
+ },
21
+ {
22
+ type: 'number',
23
+ label: 'intensity',
24
+ name: 'intensity'
25
+ },
26
+ {
27
+ type: 'number',
28
+ label: 'distance',
29
+ name: 'distance'
30
+ },
31
+ {
32
+ type: 'number',
33
+ label: 'decay',
34
+ name: 'decay'
35
+ },
36
+ {
37
+ type: 'checkbox',
38
+ label: 'cast-shadow',
39
+ name: 'castShadow'
40
+ },
41
+ {
42
+ type: 'number',
43
+ label: 'near',
44
+ name: 'near',
45
+ placeholder: '0.5'
46
+ },
47
+ {
48
+ type: 'number',
49
+ label: 'far',
50
+ name: 'far',
51
+ placeholder: '1000'
52
+ },
53
+ {
54
+ type: 'number',
55
+ label: 'fov',
56
+ name: 'fov',
57
+ placeholder: '90'
58
+ },
59
+ {
60
+ type: 'number',
61
+ label: 'zoom',
62
+ name: 'zoom',
63
+ placeholder: '1'
64
+ },
65
+ {
66
+ type: 'checkbox',
67
+ label: 'show-helper',
68
+ name: 'showHelper'
69
+ }
70
+ ],
71
+ help: 'scene/component/light'
72
+ }
73
+
74
+ export class LightObject extends RealObject<THREE.Light> {
75
+ helper?: THREE.CameraHelper
76
+
77
+ updatePointLight() {
78
+ var {
79
+ lightType = 'point',
80
+ distance = 0, // unlimited
81
+ intensity = 10,
82
+ decay = 1,
83
+ fillStyle: color = 'white',
84
+ castShadow,
85
+ near = 0.5,
86
+ far = 1000,
87
+ fov = 90,
88
+ zoom = 1,
89
+ showHelper
90
+ } = this.component.state
91
+
92
+ this.object3d!.color = new THREE.Color(color)
93
+ if (lightType == 'point') {
94
+ ;(this.object3d as THREE.PointLight)!.distance = distance
95
+ ;(this.object3d as THREE.PointLight)!.decay = decay
96
+ }
97
+ this.object3d!.intensity = intensity
98
+ this.object3d!.castShadow = castShadow
99
+ if (castShadow) {
100
+ const camera = this.object3d!.shadow?.camera as THREE.PerspectiveCamera
101
+ camera.far = far
102
+ camera.near = near
103
+ camera.fov = fov
104
+ camera.zoom = zoom
105
+ }
106
+
107
+ if (showHelper) {
108
+ const camera = this.object3d!.shadow?.camera as THREE.PerspectiveCamera
109
+
110
+ if (!this.helper) {
111
+ this.helper = new THREE.CameraHelper(camera!)
112
+ this.object3d.add(this.helper)
113
+ }
114
+ } else if (this.helper) {
115
+ this.object3d.remove(this.helper)
116
+ delete this.helper
117
+ }
118
+ }
119
+
120
+ protected getObject3dInstance(): THREE.Light {
121
+ var { lightType = 'point' } = this.component.state
122
+
123
+ return lightType == 'point' ? new THREE.PointLight() : new THREE.DirectionalLight()
124
+ }
125
+
126
+ update() {
127
+ this.clear()
128
+ this.build()
129
+
130
+ this.updateDimension()
131
+ this.updateHidden()
132
+
133
+ this.updatePointLight()
134
+ }
135
+ }
136
+
137
+ export class PointLight extends Ellipse {
138
+ is3dish() {
139
+ return true
140
+ }
141
+
142
+ buildRealObject(): RealObject | undefined {
143
+ return new LightObject(this)
144
+ }
145
+
146
+ get anchors(): Array<Anchor> {
147
+ return []
148
+ }
149
+
150
+ get nature(): ComponentNature {
151
+ return NATURE
152
+ }
153
+ }
154
+
155
+ Component.register('light', PointLight)
@@ -9,6 +9,7 @@ import sprite from './sprite'
9
9
  import wall from './wall'
10
10
  import desk from './desk'
11
11
  import camera from './camera'
12
+ import light from './light'
12
13
  import GLTFObject from './gltf-object'
13
14
 
14
15
  export default [
@@ -16,6 +17,7 @@ export default [
16
17
  visualizer,
17
18
  rackTable,
18
19
  camera,
20
+ light,
19
21
  cube,
20
22
  cylinder,
21
23
  sphere,
@@ -0,0 +1,23 @@
1
+ const icon = new URL('../../icons/light.png', import.meta.url).href
2
+
3
+ export default {
4
+ type: 'light',
5
+ description: 'Light',
6
+ group: '3D' /* line|shape|textAndMedia|chartAndGauge|table|container|dataSource|IoT|3D|warehouse|form|etc */,
7
+ icon,
8
+ model: {
9
+ type: 'light',
10
+ rx: 10,
11
+ ry: 10,
12
+ cx: 150,
13
+ cy: 150,
14
+ zPos: 1000,
15
+ fillStyle: '#fff',
16
+ strokeStyle: '#000',
17
+ alpha: 1,
18
+ hidden: false,
19
+ lineWidth: 1,
20
+ lineDash: 'solid',
21
+ lineCap: 'butt'
22
+ }
23
+ }
@@ -11,7 +11,7 @@ export default {
11
11
  left: 100,
12
12
  width: 200,
13
13
  height: 80,
14
- zPos: 1,
14
+ zPos: 40,
15
15
  depth: 10,
16
16
  fillStyle: '#ffffff',
17
17
  strokeStyle: '#999',
@@ -232,21 +232,8 @@ export class ThreeContainer extends Container implements ThreeDimensionalContain
232
232
 
233
233
  // Lights
234
234
  var _hemiLight = new THREE.HemisphereLight(0xdddddd, 0x333333, 0.035)
235
- var _directionalLight = new THREE.DirectionalLight(0xd6e1ff, 0.01)
236
- var _pointLight1 = new THREE.PointLight(0xd6e1ff, 1, undefined, 2)
237
-
238
- _pointLight1.power = cameraZPos * 50
239
- _pointLight1.castShadow = true
240
- _pointLight1.position.set(0, cameraZPos, 0)
241
- _pointLight1.shadow.camera.near = 0.1
242
- _pointLight1.shadow.camera.far = cameraZPos * 2
243
-
244
- // const helper = new THREE.CameraHelper(_pointLight1.shadow.camera)
245
- // this._scene3d?.add(helper)
246
235
 
247
236
  this.scene3d!.add(_hemiLight)
248
- this.scene3d!.add(_pointLight1)
249
- this._camera.add(_directionalLight)
250
237
 
251
238
  this._mouse = new THREE.Vector2()
252
239
 
@@ -258,19 +245,11 @@ export class ThreeContainer extends Container implements ThreeDimensionalContain
258
245
  this._camera.updateProjectionMatrix()
259
246
 
260
247
  const floor = createFloor(this)
261
- // if (this._floor) {
262
- // this.object3d.remove(this._floor)
263
- // this._floor.clear()
264
- // delete this._floor
265
- // }
266
248
 
267
249
  if (floor) {
268
- // this._floor = floor
269
250
  this._scene3d.add(floor)
270
251
  }
271
252
 
272
- // this.invalidate()
273
-
274
253
  // postprocessing
275
254
 
276
255
  var composer = (this.composer = new EffectComposer(renderer3d!))