@operato/scene-visualizer 7.3.15 → 7.3.19

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 (103) hide show
  1. package/dist/html-overlay-element.js +0 -6
  2. package/dist/html-overlay-element.js.map +1 -1
  3. package/dist/three-container.js +1 -0
  4. package/dist/three-container.js.map +1 -1
  5. package/dist/threed/real-object-text.d.ts +1 -1
  6. package/dist/threed/real-object-text.js +1 -1
  7. package/dist/threed/real-object-text.js.map +1 -1
  8. package/dist/threed/real-object.d.ts +2 -2
  9. package/dist/threed/real-object.js +6 -2
  10. package/dist/threed/real-object.js.map +1 -1
  11. package/package.json +2 -2
  12. package/CHANGELOG.md +0 -622
  13. package/attachments/0d91a37d-c2d7-4c6d-88dc-a29e5bbea361.png +0 -0
  14. package/attachments/1b07c8d3-07d5-4007-b02e-031ee1755539.glb +0 -0
  15. package/attachments/226c6c23-c4fd-46c8-93e3-3d3d9c4bb8a9.glb +0 -0
  16. package/attachments/4425ca46-cf1d-476d-9185-dcb881ecad1f.glb +0 -0
  17. package/attachments/51e7c45d-6eae-4baf-a4e2-ba979b7e77cd.glb +0 -0
  18. package/attachments/54427925-c109-4499-875c-fb14207b95c5.glb +0 -0
  19. package/attachments/8cc70a65-e20f-4187-83c8-64deb3faf3d9.glb +0 -0
  20. package/attachments/964d004d-1fe7-4224-89a6-2b6e86db233c.glb +0 -0
  21. package/attachments/ff47fd63-6f1c-4a69-b965-9bb03797a415.png +0 -0
  22. package/db.sqlite +0 -0
  23. package/demo/index-modeller.html +0 -112
  24. package/demo/index.html +0 -109
  25. package/logs/.08636eb59927f12972f6774f5947c8507b3564c2-audit.json +0 -20
  26. package/logs/.5e5d741d8b7784a2fbad65eedc0fd46946aaf6f2-audit.json +0 -20
  27. package/logs/application-2024-10-01-00.log +0 -105
  28. package/logs/application-2024-10-01-01.log +0 -105
  29. package/logs/connections-2024-10-01-00.log +0 -50
  30. package/logs/connections-2024-10-01-01.log +0 -50
  31. package/schema.graphql +0 -4455
  32. package/src/banner.ts +0 -88
  33. package/src/camera.ts +0 -132
  34. package/src/component.d.ts +0 -10
  35. package/src/cube.ts +0 -39
  36. package/src/cylinder.ts +0 -39
  37. package/src/desk.ts +0 -135
  38. package/src/editors/index.ts +0 -13
  39. package/src/editors/property-editor-gltf-info.ts +0 -135
  40. package/src/editors/property-editor-location-increase-pattern.ts +0 -260
  41. package/src/effects/outline.ts +0 -54
  42. package/src/ellipse.ts +0 -37
  43. package/src/gltf-object.ts +0 -117
  44. package/src/html-overlay-element.ts +0 -21
  45. package/src/index.ts +0 -29
  46. package/src/light.ts +0 -155
  47. package/src/polygon.ts +0 -88
  48. package/src/rack-table-cell.ts +0 -386
  49. package/src/rack-table.ts +0 -1296
  50. package/src/rack.ts +0 -232
  51. package/src/rect.ts +0 -39
  52. package/src/scene/component.ts +0 -38
  53. package/src/sphere.ts +0 -39
  54. package/src/sprite.ts +0 -30
  55. package/src/stock.ts +0 -262
  56. package/src/templates/3d-container.ts +0 -21
  57. package/src/templates/banner.ts +0 -21
  58. package/src/templates/camera.ts +0 -25
  59. package/src/templates/cube.ts +0 -20
  60. package/src/templates/cylinder.ts +0 -20
  61. package/src/templates/desk.ts +0 -20
  62. package/src/templates/gltf-object.ts +0 -20
  63. package/src/templates/index.ts +0 -29
  64. package/src/templates/light.ts +0 -23
  65. package/src/templates/pallet.ts +0 -20
  66. package/src/templates/rack-table.ts +0 -21
  67. package/src/templates/sphere.ts +0 -20
  68. package/src/templates/sprite.ts +0 -21
  69. package/src/templates/visualizer.ts +0 -21
  70. package/src/templates/wall.ts +0 -20
  71. package/src/text.ts +0 -10
  72. package/src/three-container-editor.ts +0 -187
  73. package/src/three-container.ts +0 -723
  74. package/src/three-controls.ts +0 -778
  75. package/src/three-layout.ts +0 -25
  76. package/src/three-space.ts +0 -732
  77. package/src/threed/common.ts +0 -21
  78. package/src/threed/floor/floor.ts +0 -62
  79. package/src/threed/html/elements.ts +0 -27
  80. package/src/threed/index.ts +0 -15
  81. package/src/threed/real-object-camera-meshed.ts +0 -67
  82. package/src/threed/real-object-camera.ts +0 -41
  83. package/src/threed/real-object-dom-element.ts +0 -55
  84. package/src/threed/real-object-dummy.ts +0 -13
  85. package/src/threed/real-object-extrude.ts +0 -210
  86. package/src/threed/real-object-gltf.ts +0 -136
  87. package/src/threed/real-object-group.ts +0 -35
  88. package/src/threed/real-object-mesh.ts +0 -74
  89. package/src/threed/real-object-plane.ts +0 -27
  90. package/src/threed/real-object-scene.ts +0 -84
  91. package/src/threed/real-object-sprite-2d.ts +0 -54
  92. package/src/threed/real-object-sprite.ts +0 -64
  93. package/src/threed/real-object-text.ts +0 -86
  94. package/src/threed/real-object.ts +0 -321
  95. package/src/threed/texture/canvas-texture.ts +0 -67
  96. package/src/threed/texture/text-texture.ts +0 -100
  97. package/src/threed/three-dimensional-container.ts +0 -9
  98. package/src/threed/utils/bound-uv-generator.ts +0 -80
  99. package/src/visualizer.ts +0 -319
  100. package/src/wall.ts +0 -50
  101. package/tsconfig.json +0 -24
  102. package/tsconfig.tsbuildinfo +0 -1
  103. package/web-dev-server.config.mjs +0 -27
