zincjs 1.1.0 → 1.2.0
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/CHANGELOG.md +11 -1
- package/build/zinc.frontend.js +1 -1
- package/build/zinc.js +20 -4
- package/build/zinc.js.map +1 -1
- package/package.json +1 -1
- package/src/primitives/zincObject.js +40 -1
- package/src/region.js +6 -10
- package/src/scene.js +1 -2
package/package.json
CHANGED
|
@@ -50,6 +50,7 @@ const ZincObject = function() {
|
|
|
50
50
|
this.anatomicalId = undefined;
|
|
51
51
|
this.region = undefined;
|
|
52
52
|
this.animationClip = undefined;
|
|
53
|
+
this.markerMode = "inherited";
|
|
53
54
|
this.uuid = getUniqueId();
|
|
54
55
|
}
|
|
55
56
|
|
|
@@ -565,12 +566,27 @@ ZincObject.prototype.dispose = function() {
|
|
|
565
566
|
this.groupName = undefined;
|
|
566
567
|
}
|
|
567
568
|
|
|
569
|
+
/**
|
|
570
|
+
* Check if marker is enabled based on the objects settings with
|
|
571
|
+
* the provided scene options.
|
|
572
|
+
*
|
|
573
|
+
* @return {Boolean}
|
|
574
|
+
*/
|
|
575
|
+
ZincObject.prototype.markerIsEnabled = function(options) {
|
|
576
|
+
if (this.markerMode === "on" || (options && options.displayMarkers &&
|
|
577
|
+
(this.markerMode === "inherited"))) {
|
|
578
|
+
|
|
579
|
+
return true;
|
|
580
|
+
}
|
|
581
|
+
return false;
|
|
582
|
+
}
|
|
583
|
+
|
|
568
584
|
/**
|
|
569
585
|
* Update the marker's position and size based on current viewport.
|
|
570
586
|
*/
|
|
571
587
|
ZincObject.prototype.updateMarker = function(playAnimation, options) {
|
|
572
588
|
if ((playAnimation == false) &&
|
|
573
|
-
(options
|
|
589
|
+
(this.markerIsEnabled(options)))
|
|
574
590
|
{
|
|
575
591
|
if (this.groupName) {
|
|
576
592
|
if (!this.marker) {
|
|
@@ -645,6 +661,29 @@ ZincObject.prototype.getClosestVertexDOMElementCoords = function(scene) {
|
|
|
645
661
|
}
|
|
646
662
|
}
|
|
647
663
|
|
|
664
|
+
/**
|
|
665
|
+
* Set marker mode for this zinc object which determine rather the
|
|
666
|
+
* markers should be displayed or not.
|
|
667
|
+
*
|
|
668
|
+
* @param {string} mode - There are three options:
|
|
669
|
+
* "on" - marker is enabled regardless of settings of scene
|
|
670
|
+
* "off" - marker is disabled regardless of settings of scene
|
|
671
|
+
* "inherited" - Marker settings on scene will determine the visibility
|
|
672
|
+
* of the marker.
|
|
673
|
+
*
|
|
674
|
+
* @return {Boolean}
|
|
675
|
+
*/
|
|
676
|
+
ZincObject.prototype.setMarkerMode = function(mode) {
|
|
677
|
+
if (mode !== this.markerMode) {
|
|
678
|
+
if (mode === "on" || mode === "off") {
|
|
679
|
+
this.markerMode = mode;
|
|
680
|
+
} else {
|
|
681
|
+
this.markerMode = "inherited";
|
|
682
|
+
}
|
|
683
|
+
if (this.region) this.region.pickableUpdateRequired = true;
|
|
684
|
+
}
|
|
685
|
+
}
|
|
686
|
+
|
|
648
687
|
//Update the geometry and colours depending on the morph.
|
|
649
688
|
ZincObject.prototype.render = function(delta, playAnimation, options) {
|
|
650
689
|
if (playAnimation == true)
|
package/src/region.js
CHANGED
|
@@ -338,23 +338,19 @@ let Region = function (parentIn) {
|
|
|
338
338
|
/**
|
|
339
339
|
* Get all pickable objects.
|
|
340
340
|
*/
|
|
341
|
-
this.getPickableThreeJSObjects = (objectsList,
|
|
341
|
+
this.getPickableThreeJSObjects = (objectsList, transverse) => {
|
|
342
342
|
zincObjects.forEach(zincObject => {
|
|
343
343
|
if (zincObject.morph && zincObject.morph.visible) {
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
objectsList.push(marker.morph);
|
|
348
|
-
}
|
|
349
|
-
} else {
|
|
350
|
-
objectsList.push(zincObject.morph);
|
|
344
|
+
let marker = zincObject.marker;
|
|
345
|
+
if (marker && marker.isEnabled()) {
|
|
346
|
+
objectsList.push(marker.morph);
|
|
351
347
|
}
|
|
348
|
+
objectsList.push(zincObject.morph);
|
|
352
349
|
}
|
|
353
350
|
});
|
|
354
351
|
if (transverse) {
|
|
355
352
|
children.forEach(childRegion => {
|
|
356
|
-
childRegion.getPickableThreeJSObjects(objectsList,
|
|
357
|
-
transverse);
|
|
353
|
+
childRegion.getPickableThreeJSObjects(objectsList, transverse);
|
|
358
354
|
});
|
|
359
355
|
}
|
|
360
356
|
this.pickableUpdateRequired = false;
|
package/src/scene.js
CHANGED
|
@@ -867,8 +867,7 @@ exports.Scene = function (containerIn, rendererIn) {
|
|
|
867
867
|
*/
|
|
868
868
|
this.updatePickableThreeJSObjects = () => {
|
|
869
869
|
pickableObjectsList.splice(0, pickableObjectsList.length);
|
|
870
|
-
rootRegion.getPickableThreeJSObjects(pickableObjectsList,
|
|
871
|
-
this.displayMarkers, true);
|
|
870
|
+
rootRegion.getPickableThreeJSObjects(pickableObjectsList, true);
|
|
872
871
|
this.forcePickableObjectsUpdate = false;
|
|
873
872
|
}
|
|
874
873
|
|