zincjs 1.16.2 → 1.16.3

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zincjs",
3
- "version": "1.16.2",
3
+ "version": "1.16.3",
4
4
  "description": "ZincJS (Web-based-Zinc-Visualisation)",
5
5
  "main": "build/zinc.js",
6
6
  "directories": {
@@ -0,0 +1,317 @@
1
+ const THREE = require('three');
2
+ const shader = require("../shaders/volumeRender.js");
3
+ /**
4
+ * Provides a class which create a texture stacks in a block
5
+ * with shaders allowing slices of texture to be displayed.
6
+ *
7
+ * @param {TextureArray} textureIn - An object of texture array
8
+ * holding texture information.
9
+ *
10
+ * @class
11
+ * @author Alan Wu
12
+ * @return {TextureSlides}
13
+ */
14
+ const TextureSlides = function (textureIn) {
15
+ (require('./texturePrimitive.js').TexturePrimitive).call(this, textureIn);
16
+ this.isTextureVolume = true;
17
+ const textureSettings = [];
18
+ this.morph = new THREE.Group();
19
+ this.group = this.morph;
20
+ this.morph.userData = this;
21
+ let edgesLine = undefined;
22
+ let flipY = true;
23
+
24
+ /**
25
+ @typedef SLIDE_SETTINGS
26
+ @type {Set}
27
+ @property {String} direction - the value must be x, y or z, specify the
28
+ direction the slide should be facing.
29
+ @property {Number} value - Normalised value of the location on direction.
30
+ @property {String} id - ID of the mesh, it is only available if the settings
31
+ is returned from {@link TextureSlides.createSlide} or
32
+ {@link TextureSlides.getTextureSettings}.
33
+ */
34
+ /**
35
+ * Create the slides required for visualisation based on the slide settings.
36
+ * The slides themselves are {THREE.PlanGeometry} objects.
37
+ *
38
+ * @param {SLIDE_SETTINGS} slideSettings - An array to each slide settings.
39
+ */
40
+ this.createSlides = slideSettings => {
41
+ slideSettings.forEach(slide => this.createSlide(slide));
42
+ }
43
+
44
+ /**
45
+ * Set the value of the uniforms for a specific mesh in this
46
+ * texture slide object.
47
+ *
48
+ * @param {THREE.Mesh} mesh - Mesh to be modified
49
+ * @param {SLIDE_SETTINGS} slideSettings - Slide settings.
50
+ */
51
+ const setUniformSlideSettingsOfMesh = (mesh, settings) => {
52
+ const material = mesh.material;
53
+ const uniforms = material.uniforms;
54
+ mesh.rotation.x = 0;
55
+ mesh.rotation.y = 0;
56
+ mesh.rotation.z = 0;
57
+ mesh.position.x = 0;
58
+ mesh.position.y = 0;
59
+ mesh.position.z = 0;
60
+ switch (settings.direction) {
61
+ case "x":
62
+ const rotation = -Math.PI / 2;
63
+ mesh.rotation.y = rotation;
64
+ uniforms.direction.value = 1;
65
+ uniforms.slide.value.set(settings.value, 0, 0);
66
+ mesh.position.x = settings.value;
67
+ break;
68
+ case "y":
69
+ mesh.rotation.x = Math.PI / 2;
70
+ uniforms.direction.value = 2;
71
+ uniforms.slide.value.set(0, settings.value, 0);
72
+ mesh.position.y = settings.value;
73
+ break;
74
+ case "z":
75
+ uniforms.direction.value = 3;
76
+ uniforms.slide.value.set(0, 0, settings.value);
77
+ mesh.position.z = settings.value;
78
+ break;
79
+ default:
80
+ break;
81
+ }
82
+ material.needsUpdate = true;
83
+ this.boundingBoxUpdateRequired = true;
84
+ }
85
+
86
+ /**
87
+ * Modify the mesh based on a setting
88
+ *
89
+ * @param {SLIDE_SETTINGS} settings - s.
90
+ */
91
+ this.modifySlideSettings = (settings) => {
92
+ if (settings && settings.id &&
93
+ settings.id in idTextureMap &&
94
+ idTextureMap[settings.id]) {
95
+ setUniformSlideSettingsOfMesh(idTextureMap[settings.id], settings);
96
+ }
97
+ }
98
+
99
+ /**
100
+ * Create a slide required for visualisation based on the slide settings.
101
+ * The slide itself is an {THREE.PlanGeometry} object.
102
+ *
103
+ * @param {SLIDE_SETTINGS} settings -settings of the slide to be created.
104
+ * @return {SLIDE_SETTINGS} - Returned settings, it includes the newly
105
+ * created mesh's id.
106
+ */
107
+ this.createSlide = settings => {
108
+ if (this.texture && this.texture.isTextureArray && this.texture.isReady()) {
109
+ if (settings && settings.direction && settings.value !== undefined) {
110
+ const geometry = new THREE.PlaneGeometry(1, 1);
111
+ geometry.translate(0.5, 0.5, 0);
112
+ const uniforms = shader.getUniforms();
113
+ uniforms.diffuse.value = this.texture.impl;
114
+ uniforms.depth.value = this.texture.size.depth;
115
+ uniforms.flipY.value = flipY;
116
+
117
+ const options = {
118
+ fs: shader.fs,
119
+ vs: shader.vs,
120
+ uniforms: uniforms,
121
+ glslVersion: shader.glslVersion,
122
+ side: THREE.DoubleSide,
123
+ transparent: false
124
+ };
125
+ const material = this.texture.getMaterial(options);
126
+ material.needsUpdate = true;
127
+ const mesh = new THREE.Mesh(geometry, material);
128
+ mesh.name = this.groupName;
129
+ mesh.userData = this;
130
+ const slideSettings = {
131
+ value: settings.value,
132
+ direction: settings.direction,
133
+ id: mesh.id,
134
+ };
135
+ textureSettings.push(slideSettings);
136
+ setUniformSlideSettingsOfMesh(mesh, slideSettings);
137
+ idTextureMap[mesh.id] = mesh;
138
+ this.morph.add(mesh);
139
+ this.boundingBoxUpdateRequired = true;
140
+ return slideSettings;
141
+ }
142
+ }
143
+ }
144
+
145
+ /**
146
+ * Return a copy of texture settings used by this object.
147
+ *
148
+ * @return {SLIDE_SETTINGS} - Returned the list of settings.
149
+ */
150
+ this.getTextureSettings = () => {
151
+ return [...textureSettings];
152
+ }
153
+
154
+ /**
155
+ * Return a copy of texture settings with corresponding id used by this object.
156
+ *
157
+ * @return {SLIDE_SETTINGS} - Returned a copy of settings with corresponding id.
158
+ */
159
+ this.getTextureSettingsWithId = (id) => {
160
+ for (let i = 0; i < textureSettings.length; i++) {
161
+ if (id === textureSettings[i].id) {
162
+ return {...textureSettings[i]};
163
+ }
164
+ }
165
+ }
166
+
167
+ /**
168
+ * Get the array of slides, return them in an array
169
+ *
170
+ * @return {Array} - Return an array of {@link THREE.Object)
171
+ */
172
+ this.getSlides = () => {
173
+ if (this.morph) return [...this.morph.children];
174
+ return [];
175
+ }
176
+
177
+ /**
178
+ * Clean up all internal objects.
179
+ */
180
+ this.dispose = () => {
181
+ this.morph.children.forEach(slide => {
182
+ if (slide.geometry)
183
+ slide.geometry.dispose();
184
+ if (slide.material)
185
+ slide.material.dispose();
186
+ });
187
+ (require('./texturePrimitive.js').TexturePrimitive).prototype.dispose.call(this);
188
+ this.boundingBoxUpdateRequired = true;
189
+ }
190
+
191
+ //Expand the boundingbox with slide settings
192
+ const expandBoxWithSettings = (box, settings, vector) => {
193
+ if (settings) {
194
+ switch (settings.direction.value) {
195
+ case 1:
196
+ vector.copy(settings.slide.value);
197
+ box.expandByPoint(vector);
198
+ vector.setY(1.0);
199
+ vector.setZ(1.0);
200
+ box.expandByPoint(vector);
201
+ break;
202
+ case 2:
203
+ vector.copy(settings.slide.value);
204
+ box.expandByPoint(vector);
205
+ vector.setX(1.0);
206
+ vector.setZ(1.0);
207
+ box.expandByPoint(vector);
208
+ break;
209
+ case 3:
210
+ vector.copy(settings.slide.value);
211
+ box.expandByPoint(vector);
212
+ vector.setX(1.0);
213
+ vector.setY(1.0);
214
+ box.expandByPoint(vector);
215
+ break;
216
+ default:
217
+ break;
218
+ }
219
+ }
220
+ }
221
+
222
+ /**
223
+ * Get the bounding box of this slides.
224
+ * It uses the max and min of the slides position and the
225
+ * transformation to calculate the position of the box.
226
+ *
227
+ * @return {THREE.Box3}.
228
+ */
229
+ this.getBoundingBox = () => {
230
+ if (this.morph && this.morph.children && this.morph.visible &&
231
+ this.boundingBoxUpdateRequired) {
232
+ this.cachedBoundingBox.makeEmpty();
233
+ const vector = new THREE.Vector3(0, 0, 0);
234
+ this.morph.children.forEach(slide => {
235
+ expandBoxWithSettings(this.cachedBoundingBox, slide.material.uniforms,
236
+ vector);
237
+ });
238
+ this.morph.updateMatrixWorld (true, true);
239
+ this.cachedBoundingBox.applyMatrix4(this.morph.matrixWorld);
240
+ this.boundingBoxUpdateRequired = false;
241
+ }
242
+ return this.cachedBoundingBox;
243
+ }
244
+
245
+ this.applyTransformation = (rotation, position, scale) => {
246
+ const matrix = new THREE.Matrix4();
247
+ matrix.set(
248
+ rotation[0],
249
+ rotation[1],
250
+ rotation[2],
251
+ 0,
252
+ rotation[3],
253
+ rotation[4],
254
+ rotation[5],
255
+ 0,
256
+ rotation[6],
257
+ rotation[7],
258
+ rotation[8],
259
+ 0,
260
+ 0,
261
+ 0,
262
+ 0,
263
+ 0
264
+ );
265
+ const quaternion = new THREE.Quaternion().setFromRotationMatrix(matrix);
266
+ this.morph.position.set(...position);
267
+ this.morph.quaternion.copy( quaternion );
268
+ this.morph.scale.set(...scale);
269
+ this.morph.updateMatrix();
270
+ this.boundingBoxUpdateRequired = true;
271
+ }
272
+
273
+ this.setRenderOrder = (order) => {
274
+ //multiilayers
275
+ this.morph.renderOrder = order;
276
+ }
277
+
278
+ this.initialise = (textureData, finishCallback) => {
279
+ if (textureData) {
280
+ const locations = textureData.locations;
281
+ if (locations && locations.length > 0) {
282
+ this.applyTransformation(locations[0].orientation,
283
+ locations[0].position, locations[0].scale);
284
+ if ("flipY" in locations[0]) {
285
+ flipY = locations[0].flipY;
286
+ }
287
+ }
288
+ this.createSlides(textureData.settings.slides);
289
+ if (finishCallback != undefined && (typeof finishCallback == 'function')) {
290
+ finishCallback(this);
291
+ }
292
+ }
293
+ }
294
+
295
+ this.showEdges = (color) => {
296
+ if (!edgesLine) {
297
+ const geometry = new THREE.BoxGeometry( 1, 1, 1 );
298
+ geometry.translate(0.5, 0.5, 0.5);
299
+ const edges = new THREE.EdgesGeometry( geometry );
300
+ edgesLine = new THREE.LineSegments(edges, new THREE.LineBasicMaterial( { color } ) );
301
+ this.group.add( edgesLine );
302
+ } else {
303
+ edgesLine.material.color = color;
304
+ }
305
+ edgesLine.visible = true;
306
+ }
307
+
308
+ this.hideEdges = () => {
309
+ if (edgesLine) {
310
+ edgesLine.visible = false;
311
+ }
312
+ }
313
+ }
314
+
315
+ TextureSlides.prototype = Object.create((require('./texturePrimitive.js').TexturePrimitive).prototype);
316
+ TextureSlides.prototype.constructor = TextureSlides;
317
+ exports.TextureSlides = TextureSlides;
@@ -11,7 +11,7 @@ const getUniqueId = function () {
11
11
  /**
12
12
  * Provides the base object for other primitive types.
13
13
  * This class contains multiple base methods.
14
- *
14
+ *
15
15
  * @class
16
16
  * @author Alan Wu
17
17
  * @return {ZincObject}
@@ -33,7 +33,7 @@ const ZincObject = function() {
33
33
  this.mixer = undefined;
34
34
  this.animationGroup = undefined;
35
35
  /**
36
- * Total duration of the animation, this value interacts with the
36
+ * Total duration of the animation, this value interacts with the
37
37
  * {@link Renderer#playRate} to produce the actual duration of the
38
38
  * animation. Actual time in second = duration / playRate.
39
39
  */
@@ -69,7 +69,7 @@ const ZincObject = function() {
69
69
 
70
70
  /**
71
71
  * Set the duration of the animation of this object.
72
- *
72
+ *
73
73
  * @param {Number} durationIn - Duration of the animation.
74
74
  */
75
75
  ZincObject.prototype.setDuration = function(durationIn) {
@@ -81,7 +81,7 @@ ZincObject.prototype.setDuration = function(durationIn) {
81
81
 
82
82
  /**
83
83
  * Get the duration of the animation of this object.
84
- *
84
+ *
85
85
  * @return {Number}
86
86
  */
87
87
  ZincObject.prototype.getDuration = function() {
@@ -99,7 +99,7 @@ ZincObject.prototype.setRegion = function(region) {
99
99
 
100
100
  /**
101
101
  * Get the region this object belongs to.
102
- *
102
+ *
103
103
  * @return {Region}
104
104
  */
105
105
  ZincObject.prototype.getRegion = function() {
@@ -107,8 +107,8 @@ ZincObject.prototype.getRegion = function() {
107
107
  }
108
108
 
109
109
  /**
110
- * Get the threejs object3D.
111
- *
110
+ * Get the threejs object3D.
111
+ *
112
112
  * @return {Object}
113
113
  */
114
114
  ZincObject.prototype.getMorph = function() {
@@ -117,8 +117,8 @@ ZincObject.prototype.getRegion = function() {
117
117
  }
118
118
 
119
119
  /**
120
- * Get the threejs object3D.
121
- *
120
+ * Get the threejs object3D.
121
+ *
122
122
  * @return {Object}
123
123
  */
124
124
  ZincObject.prototype.getGroup = function() {
@@ -126,7 +126,7 @@ ZincObject.prototype.getRegion = function() {
126
126
  }
127
127
 
128
128
  /**
129
- * Set the internal threejs object3D.
129
+ * Set the internal threejs object3D.
130
130
  */
131
131
  ZincObject.prototype.setMorph = function(mesh) {
132
132
  this.morph = mesh;
@@ -147,7 +147,7 @@ ZincObject.prototype.checkTransparentMesh = function() {
147
147
 
148
148
  /**
149
149
  * Set the mesh function for zincObject.
150
- *
150
+ *
151
151
  * @param {THREE.Mesh} mesh - Mesh to be set for this zinc object.
152
152
  * @param {Boolean} localTimeEnabled - A flag to indicate either the mesh is
153
153
  * time dependent.
@@ -201,7 +201,7 @@ ZincObject.prototype.setMesh = function(mesh, localTimeEnabled, localMorphColour
201
201
 
202
202
  /**
203
203
  * Set isPickable for this ZincObject.
204
- *
204
+ *
205
205
  * @param {String} isPickable - Boolean to enable object pick.
206
206
  */
207
207
  ZincObject.prototype.setIsPickable = function(isPickable) {
@@ -213,7 +213,7 @@ ZincObject.prototype.setIsPickable = function(isPickable) {
213
213
 
214
214
  /**
215
215
  * Set the anatomicalId for this ZincObject.
216
- *
216
+ *
217
217
  * @param {String} anatomicalId - Id to be set.
218
218
  */
219
219
  ZincObject.prototype.setAnatomicalId = function(anatomicalId) {
@@ -222,7 +222,7 @@ ZincObject.prototype.setAnatomicalId = function(anatomicalId) {
222
222
 
223
223
  /**
224
224
  * Set the name for this ZincObject.
225
- *
225
+ *
226
226
  * @param {String} groupNameIn - Name to be set.
227
227
  */
228
228
  ZincObject.prototype.setName = function(groupNameIn) {
@@ -231,9 +231,9 @@ ZincObject.prototype.setName = function(groupNameIn) {
231
231
  }
232
232
 
233
233
  /**
234
- * Get the local time of this geometry, it returns a value between
234
+ * Get the local time of this geometry, it returns a value between
235
235
  * 0 and the duration.
236
- *
236
+ *
237
237
  * @return {Number}
238
238
  */
239
239
  ZincObject.prototype.getCurrentTime = function() {
@@ -247,7 +247,7 @@ ZincObject.prototype.getCurrentTime = function() {
247
247
 
248
248
  /**
249
249
  * Set the local time of this geometry.
250
- *
250
+ *
251
251
  * @param {Number} time - Can be any value between 0 to duration.
252
252
  */
253
253
  ZincObject.prototype.setMorphTime = function(time) {
@@ -264,7 +264,7 @@ ZincObject.prototype.setMorphTime = function(time) {
264
264
  this.mixer.update( 0.0 );
265
265
  }
266
266
  } else {
267
- let newTime = time;
267
+ let newTime = time;
268
268
  if (time > this.duration)
269
269
  newTime = this.duration;
270
270
  else if (0 > time)
@@ -286,7 +286,7 @@ ZincObject.prototype.setMorphTime = function(time) {
286
286
 
287
287
  /**
288
288
  * Check if the geometry is time varying.
289
- *
289
+ *
290
290
  * @return {Boolean}
291
291
  */
292
292
  ZincObject.prototype.isTimeVarying = function() {
@@ -297,7 +297,7 @@ ZincObject.prototype.isTimeVarying = function() {
297
297
 
298
298
  /**
299
299
  * Get the visibility of this Geometry.
300
- *
300
+ *
301
301
  */
302
302
  ZincObject.prototype.getVisibility = function() {
303
303
  return this.visible;
@@ -305,8 +305,8 @@ ZincObject.prototype.getVisibility = function() {
305
305
 
306
306
  /**
307
307
  * Set the visibility of this Geometry.
308
- *
309
- * @param {Boolean} visible - a boolean flag indicate the visibility to be set
308
+ *
309
+ * @param {Boolean} visible - a boolean flag indicate the visibility to be set
310
310
  */
311
311
  ZincObject.prototype.setVisibility = function(visible) {
312
312
  if (visible !== this.visible) {
@@ -319,8 +319,8 @@ ZincObject.prototype.setVisibility = function(visible) {
319
319
  /**
320
320
  * Set the opacity of this Geometry. This function will also set the isTransparent
321
321
  * flag according to the provided alpha value.
322
- *
323
- * @param {Number} alpah - Alpha value to set for this geometry,
322
+ *
323
+ * @param {Number} alpah - Alpha value to set for this geometry,
324
324
  * can be any value between from 0 to 1.0.
325
325
  */
326
326
  ZincObject.prototype.setAlpha = function(alpha) {
@@ -337,7 +337,7 @@ ZincObject.prototype.setAlpha = function(alpha) {
337
337
  * The rendering will be culled if it is outside of the frustrum
338
338
  * when this flag is set to true, it should be set to false if
339
339
  * morphing is enabled.
340
- *
340
+ *
341
341
  * @param {Boolean} flag - Set frustrum culling on/off based on this flag.
342
342
  */
343
343
  ZincObject.prototype.setFrustumCulled = function(flag) {
@@ -348,7 +348,7 @@ ZincObject.prototype.setFrustumCulled = function(flag) {
348
348
  /**
349
349
  * Set rather a zinc object should be displayed using per vertex colour or
350
350
  * not.
351
- *
351
+ *
352
352
  * @param {Boolean} vertexColors - Set display with vertex color on/off.
353
353
  */
354
354
  ZincObject.prototype.setVertexColors = function(vertexColors) {
@@ -359,7 +359,7 @@ ZincObject.prototype.setVertexColors = function(vertexColors) {
359
359
 
360
360
  /**
361
361
  * Get the colour of the mesh.
362
- *
362
+ *
363
363
  * @return {THREE.Color}
364
364
  */
365
365
  ZincObject.prototype.getColour = function() {
@@ -367,10 +367,10 @@ ZincObject.prototype.getColour = function() {
367
367
  return this._lod._material.color;
368
368
  return undefined;
369
369
  }
370
-
370
+
371
371
  /**
372
372
  * Set the colour of the mesh.
373
- *
373
+ *
374
374
  * @param {THREE.Color} colour - Colour to be set for this geometry.
375
375
  */
376
376
  ZincObject.prototype.setColour = function(colour) {
@@ -379,7 +379,7 @@ ZincObject.prototype.setColour = function(colour) {
379
379
 
380
380
  /**
381
381
  * Set the colour of the mesh.
382
- *
382
+ *
383
383
  * @param {THREE.Color} colour - Colour to be set for this geometry.
384
384
  */
385
385
  ZincObject.prototype.setGreyScale = function(flag) {
@@ -406,7 +406,7 @@ ZincObject.prototype.setGreyScale = function(flag) {
406
406
 
407
407
  /**
408
408
  * Get the colour of the mesh in hex string form.
409
- *
409
+ *
410
410
  * @return {String}
411
411
  */
412
412
  ZincObject.prototype.getColourHex = function() {
@@ -419,7 +419,7 @@ ZincObject.prototype.getColourHex = function() {
419
419
 
420
420
  /**
421
421
  * Set the colour of the mesh using hex in string form.
422
- *
422
+ *
423
423
  * @param {String} hex - The colour value in hex form.
424
424
  */
425
425
  ZincObject.prototype.setColourHex = function(hex) {
@@ -431,7 +431,7 @@ ZincObject.prototype.setColourHex = function(hex) {
431
431
 
432
432
  /**
433
433
  * Set the emissive rgb of the mesh using rgb.
434
- *
434
+ *
435
435
  * @param {String} colour - The colour value in rgb form.
436
436
  */
437
437
  ZincObject.prototype.setEmissiveRGB = function(colour) {
@@ -446,7 +446,7 @@ ZincObject.prototype.setEmissiveRGB = function(colour) {
446
446
 
447
447
  /**
448
448
  * Set the material of the geometry.
449
- *
449
+ *
450
450
  * @param {THREE.Material} material - Material to be set for this geometry.
451
451
  */
452
452
  ZincObject.prototype.setMaterial = function(material) {
@@ -455,17 +455,17 @@ ZincObject.prototype.setMaterial = function(material) {
455
455
 
456
456
  /**
457
457
  * Get the index of the closest vertex to centroid.
458
- *
458
+ *
459
459
  * @return {Number} - integer index in the array
460
460
  */
461
461
  ZincObject.prototype.getClosestVertexIndex = function() {
462
462
  let closestIndex = -1;
463
463
  const morph = this.getMorph();
464
- if (morph && morph.geoemtry) {
464
+ if (morph && morph.geometry) {
465
465
  let position = morph.geometry.attributes.position;
466
- this._b1.setFromBufferAttribute(position);
467
- this._b1.getCenter(this._v1);
468
466
  if (position) {
467
+ this._b1.setFromBufferAttribute(position);
468
+ this._b1.getCenter(this._v1);
469
469
  let distance = -1;
470
470
  let currentDistance = 0;
471
471
  for (let i = 0; i < position.count; i++) {
@@ -485,7 +485,7 @@ ZincObject.prototype.getClosestVertexIndex = function() {
485
485
 
486
486
  /**
487
487
  * Get the closest vertex to centroid.
488
- *
488
+ *
489
489
  * @return {THREE.Vector3}
490
490
  */
491
491
  ZincObject.prototype.getClosestVertex = function(applyMatrixWorld) {
@@ -516,14 +516,15 @@ ZincObject.prototype.getClosestVertex = function(applyMatrixWorld) {
516
516
  return applyMatrixWorld ? position.applyMatrix4(morph.matrixWorld) : position;
517
517
  }
518
518
  }
519
+ //Matrix world has already been applied
519
520
  this.getBoundingBox();
520
521
  position.copy(this.center);
521
- return applyMatrixWorld ? position.applyMatrix4(this.morph.matrixWorld) : position;
522
+ return position;
522
523
  }
523
524
 
524
525
  /**
525
526
  * Get the bounding box of this geometry.
526
- *
527
+ *
527
528
  * @return {THREE.Box3}.
528
529
  */
529
530
  ZincObject.prototype.getBoundingBox = function() {
@@ -558,13 +559,13 @@ ZincObject.prototype.dispose = function() {
558
559
  }
559
560
 
560
561
  /**
561
- * Check if marker is enabled based on the objects settings with
562
+ * Check if marker is enabled based on the objects settings with
562
563
  * the provided scene options.
563
- *
564
- * @return {Boolean}
564
+ *
565
+ * @return {Boolean}
565
566
  */
566
567
  ZincObject.prototype.markerIsRequired = function(options) {
567
- if (this.visible &&
568
+ if (this.visible &&
568
569
  (this.markerMode === "on" || (options && options.displayMarkers &&
569
570
  (this.markerMode === "inherited")))) {
570
571
  return true;
@@ -573,7 +574,7 @@ ZincObject.prototype.markerIsRequired = function(options) {
573
574
  }
574
575
 
575
576
  /**
576
- * Update the marker's position and size based on current viewport.
577
+ * Update the marker's position and size based on current viewport.
577
578
  */
578
579
  ZincObject.prototype.updateMarker = function(playAnimation, options) {
579
580
  if ((playAnimation == false) &&
@@ -594,7 +595,7 @@ ZincObject.prototype.updateMarker = function(playAnimation, options) {
594
595
  }
595
596
  if (!this.marker.isEnabled()) {
596
597
  if (options.markersList &&
597
- (!(this.marker.uuid in options.markersList))) {
598
+ (!(this.marker.uuid in options.markersList))) {
598
599
  ndcToBeUpdated = true;
599
600
  options.markersList[this.marker.uuid] = this.marker;
600
601
  }
@@ -647,7 +648,7 @@ ZincObject.prototype.setRenderOrder = function(renderOrder) {
647
648
 
648
649
  /**
649
650
  * Get the windows coordinates.
650
- *
651
+ *
651
652
  * @return {Object} - position and rather the closest vertex is on screen.
652
653
  */
653
654
  ZincObject.prototype.getClosestVertexDOMElementCoords = function(scene) {
@@ -675,8 +676,8 @@ ZincObject.prototype.getClosestVertexDOMElementCoords = function(scene) {
675
676
  * "off" - marker is disabled regardless of settings of scene
676
677
  * "inherited" - Marker settings on scene will determine the visibility
677
678
  * of the marker.
678
- *
679
- * @return {Boolean}
679
+ *
680
+ * @return {Boolean}
680
681
  */
681
682
  ZincObject.prototype.setMarkerMode = function(mode, options) {
682
683
  if (mode !== this.markerMode) {
@@ -764,7 +765,9 @@ ZincObject.prototype.setPosition = function(x, y, z) {
764
765
  const group = this.getGroup();
765
766
  if (group) {
766
767
  group.position.set(x, y, z);
768
+ group.matrixWorldNeedsUpdate = true;
767
769
  group.updateMatrix();
770
+ group.updateWorldMatrix(true, true);
768
771
  this.boundingBoxUpdateRequired = true;
769
772
  }
770
773
  }