@@ -1,74 +0,0 @@
1
- /*
2
- * Copyright © HatioLab Inc. All rights reserved.
3
- */
4
-
5
- import * as THREE from 'three'
6
-
7
- import { applyAlpha } from './common'
8
- import { RealObject } from './real-object'
9
-
10
- export abstract class RealObjectMesh extends RealObject<THREE.Mesh> {
11
- protected getObject3dInstance() {
12
- return new THREE.Mesh()
13
- }
14
-
15
- build() {
16
- super.build()
17
-
18
- this.buildGeometry()
19
- this.buildMaterial()
20
- }
21
-
22
- /* overide */
23
-
24
- updateAlpha() {
25
- var { alpha = 1, fillStyle } = this.component.state
26
-
27
- applyAlpha(this.object3d.material, alpha, fillStyle)
28
- }
29
-
30
- updateHidden() {
31
- this.object3d.visible = !this.component.state.hidden
32
- }
33
-
34
- updateFillStyle() {
35
- var { fillStyle } = this.component.state
36
- var material = this.object3d.material as THREE.MeshStandardMaterial
37
- if (!material) {
38
- return
39
- }
40
-
41
- const texture = RealObject.buildFillStyleTexture(this.component)
42
-
43
- if (texture) {
44
- texture.needsUpdate = true
45
- material.map = texture
46
- } else if (typeof fillStyle == 'string') {
47
- if (fillStyle !== 'transparent') {
48
- material.color.set(fillStyle)
49
- } else {
50
- material.opacity = 0
51
- }
52
- }
53
- }
54
-
55
- protected abstract buildGeometry(): void
56
-
57
- buildMaterial(): void {
58
- this.object3d.material = new THREE.MeshStandardMaterial({
59
- transparent: true,
60
- side: THREE.DoubleSide
61
- })
62
- }
63
-
64
- clear() {
65
- this.object3d.traverse((mesh: any) => {
66
- if (mesh.isMesh) {
67
- mesh.geometry.dispose()
68
- ;(mesh.material.length ? mesh.material : [mesh.material]).forEach((m: any) => m.dispose && m.dispose())
69
- }
70
- })
71
-
72
- return super.clear()
73
- }
74
- }
@@ -1,27 +0,0 @@
1
- /*
2
- * Copyright © HatioLab Inc. All rights reserved.
3
- */
4
-
5
- /*
6
- Inspired by http://learningthreejs.com/blog/2013/04/30/closing-the-gap-between-html-and-webgl/
7
- */
8
-
9
- import * as THREE from 'three'
10
-
11
- import { RealObjectMesh } from './real-object-mesh'
12
-
13
- export class RealObjectPlane extends RealObjectMesh {
14
- buildGeometry() {
15
- var { width, height } = this.component.state.dimension
16
-
17
- this.object3d.geometry = new THREE.PlaneGeometry(width, height)
18
- }
19
-
20
- buildMaterial() /* : THREE.MeshMaterialType | THREE.MeshMaterialType[] */ {
21
- this.object3d.material = new THREE.MeshStandardMaterial({
22
- opacity: 0,
23
- side: THREE.DoubleSide,
24
- blending: THREE.NoBlending
25
- })
26
- }
27
- }
@@ -1,84 +0,0 @@
1
- /*
2
- * Copyright © HatioLab Inc. All rights reserved.
3
- */
4
-
5
- import * as THREE from 'three'
6
-
7
- import { RealObject } from './real-object'
8
- import { createFloor } from './floor/floor'
9
-
10
- export class RealObjectScene extends RealObject<THREE.Scene> {
11
- private _floor?: THREE.Mesh
12
- private _animationMixer?: THREE.AnimationMixer
13
-
14
- protected getObject3dInstance() {
15
- return new THREE.Scene()
16
- }
17
-
18
- dispose() {
19
- this.object3d.children.forEach(child => {
20
- ;(child as any)['dispose'] && (child as any)['dispose']()
21
-
22
- this.object3d.remove(child)
23
- })
24
- }
25
-
26
- clear() {
27
- if (this._floor) {
28
- this.object3d.remove(this._floor)
29
-
30
- if (this._floor.material instanceof Array) {
31
- ;(this._floor.material as THREE.Material[]).forEach(material => material.dispose())
32
- } else {
33
- this._floor.material.dispose()
34
- }
35
- this._floor.geometry.dispose()
36
-
37
- delete this._floor
38
- }
39
-
40
- return super.clear()
41
- }
42
-
43
- get floor(): THREE.Mesh {
44
- return this._floor!
45
- }
46
-
47
- set floor(floor: THREE.Mesh | undefined) {
48
- if (this._floor) {
49
- this.object3d.remove(this._floor)
50
- this._floor.clear()
51
- delete this._floor
52
- }
53
-
54
- if (floor) {
55
- this._floor = floor
56
- this.object3d.add(floor)
57
- }
58
-
59
- this.component.invalidate()
60
- }
61
-
62
- build() {
63
- super.build()
64
-
65
- this.floor = createFloor(this.component)
66
- }
67
-
68
- updateTransform() {}
69
- updateTransformReverse() {}
70
- updateDimension() {}
71
- updatePosition() {}
72
- updateRotate() {}
73
- updateScale() {}
74
- updateAlpha() {}
75
- updateHidden() {}
76
-
77
- get animationMixer(): THREE.AnimationMixer {
78
- if (!this._animationMixer) {
79
- this._animationMixer = new THREE.AnimationMixer(this.object3d)
80
- }
81
-
82
- return this._animationMixer
83
- }
84
- }
@@ -1,54 +0,0 @@
1
- /*
2
- * Copyright © HatioLab Inc. All rights reserved.
3
- */
4
-
5
- import * as THREE from 'three'
6
- import { RealObjectSprite } from './real-object-sprite'
7
- import { createCanvasTexture } from './texture/canvas-texture'
8
-
9
- export class RealObjectSprite2D extends RealObjectSprite {
10
- buildMaterial() {
11
- var material = this.object3d.material as THREE.SpriteMaterial
12
- if (material) {
13
- material.dispose()
14
- }
15
-
16
- this.object3d.material = new THREE.SpriteMaterial({
17
- map: createCanvasTexture(this.component),
18
- alphaTest: 0.01,
19
- sizeAttenuation: false
20
- })
21
- }
22
-
23
- get scale() {
24
- const { width, height } = this.component.bounds
25
- const { width: parentWidth, height: parentHeight } = this.threeContainer!.bounds
26
- const { scale = 1 } = this.component.state
27
-
28
- return {
29
- x: (scale * width) / parentWidth,
30
- y: (scale * height) / parentHeight,
31
- z: scale
32
- }
33
- }
34
-
35
- update() {
36
- this.build()
37
- }
38
-
39
- updateFillStyle() {
40
- this.update()
41
- }
42
-
43
- updateStrokeStyle() {
44
- this.update()
45
- }
46
-
47
- updateAlpha() {
48
- this.update()
49
- }
50
-
51
- updateText() {
52
- this.update()
53
- }
54
- }
@@ -1,64 +0,0 @@
1
- /*
2
- * Copyright © HatioLab Inc. All rights reserved.
3
- */
4
-
5
- import * as THREE from 'three'
6
- import { applyAlpha } from './common'
7
- import { DELTA } from '@hatiolab/things-scene'
8
-
9
- import { RealObject } from './real-object'
10
-
11
- export abstract class RealObjectSprite extends RealObject<THREE.Sprite> {
12
- protected getObject3dInstance() {
13
- return new THREE.Sprite()
14
- }
15
-
16
- build() {
17
- super.build()
18
-
19
- this.buildMaterial()
20
- }
21
-
22
- abstract buildMaterial(): void
23
-
24
- /* overide */
25
-
26
- get cz() {
27
- var { zPos = 0 } = this.component.state
28
- var { height } = this.component.bounds
29
- var { tz = 0 } = this.component.delta() as DELTA
30
-
31
- return zPos + tz + height / 2
32
- }
33
-
34
- updateAlpha() {
35
- var { alpha = 1, fillStyle } = this.component.state
36
-
37
- applyAlpha(this.object3d.material, alpha, fillStyle)
38
- }
39
-
40
- updateHidden() {
41
- this.object3d.visible = !this.component.state.hidden
42
- }
43
-
44
- updateFillStyle() {
45
- var { fillStyle } = this.component.state
46
- var material = this.object3d.material as THREE.SpriteMaterial
47
- if (!material) {
48
- return
49
- }
50
-
51
- const texture = RealObject.buildFillStyleTexture(this.component)
52
-
53
- if (texture) {
54
- texture.needsUpdate = true
55
- material.map = texture
56
- } else if (typeof fillStyle == 'string') {
57
- if (fillStyle !== 'transparent') {
58
- material.color.set(fillStyle)
59
- } else {
60
- material.opacity = 0
61
- }
62
- }
63
- }
64
- }
@@ -1,86 +0,0 @@
1
- /*
2
- * Copyright © HatioLab Inc. All rights reserved.
3
- */
4
-
5
- import * as THREE from 'three'
6
- import { applyAlpha } from './common'
7
-
8
- import { RealObjectMesh } from './real-object-mesh'
9
- import { textTexture } from './texture/text-texture'
10
-
11
- /**
12
- * RealObjectText
13
- */
14
- export class RealObjectText extends RealObjectMesh {
15
- buildGeometry() {}
16
-
17
- /* overide */
18
-
19
- get rotation() {
20
- const { rotationX = 0, rotationY = 0, rotation = 0 } = this.component.state
21
-
22
- return {
23
- x: rotationX - Math.PI / 2,
24
- y: rotationY,
25
- z: rotation
26
- }
27
- }
28
-
29
- updateDimension() {
30
- var { width, height } = this.component.state
31
-
32
- if (this.object3d.geometry) {
33
- this.object3d.geometry.dispose()
34
- }
35
-
36
- /* scaling으로 해결되지 않기때문에, 새로 geometry를 만드는 방법을 사용한다 */
37
- this.object3d.geometry = new THREE.PlaneGeometry(width, height)
38
- }
39
-
40
- updateText() {
41
- var material = this.object3d.material as THREE.MeshStandardMaterial
42
- if (!material) {
43
- return
44
- }
45
-
46
- var {
47
- width,
48
- height,
49
- bold = false,
50
- italic = false,
51
- fontFamily = 'Serif',
52
- fontSize = 10,
53
- fontColor = 'black',
54
- fillStyle
55
- } = this.component.state
56
-
57
- var text = this.component.text
58
-
59
- const texture = textTexture(text, width, height, {
60
- bold,
61
- italic,
62
- fontFamily,
63
- fontSize,
64
- fontColor
65
- })
66
-
67
- if (texture) {
68
- material.map = texture
69
- texture.needsUpdate = true
70
- } else if (typeof fillStyle == 'string') {
71
- if (fillStyle !== 'transparent') {
72
- material.color.set(fillStyle)
73
- } else {
74
- material.opacity = 0
75
- }
76
- }
77
- }
78
-
79
- updateAlpha() {
80
- // material의 transparency는 항상 true으로 유지되어야 한다.
81
- var { alpha = 1, fontColor } = this.component.state
82
-
83
- applyAlpha(this.object3d.material, alpha, fontColor)
84
- ;(this.object3d.material as any).transparent = true
85
- }
86
- }
@@ -1,321 +0,0 @@
1
- /*
2
- * Copyright © HatioLab Inc. All rights reserved.
3
- */
4
-
5
- import * as THREE from 'three'
6
- import { Component, Properties, DELTA } from '@hatiolab/things-scene'
7
-
8
- import { SCALE_MIN } from './common'
9
- import { ThreeDimensionalContainer } from './three-dimensional-container'
10
-
11
- function hasProperties(props: string[], obj: object) {
12
- return props.findIndex(prop => prop in obj) !== -1
13
- }
14
-
15
- export abstract class RealObject<T extends THREE.Object3D = THREE.Object3D> {
16
- protected _component: Component
17
- protected _focused: boolean = false
18
-
19
- public object3d: T
20
-
21
- static buildFillStyleTexture(component: Component) {
22
- const { fillStyle } = component.state
23
-
24
- if (typeof fillStyle == 'object' && fillStyle.type == 'pattern' && fillStyle.image) {
25
- return new THREE.TextureLoader(THREE.DefaultLoadingManager).load(
26
- component.app.url(fillStyle.image),
27
- texture => {
28
- texture.minFilter = THREE.LinearFilter
29
- // @ts-ignore
30
- texture.colorSpace = THREE.SRGBColorSpace
31
- texture.repeat.set(1, 1)
32
- texture.needsUpdate = true
33
-
34
- component.invalidate()
35
- },
36
- e => {
37
- console.error(e)
38
- }
39
- )
40
- }
41
- }
42
-
43
- constructor(component: Component) {
44
- this._component = component
45
- this.object3d = this.getObject3dInstance()
46
-
47
- this.component.on('change', this.onchange, this)
48
- }
49
-
50
- update() {
51
- this.clear()
52
- this.build()
53
-
54
- this.updateDimension()
55
- this.updateTransform()
56
- this.updateFillStyle()
57
- this.updateStrokeStyle()
58
- this.updateAlpha()
59
- this.updateHidden()
60
- this.updateText()
61
- }
62
-
63
- protected getObject3dInstance(): T {
64
- return new THREE.Object3D() as T
65
- }
66
-
67
- build() {
68
- this.object3d.userData.context = this
69
- this.object3d.castShadow = true
70
- this.object3d.name = this.component.state.id
71
- }
72
-
73
- get component(): Component {
74
- return this._component!
75
- }
76
-
77
- get threeContainer(): ThreeDimensionalContainer | undefined {
78
- var component = this.component
79
-
80
- while (component) {
81
- if ('is3dContainer' in component && (component as ThreeDimensionalContainer).is3dContainer()) {
82
- return component as ThreeDimensionalContainer
83
- }
84
- component = component.parent
85
- }
86
- }
87
-
88
- get focused(): boolean {
89
- return this._focused
90
- }
91
-
92
- set focused(focused: boolean) {
93
- this._focused = focused
94
- }
95
-
96
- dispose() {
97
- this.component.off('change', this.onchange, this)
98
- delete this.component._realObject
99
-
100
- this.clear()
101
- }
102
-
103
- clear() {
104
- this.object3d.children.slice().forEach((child: any) => {
105
- if (child['dispose']) child['dispose']()
106
- if (child['geometry'] && child['geometry']['dispose']) child['geometry']['dispose']()
107
- if (child['material'] && child['material']['dispose']) child['material']['dispose']()
108
- if (child['texture'] && child['texture']['dispose']) child['texture']['dispose']()
109
- this.object3d.remove(child)
110
- })
111
-
112
- this.object3d.userData = {}
113
- return this.object3d.clear()
114
- }
115
-
116
- /**
117
- * Component의 상태값의 변화를 Object3D에 반영 - translate, rotation, scale
118
- */
119
- updateTransform() {
120
- // var {
121
- // scale: { x: sx = 1, y: sy = 1, z: sz = 1 } = UNIT_SCALE,
122
- // translate: { x: tx = 0, y: ty = 0, z: tz = 0 } = UNIT_TRANSLATE,
123
- // rotate: { x: rx = 0, y: ry = 0, z: rz = 0 } = UNIT_ROTATE
124
- // } = this.component.state
125
-
126
- var { x: tx, y: ty, z: tz } = this.position
127
- var { x: rx, y: ry, z: rz } = this.rotation
128
- var { x: sx, y: sy, z: sz } = this.scale
129
-
130
- this.object3d.position.set(tx, ty, tz)
131
- this.object3d.rotation.set(rx, ry, rz)
132
- this.object3d.scale.set(Math.max(sx, SCALE_MIN), Math.max(sy, SCALE_MIN), Math.max(sz, SCALE_MIN))
133
- }
134
-
135
- get position() {
136
- const { x, y, z } = this.center
137
- return {
138
- x,
139
- y: z,
140
- z: y
141
- }
142
- }
143
-
144
- get rotation() {
145
- const { rotationX = 0, rotationY = 0, rotation = 0 } = this.component.state
146
-
147
- return {
148
- x: rotationX,
149
- y: rotationY,
150
- z: -rotation
151
- }
152
- }
153
-
154
- get scale() {
155
- const { scale = 1 } = this.component.state
156
-
157
- return {
158
- x: scale,
159
- y: scale,
160
- z: scale
161
- }
162
- }
163
-
164
- get cx() {
165
- var { x = 0 } = this.component.center
166
- var { width: parentWidth = 0 } = this.component.parent.bounds
167
- var { tx = 0 } = this.component.delta() as DELTA
168
-
169
- return x + tx - parentWidth / 2
170
- }
171
-
172
- get cy() {
173
- var { y = 0 } = this.component.center
174
- var { height: parentHeight = 0 } = this.component.parent.bounds
175
- var { ty = 0 } = this.component.delta() as DELTA
176
-
177
- return y + ty - parentHeight / 2
178
- }
179
-
180
- get cz() {
181
- var { zPos = 0, depth = 1 } = this.component.state
182
- var { tz = 0 } = this.component.delta() as DELTA
183
-
184
- return zPos + tz + depth / 2
185
- }
186
-
187
- get center() {
188
- var { x = 0, y = 0 } = this.component.center
189
- var { width: parentWidth = 0, height: parentHeight = 0 } = this.component.parent.bounds
190
-
191
- var { tx = 0, ty = 0, tz = 0 } = this.component.delta() as DELTA
192
-
193
- return {
194
- x: x + tx - parentWidth / 2,
195
- y: y + ty - parentHeight / 2,
196
- z: this.cz
197
- }
198
- }
199
-
200
- get dimension() {
201
- const { width, height } = this.component.bounds
202
- const { depth } = this.component.state
203
- return {
204
- width,
205
- height,
206
- depth
207
- }
208
- }
209
-
210
- /**
211
- * Object3D 모델의 변화를 Component의 모델값에 반영
212
- */
213
- // updateTransformReverse() {
214
- // var { rotation, position, scale } = this.object3d
215
-
216
- // this.component.set({
217
- // rotate: {
218
- // x: rotation.x,
219
- // y: rotation.y,
220
- // z: rotation.z
221
- // },
222
- // translate: {
223
- // x: position.x,
224
- // y: position.y,
225
- // z: position.z
226
- // },
227
- // scale: {
228
- // x: scale.x,
229
- // y: scale.y,
230
- // z: scale.z
231
- // }
232
- // })
233
- // }
234
-
235
- /* update functions - 전체적인 rebuilding이 필요하지 않은 update 기능 들임 */
236
- updatePosition() {
237
- var { x = 0, y = 0, z = 0 } = this.position
238
- this.object3d.position.set(x, y, z)
239
- }
240
-
241
- updateRotate() {
242
- var { x = 0, y = 0, z = 0 } = this.rotation
243
- this.object3d.rotation.set(x, y, z)
244
- }
245
-
246
- updateScale() {
247
- var { x = 1, y = 1, z = 1 } = this.scale
248
- this.object3d.scale.set(Math.max(x, SCALE_MIN), Math.max(y, SCALE_MIN), Math.max(z, SCALE_MIN))
249
- }
250
-
251
- updateDimension() {
252
- var { width, height, depth } = this.dimension
253
- this.object3d.scale.set(width, height, depth)
254
- }
255
-
256
- updateAlpha() {
257
- var { alpha } = this.component.state
258
-
259
- alpha = alpha == undefined ? 1 : alpha
260
-
261
- this.object3d.traverse((o: any) => {
262
- var materials = o.material
263
- if (!o.material) return
264
-
265
- if (!Array.isArray(materials)) {
266
- materials = [materials]
267
- }
268
-
269
- materials.forEach((m: any) => {
270
- m.opacity *= alpha
271
- m.transparent = alpha < 1
272
- })
273
- })
274
- }
275
-
276
- updateHidden() {
277
- this.object3d.visible = !this.component.state.hidden
278
- }
279
-
280
- updateStrokeStyle() {}
281
- updateFillStyle() {}
282
- updateText() {}
283
-
284
- onchange(after: Properties, before: Properties) {
285
- if (hasProperties(['cx', 'cy', 'cz', 'zPos', 'left', 'top'], after)) {
286
- this.updatePosition()
287
- }
288
-
289
- if (hasProperties(['width', 'height', 'depth'], after)) {
290
- this.updateDimension()
291
- }
292
-
293
- if (hasProperties(['rotationX', 'rotationY', 'rotation'], after)) {
294
- this.updateRotate()
295
- }
296
-
297
- if ('scale' in after) {
298
- this.updateScale()
299
- }
300
-
301
- if ('hidden' in after) {
302
- this.updateHidden()
303
- }
304
-
305
- if ('alpha' in after) {
306
- this.updateAlpha()
307
- }
308
-
309
- if ('strokeStyle' in after) {
310
- this.updateStrokeStyle()
311
- }
312
-
313
- if ('fillStyle' in after) {
314
- this.updateFillStyle()
315
- }
316
-
317
- if ('text' in after) {
318
- this.updateText()
319
- }
320
- }
321
- }