@abi-software/scaffoldvuer 1.2.1-beta.0 → 1.3.0-beta.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/dist/scaffoldvuer.js +15081 -14342
- package/dist/scaffoldvuer.umd.cjs +183 -184
- package/dist/style.css +1 -1
- package/package.json +2 -2
- package/src/App.vue +101 -58
- package/src/components/LinesControls.vue +126 -26
- package/src/components/PointsControls.vue +145 -2
- package/src/components/PrimitiveControls.vue +10 -4
- package/src/components/ScaffoldTooltip.vue +57 -3
- package/src/components/ScaffoldTreeControls.vue +18 -0
- package/src/components/ScaffoldVuer.vue +301 -128
- package/src/components/TransformationControls.vue +78 -18
- package/src/scripts/OrgansRenderer.js +43 -5
- package/src/scripts/RendererModule.js +12 -10
- package/src/scripts/Search.js +17 -1
- package/src/scripts/Utilities.js +76 -14
- package/src/store/index.js +1 -1
|
@@ -14,9 +14,10 @@
|
|
|
14
14
|
:visible="tData.visible"
|
|
15
15
|
:x="tData.x"
|
|
16
16
|
:y="tData.y"
|
|
17
|
-
:annotationDisplay="
|
|
17
|
+
:annotationDisplay="annotationDisplay"
|
|
18
18
|
@confirm-create="confirmCreate($event)"
|
|
19
19
|
@cancel-create="cancelCreate()"
|
|
20
|
+
@confirm-delete="confirmDelete($event)"
|
|
20
21
|
/>
|
|
21
22
|
<div
|
|
22
23
|
id="organsDisplayArea"
|
|
@@ -27,7 +28,7 @@
|
|
|
27
28
|
/>
|
|
28
29
|
<div v-show="displayUI && !isTransitioning">
|
|
29
30
|
<DrawToolbar
|
|
30
|
-
v-if="viewingMode === 'Annotation' && userInformation"
|
|
31
|
+
v-if="viewingMode === 'Annotation' && (userInformation || enableLocalAnnotations)"
|
|
31
32
|
:toolbarOptions="toolbarOptions"
|
|
32
33
|
:activeDrawTool="activeDrawTool"
|
|
33
34
|
:activeDrawMode="activeDrawMode"
|
|
@@ -103,7 +104,11 @@
|
|
|
103
104
|
</template>
|
|
104
105
|
</el-popover>
|
|
105
106
|
<div class="primitive-controls-box">
|
|
106
|
-
<primitive-controls
|
|
107
|
+
<primitive-controls
|
|
108
|
+
ref="primitiveControls"
|
|
109
|
+
:createData="createData"
|
|
110
|
+
@primitivesUpdated="primitivesUpdated"
|
|
111
|
+
/>
|
|
107
112
|
</div>
|
|
108
113
|
<el-popover
|
|
109
114
|
v-if="timeVarying"
|
|
@@ -390,6 +395,7 @@ import '@abi-software/map-utilities/dist/style.css'
|
|
|
390
395
|
import {
|
|
391
396
|
addUserAnnotationWithFeature,
|
|
392
397
|
annotationFeaturesToPrimitives,
|
|
398
|
+
getDeletableObjects,
|
|
393
399
|
getDrawnAnnotations,
|
|
394
400
|
getEditableLines,
|
|
395
401
|
getObjectsFromAnnotations,
|
|
@@ -664,12 +670,20 @@ export default {
|
|
|
664
670
|
type: String,
|
|
665
671
|
default: "https://mapcore-demo.org/current/flatmap/v3/"
|
|
666
672
|
},
|
|
673
|
+
/**
|
|
674
|
+
* Enable local annotations
|
|
675
|
+
*/
|
|
676
|
+
enableLocalAnnotations: {
|
|
677
|
+
type: Boolean,
|
|
678
|
+
default: false
|
|
679
|
+
},
|
|
667
680
|
},
|
|
668
681
|
provide() {
|
|
669
682
|
return {
|
|
670
683
|
flatmapAPI: this.flatmapAPI,
|
|
671
684
|
scaffoldUrl: this.url,
|
|
672
685
|
$annotator: this.annotator,
|
|
686
|
+
boundingDims: this.boundingDims,
|
|
673
687
|
};
|
|
674
688
|
},
|
|
675
689
|
data: function () {
|
|
@@ -684,6 +698,7 @@ export default {
|
|
|
684
698
|
y: 0,
|
|
685
699
|
editingIndex: -1,
|
|
686
700
|
faceIndex: -1,
|
|
701
|
+
toBeDeleted: false,
|
|
687
702
|
},
|
|
688
703
|
currentTime: 0.0,
|
|
689
704
|
timeVarying: false,
|
|
@@ -707,6 +722,7 @@ export default {
|
|
|
707
722
|
{ value: false, refs: 'toolbarPopover', ref: 'editPopover' }, // 9
|
|
708
723
|
{ value: false, refs: 'toolbarPopover', ref: 'pointPopover' }, // 10
|
|
709
724
|
{ value: false, refs: 'toolbarPopover', ref: 'lineStringPopover' }, // 11
|
|
725
|
+
{ value: false, refs: 'toolbarPopover', ref: 'deletePopover' }, // 11
|
|
710
726
|
],
|
|
711
727
|
inHelp: false,
|
|
712
728
|
helpModeActiveIndex: this.helpModeInitialIndex,
|
|
@@ -768,12 +784,18 @@ export default {
|
|
|
768
784
|
backgroundIconRef: undefined,
|
|
769
785
|
userInformation: undefined,
|
|
770
786
|
toolbarOptions: [
|
|
787
|
+
"Delete",
|
|
771
788
|
"Edit",
|
|
772
789
|
"Point",
|
|
773
790
|
"LineString",
|
|
774
791
|
],
|
|
775
792
|
activeDrawTool: undefined,
|
|
776
793
|
activeDrawMode: undefined,
|
|
794
|
+
localAnnotationsList: markRaw([]),
|
|
795
|
+
boundingDims: {
|
|
796
|
+
centre: [0, 0, 0],
|
|
797
|
+
size:[1, 1, 1],
|
|
798
|
+
},
|
|
777
799
|
};
|
|
778
800
|
},
|
|
779
801
|
watch: {
|
|
@@ -880,6 +902,7 @@ export default {
|
|
|
880
902
|
eventNotifier.subscribe(this, this.eventNotifierCallback);
|
|
881
903
|
this.$module.addNotifier(eventNotifier);
|
|
882
904
|
this.$module.addOrganPartAddedCallback(this.zincObjectAdded);
|
|
905
|
+
this.$module.addOrganPartRemovedCallback(this.zincObjectRemoved);
|
|
883
906
|
this.$module.initialiseRenderer(this.$refs.display);
|
|
884
907
|
this.toggleRendering(this.render);
|
|
885
908
|
this.ro = new ResizeObserver(this.adjustLayout).observe(
|
|
@@ -899,6 +922,10 @@ export default {
|
|
|
899
922
|
},
|
|
900
923
|
computed: {
|
|
901
924
|
...mapState(useMainStore, ['userToken']),
|
|
925
|
+
annotationDisplay: function() {
|
|
926
|
+
return this.viewingMode === 'Annotation' && this.tData.active === true &&
|
|
927
|
+
(this.activeDrawMode === 'Edit' || this.activeDrawMode === 'Delete');
|
|
928
|
+
}
|
|
902
929
|
},
|
|
903
930
|
methods: {
|
|
904
931
|
/**
|
|
@@ -927,6 +954,38 @@ export default {
|
|
|
927
954
|
//@arg The object added to the sceene
|
|
928
955
|
this.$emit("zinc-object-added", zincObject);
|
|
929
956
|
},
|
|
957
|
+
/**
|
|
958
|
+
* Internal only.
|
|
959
|
+
* Remove an entry matching region and group from
|
|
960
|
+
* local annotation list.
|
|
961
|
+
*/
|
|
962
|
+
removeFromLocalAnnotationList: function(regionPath, groupName) {
|
|
963
|
+
for (let i = 0; i < this.localAnnotationsList.length; i++) {
|
|
964
|
+
const annotation = this.localAnnotationsList[i];
|
|
965
|
+
if (annotation.region === regionPath &&
|
|
966
|
+
annotation.group === groupName) {
|
|
967
|
+
this.localAnnotationsList.splice(i, 1);
|
|
968
|
+
return;
|
|
969
|
+
}
|
|
970
|
+
}
|
|
971
|
+
},
|
|
972
|
+
/**
|
|
973
|
+
* Internal only.
|
|
974
|
+
* This is called when a zinc object is removed.
|
|
975
|
+
*/
|
|
976
|
+
zincObjectRemoved: function (zincObject) {
|
|
977
|
+
if (this.$module.scene) {
|
|
978
|
+
// zincObjectAdded will be alled in sequential callback
|
|
979
|
+
const regionPath = zincObject.region.getFullPath();
|
|
980
|
+
const groupName = zincObject.groupName;
|
|
981
|
+
const objects = zincObject.region.findObjectsWithGroupName(groupName, false);
|
|
982
|
+
//Remove relevant objects from the rest of the app.
|
|
983
|
+
if (objects.length === 0) {
|
|
984
|
+
this.$_searchIndex.removeZincObject(zincObject, zincObject.uuid);
|
|
985
|
+
this.removeFromLocalAnnotationList(regionPath, groupName);
|
|
986
|
+
}
|
|
987
|
+
}
|
|
988
|
+
},
|
|
930
989
|
/**
|
|
931
990
|
* Internal only.
|
|
932
991
|
* Add regions to search index.
|
|
@@ -993,6 +1052,38 @@ export default {
|
|
|
993
1052
|
if (this.$_searchIndex) this.$_searchIndex.removeAll();
|
|
994
1053
|
if (this.$module.scene) this.$module.scene.clearAll();
|
|
995
1054
|
},
|
|
1055
|
+
/**
|
|
1056
|
+
* @vuese
|
|
1057
|
+
* Add and edit local annotations
|
|
1058
|
+
*/
|
|
1059
|
+
addAndEditAnnotations: function (region, group, zincObject, comment) {
|
|
1060
|
+
const annotation =addUserAnnotationWithFeature(this.annotator, this.userToken, zincObject,
|
|
1061
|
+
region, group, this.url, comment);
|
|
1062
|
+
if (this.enableLocalAnnotations) {
|
|
1063
|
+
annotation.group = group;
|
|
1064
|
+
let regionPath = region;
|
|
1065
|
+
if (regionPath.slice(-1) === "/") {
|
|
1066
|
+
regionPath = regionPath.slice(0, -1);
|
|
1067
|
+
}
|
|
1068
|
+
annotation.region = regionPath;
|
|
1069
|
+
//Remove previous entry if there is matching region and group
|
|
1070
|
+
this.removeFromLocalAnnotationList(regionPath, group);
|
|
1071
|
+
this.localAnnotationsList.push(annotation);
|
|
1072
|
+
}
|
|
1073
|
+
},
|
|
1074
|
+
/**
|
|
1075
|
+
* @vuese
|
|
1076
|
+
* Callback for when primitives have been update using primitive controls.
|
|
1077
|
+
* This is only called from callback.
|
|
1078
|
+
*/
|
|
1079
|
+
primitivesUpdated: function(object) {
|
|
1080
|
+
if (object.isZincObject && object.isEditable) {
|
|
1081
|
+
const group = object.groupName;
|
|
1082
|
+
const region = object.region.getFullPath();
|
|
1083
|
+
this.addAndEditAnnotations(region, group, object, "Position Updated");
|
|
1084
|
+
}
|
|
1085
|
+
|
|
1086
|
+
},
|
|
996
1087
|
/**
|
|
997
1088
|
* @vuese
|
|
998
1089
|
* Confirm creation of new primitive. This is only called from callback.
|
|
@@ -1005,7 +1096,7 @@ export default {
|
|
|
1005
1096
|
payload.region,
|
|
1006
1097
|
payload.group,
|
|
1007
1098
|
this.createData.points,
|
|
1008
|
-
|
|
1099
|
+
payload.group,
|
|
1009
1100
|
0x0022ee,
|
|
1010
1101
|
);
|
|
1011
1102
|
} else if (payload.shape === "LineString") {
|
|
@@ -1017,17 +1108,15 @@ export default {
|
|
|
1017
1108
|
);
|
|
1018
1109
|
} else if (payload.editingIndex > -1) {
|
|
1019
1110
|
if (this._editingZincObject) {
|
|
1020
|
-
this._editingZincObject.
|
|
1111
|
+
this._editingZincObject.editVertices([this.createData.points[1]],
|
|
1021
1112
|
payload.editingIndex);
|
|
1022
1113
|
const region = this._editingZincObject.region.getFullPath() + "/";
|
|
1023
1114
|
const group = this._editingZincObject.groupName;
|
|
1024
|
-
|
|
1025
|
-
region, group, this.url, "Position Updated");
|
|
1115
|
+
this.addAndEditAnnotations(region, group, this._editingZincObject, "Position Updated");
|
|
1026
1116
|
}
|
|
1027
1117
|
}
|
|
1028
1118
|
if (object) {
|
|
1029
|
-
|
|
1030
|
-
payload.region, payload.group, this.url, "Create");
|
|
1119
|
+
this.addAndEditAnnotations(payload.region, payload.group, object.zincObject, "Create");
|
|
1031
1120
|
object.zincObject.isEditable = true;
|
|
1032
1121
|
this.tData.region = payload.region;
|
|
1033
1122
|
this.tData.label = payload.group;
|
|
@@ -1036,6 +1125,10 @@ export default {
|
|
|
1036
1125
|
}
|
|
1037
1126
|
this.cancelCreate();
|
|
1038
1127
|
},
|
|
1128
|
+
/**
|
|
1129
|
+
* Internal only.
|
|
1130
|
+
* Cancel create workflows. Reset all relevant UIs and data.
|
|
1131
|
+
*/
|
|
1039
1132
|
cancelCreate: function() {
|
|
1040
1133
|
this.createData.points.length = 0;
|
|
1041
1134
|
this.createData.toBeConfirmed = false;
|
|
@@ -1043,6 +1136,7 @@ export default {
|
|
|
1043
1136
|
this.createData.editingIndex = -1;
|
|
1044
1137
|
this.createData.faceIndex = -1;
|
|
1045
1138
|
this.tData.visible = false;
|
|
1139
|
+
this.createData.toBeDeleted = false;
|
|
1046
1140
|
if (this._tempLine) {
|
|
1047
1141
|
this.$module.scene.removeTemporaryPrimitive(this._tempLine);
|
|
1048
1142
|
this._tempLine = undefined;
|
|
@@ -1052,6 +1146,25 @@ export default {
|
|
|
1052
1146
|
this._tempPoint = undefined;
|
|
1053
1147
|
}
|
|
1054
1148
|
},
|
|
1149
|
+
/**
|
|
1150
|
+
* Internal only.
|
|
1151
|
+
* Confirm delete of user created primitive.
|
|
1152
|
+
* This is only called from callback.
|
|
1153
|
+
*/
|
|
1154
|
+
confirmDelete: function() {
|
|
1155
|
+
if (this._editingZincObject?.isEditable) {
|
|
1156
|
+
const regionPath = this._editingZincObject.region.getFullPath() + "/";
|
|
1157
|
+
const group = this._editingZincObject.groupName;
|
|
1158
|
+
const annotation = addUserAnnotationWithFeature(this.annotator, this.userToken,
|
|
1159
|
+
this._editingZincObject, regionPath, group, this.url, "Deleted");
|
|
1160
|
+
if (annotation) {
|
|
1161
|
+
const childRegion = this.$module.scene.getRootRegion().
|
|
1162
|
+
findChildFromPath(regionPath);
|
|
1163
|
+
childRegion.removeZincObject(this._editingZincObject);
|
|
1164
|
+
}
|
|
1165
|
+
}
|
|
1166
|
+
this.cancelCreate();
|
|
1167
|
+
},
|
|
1055
1168
|
formatTooltip(val) {
|
|
1056
1169
|
if (this.timeMax >= 1000) {
|
|
1057
1170
|
if (val) {
|
|
@@ -1144,12 +1257,13 @@ export default {
|
|
|
1144
1257
|
* @vuese
|
|
1145
1258
|
*/
|
|
1146
1259
|
toggleDrawing: function (type, icon) {
|
|
1260
|
+
this.createData.toBeDeleted = false;
|
|
1147
1261
|
if (type === 'mode') {
|
|
1148
|
-
this.activeDrawMode = icon
|
|
1262
|
+
this.activeDrawMode = icon;
|
|
1149
1263
|
this.createData.shape = '';
|
|
1150
1264
|
this.$module.selectObjectOnPick = true;
|
|
1151
1265
|
} else if (type === 'tool') {
|
|
1152
|
-
this.activeDrawTool = icon
|
|
1266
|
+
this.activeDrawTool = icon;
|
|
1153
1267
|
this.createData.shape = this.activeDrawTool;
|
|
1154
1268
|
this.$module.selectObjectOnPick = false;
|
|
1155
1269
|
}
|
|
@@ -1239,19 +1353,28 @@ export default {
|
|
|
1239
1353
|
}
|
|
1240
1354
|
},
|
|
1241
1355
|
drawPoint: function(coords, data) {
|
|
1242
|
-
this.createData.
|
|
1243
|
-
|
|
1244
|
-
this.showRegionTooltipWithAnnotations(data, true, true);
|
|
1245
|
-
this.createData.toBeConfirmed = true;
|
|
1246
|
-
},
|
|
1247
|
-
drawLine: function(coords, data) {
|
|
1248
|
-
if (this.createData.points.length === 1) {
|
|
1356
|
+
if (this.createData.toBeConfirmed === false) {
|
|
1357
|
+
this.createData.points.length = 0;
|
|
1249
1358
|
this.createData.points.push(coords);
|
|
1250
|
-
this.showRegionTooltipWithAnnotations(data, true,
|
|
1251
|
-
this.
|
|
1252
|
-
|
|
1359
|
+
this.showRegionTooltipWithAnnotations(data, true, false);
|
|
1360
|
+
this.tData.x = 50;
|
|
1361
|
+
this.tData.y = 200;
|
|
1253
1362
|
this._tempPoint = this.$module.scene.addTemporaryPoints([coords], 0xffff00);
|
|
1254
|
-
this.createData.
|
|
1363
|
+
this.createData.toBeConfirmed = true;
|
|
1364
|
+
}
|
|
1365
|
+
},
|
|
1366
|
+
drawLine: function(coords, data) {
|
|
1367
|
+
if (this.createData.toBeConfirmed === false) {
|
|
1368
|
+
if (this.createData.points.length === 1) {
|
|
1369
|
+
this.createData.points.push(coords);
|
|
1370
|
+
this.showRegionTooltipWithAnnotations(data, true, false);
|
|
1371
|
+
this.tData.x = 50;
|
|
1372
|
+
this.tData.y = 200;
|
|
1373
|
+
this.createData.toBeConfirmed = true;
|
|
1374
|
+
} else {
|
|
1375
|
+
this._tempPoint = this.$module.scene.addTemporaryPoints([coords], 0xffff00);
|
|
1376
|
+
this.createData.points.push(coords);
|
|
1377
|
+
}
|
|
1255
1378
|
}
|
|
1256
1379
|
},
|
|
1257
1380
|
/**
|
|
@@ -1281,7 +1404,8 @@ export default {
|
|
|
1281
1404
|
}
|
|
1282
1405
|
},
|
|
1283
1406
|
activateAnnotationMode: function(names, event) {
|
|
1284
|
-
if (this.userInformation) {
|
|
1407
|
+
if (this.userInformation || this.enableLocalAnnotations) {
|
|
1408
|
+
this.createData.toBeDeleted = false;
|
|
1285
1409
|
if ((this.createData.shape !== "") || (this.createData.editingIndex > -1)) {
|
|
1286
1410
|
// Create new shape bsaed on current settings
|
|
1287
1411
|
if (names.length > 0) {
|
|
@@ -1292,13 +1416,27 @@ export default {
|
|
|
1292
1416
|
}
|
|
1293
1417
|
}
|
|
1294
1418
|
} else {
|
|
1295
|
-
//Make sure the tooltip is displayed with
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
editing.
|
|
1419
|
+
//Make sure the tooltip is displayed with annotaion mode
|
|
1420
|
+
if (this.activeDrawMode === "Edit") {
|
|
1421
|
+
const editing = getEditableLines(event);
|
|
1422
|
+
if (editing) {
|
|
1423
|
+
this.activateEditingMode(editing.zincObject, editing.faceIndex,
|
|
1424
|
+
editing.vertexIndex, editing.point);
|
|
1425
|
+
}
|
|
1426
|
+
} else if (this.activeDrawMode === "Delete") {
|
|
1427
|
+
const zincObject = getDeletableObjects(event);
|
|
1428
|
+
if (zincObject) {
|
|
1429
|
+
this.createData.toBeDeleted = true;
|
|
1430
|
+
this._editingZincObject = zincObject;
|
|
1431
|
+
}
|
|
1432
|
+
}
|
|
1433
|
+
if (this.activeDrawMode === "Edit" || this.activeDrawMode === "Delete") {
|
|
1434
|
+
this.showRegionTooltipWithAnnotations(event.identifiers, true, false);
|
|
1435
|
+
this.tData.x = 50;
|
|
1436
|
+
this.tData.y = 200;
|
|
1437
|
+
} else {
|
|
1438
|
+
this.showRegionTooltipWithAnnotations(event.identifiers, true, true);
|
|
1300
1439
|
}
|
|
1301
|
-
this.showRegionTooltipWithAnnotations(event.identifiers, true, true);
|
|
1302
1440
|
}
|
|
1303
1441
|
} else {
|
|
1304
1442
|
this.showRegionTooltipWithAnnotations(event.identifiers, true, true);
|
|
@@ -1316,89 +1454,90 @@ export default {
|
|
|
1316
1454
|
*
|
|
1317
1455
|
*/
|
|
1318
1456
|
eventNotifierCallback: function (event) {
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
event.
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
});
|
|
1330
|
-
zincObjects = event.zincObjects;
|
|
1331
|
-
}
|
|
1332
|
-
/*
|
|
1333
|
-
* Event Type 1: Selected
|
|
1334
|
-
* Event Type 2: Highlighted
|
|
1335
|
-
* Event Type 3: Move
|
|
1336
|
-
*/
|
|
1337
|
-
if (event.eventType == 1) {
|
|
1338
|
-
if (this.viewingMode === 'Annotation') {
|
|
1339
|
-
this.activateAnnotationMode(names, event);
|
|
1340
|
-
|
|
1341
|
-
} else {
|
|
1342
|
-
if (this.$refs.scaffoldTreeControls) {
|
|
1343
|
-
if (names.length > 0) {
|
|
1344
|
-
//this.$refs.scaffoldTreeControls.changeActiveByNames(names, region, false);
|
|
1345
|
-
this.$refs.scaffoldTreeControls.updateActiveUI(zincObjects);
|
|
1346
|
-
this.updatePrimitiveControls(zincObjects);
|
|
1347
|
-
} else {
|
|
1348
|
-
this.hideRegionTooltip();
|
|
1349
|
-
this.$refs.scaffoldTreeControls.removeActive(false);
|
|
1457
|
+
if (!(this.createData.toBeConfirmed || this.createData.toBeDeleted)) {
|
|
1458
|
+
const names = [];
|
|
1459
|
+
let zincObjects = [];
|
|
1460
|
+
if (event.eventType == 1 || event.eventType == 2) {
|
|
1461
|
+
event.identifiers.forEach((identifier) => {
|
|
1462
|
+
if (identifier) {
|
|
1463
|
+
let id = identifier.data.id
|
|
1464
|
+
? identifier.data.id
|
|
1465
|
+
: identifier.data.group;
|
|
1466
|
+
names.push(id);
|
|
1350
1467
|
}
|
|
1351
|
-
}
|
|
1352
|
-
|
|
1353
|
-
//@arg Identifier of selected objects
|
|
1354
|
-
this.$emit("scaffold-selected", event.identifiers);
|
|
1468
|
+
});
|
|
1469
|
+
zincObjects = event.zincObjects;
|
|
1355
1470
|
}
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1471
|
+
/*
|
|
1472
|
+
* Event Type 1: Selected
|
|
1473
|
+
* Event Type 2: Highlighted
|
|
1474
|
+
* Event Type 3: Move
|
|
1475
|
+
*/
|
|
1476
|
+
if (event.eventType == 1) {
|
|
1477
|
+
if (this.viewingMode === 'Annotation') {
|
|
1478
|
+
this.activateAnnotationMode(names, event);
|
|
1479
|
+
} else {
|
|
1480
|
+
if (this.$refs.scaffoldTreeControls) {
|
|
1481
|
+
if (names.length > 0) {
|
|
1482
|
+
//this.$refs.scaffoldTreeControls.changeActiveByNames(names, region, false);
|
|
1483
|
+
this.$refs.scaffoldTreeControls.updateActiveUI(zincObjects);
|
|
1484
|
+
this.updatePrimitiveControls(zincObjects);
|
|
1485
|
+
} else {
|
|
1486
|
+
this.hideRegionTooltip();
|
|
1487
|
+
this.$refs.scaffoldTreeControls.removeActive(false);
|
|
1488
|
+
}
|
|
1366
1489
|
}
|
|
1490
|
+
//Emit when an object is selected
|
|
1491
|
+
//@arg Identifier of selected objects
|
|
1492
|
+
this.$emit("scaffold-selected", event.identifiers);
|
|
1367
1493
|
}
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
if (
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
this.
|
|
1494
|
+
} else if (event.eventType == 2) {
|
|
1495
|
+
if (this.selectedObjects.length === 0) {
|
|
1496
|
+
this.hideRegionTooltip();
|
|
1497
|
+
// const offsets = this.$refs.scaffoldContainer.getBoundingClientRect();
|
|
1498
|
+
if (this.$refs.scaffoldTreeControls) {
|
|
1499
|
+
if (names.length > 0) {
|
|
1500
|
+
//this.$refs.scaffoldTreeControls.changeHoverByNames(names, region, false);
|
|
1501
|
+
this.$refs.scaffoldTreeControls.updateHoverUI(zincObjects);
|
|
1502
|
+
} else {
|
|
1503
|
+
this.$refs.scaffoldTreeControls.removeHover(true);
|
|
1378
1504
|
}
|
|
1379
|
-
|
|
1380
|
-
|
|
1505
|
+
}
|
|
1506
|
+
if (event.identifiers.length > 0 && event.identifiers[0]) {
|
|
1507
|
+
let id = event.identifiers[0].data.id
|
|
1508
|
+
? event.identifiers[0].data.id
|
|
1509
|
+
: event.identifiers[0].data.group;
|
|
1510
|
+
if (event.identifiers[0].coords) {
|
|
1511
|
+
this.tData.active = false;
|
|
1512
|
+
this.tData.visible = true;
|
|
1513
|
+
this.tData.label = id;
|
|
1514
|
+
if (event.identifiers[0].data.region) {
|
|
1515
|
+
this.tData.region = event.identifiers[0].data.region;
|
|
1516
|
+
}
|
|
1517
|
+
else {
|
|
1518
|
+
this.tData.region = undefined;
|
|
1519
|
+
}
|
|
1520
|
+
this.tData.x = event.identifiers[0].coords.x;
|
|
1521
|
+
this.tData.y = event.identifiers[0].coords.y;
|
|
1522
|
+
this.createEditTemporaryLines(event.identifiers[0].extraData.worldCoords);
|
|
1381
1523
|
}
|
|
1382
|
-
this.tData.x = event.identifiers[0].coords.x;
|
|
1383
|
-
this.tData.y = event.identifiers[0].coords.y;
|
|
1384
|
-
this.createEditTemporaryLines(event.identifiers[0].extraData.worldCoords);
|
|
1385
1524
|
}
|
|
1525
|
+
//Emit when an object is highlighted
|
|
1526
|
+
//@arg Identifier of selected objects
|
|
1527
|
+
this.$emit("scaffold-highlighted", event.identifiers);
|
|
1386
1528
|
}
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
this.tData.x = event.identifiers[0].coords.x - offsets.left;
|
|
1398
|
-
this.tData.y = event.identifiers[0].coords.y - offsets.top;
|
|
1529
|
+
} else if (event.eventType == 3) {
|
|
1530
|
+
//MOVE
|
|
1531
|
+
if (event.identifiers.length > 0 && event.identifiers[0]) {
|
|
1532
|
+
if (event.identifiers[0].coords) {
|
|
1533
|
+
const offsets =
|
|
1534
|
+
this.$refs.scaffoldContainer.getBoundingClientRect();
|
|
1535
|
+
this.tData.x = event.identifiers[0].coords.x - offsets.left;
|
|
1536
|
+
this.tData.y = event.identifiers[0].coords.y - offsets.top;
|
|
1537
|
+
this.createEditTemporaryLines(event.identifiers[0].extraData.worldCoords);
|
|
1538
|
+
}
|
|
1399
1539
|
this.createEditTemporaryLines(event.identifiers[0].extraData.worldCoords);
|
|
1400
1540
|
}
|
|
1401
|
-
this.createEditTemporaryLines(event.identifiers[0].extraData.worldCoords);
|
|
1402
1541
|
}
|
|
1403
1542
|
}
|
|
1404
1543
|
},
|
|
@@ -1746,6 +1885,10 @@ export default {
|
|
|
1746
1885
|
}
|
|
1747
1886
|
}
|
|
1748
1887
|
});
|
|
1888
|
+
} else if (this.viewingMode === "Exploration") {
|
|
1889
|
+
this.activeDrawTool = undefined;
|
|
1890
|
+
this.activeDrawMode = undefined;
|
|
1891
|
+
this.createData.shape = "";
|
|
1749
1892
|
}
|
|
1750
1893
|
if ((this.viewingMode === "Exploration") ||
|
|
1751
1894
|
(this.viewingMode === "Annotation") &&
|
|
@@ -1917,6 +2060,7 @@ export default {
|
|
|
1917
2060
|
});
|
|
1918
2061
|
}
|
|
1919
2062
|
}
|
|
2063
|
+
this.localAnnotationsList.length = 0;
|
|
1920
2064
|
this.updateSettingsfromScene();
|
|
1921
2065
|
this.$module.updateTime(0.01);
|
|
1922
2066
|
this.$module.updateTime(0);
|
|
@@ -1925,8 +2069,16 @@ export default {
|
|
|
1925
2069
|
//Emit when all objects have been loaded
|
|
1926
2070
|
this.$emit("on-ready");
|
|
1927
2071
|
this.setMarkers();
|
|
2072
|
+
//Create a bounding box.
|
|
1928
2073
|
this._boundingBoxGeo = this.$module.scene.addBoundingBoxPrimitive(
|
|
1929
2074
|
"_helper", "boundingBox", 0x40E0D0, 0.15);
|
|
2075
|
+
//Create planes.
|
|
2076
|
+
this._slides = this.$module.scene.addSlicesPrimitive(
|
|
2077
|
+
"_helper", ["x-plane", "y-plane", "z-plane"], [0xFF5555, 0x55FF55, 0x5555FF],
|
|
2078
|
+
0.5);
|
|
2079
|
+
const {centre, size} = this.$module.getCentreAndSize();
|
|
2080
|
+
this.boundingDims.centre = centre;
|
|
2081
|
+
this.boundingDims.size = size;
|
|
1930
2082
|
this.isReady = true;
|
|
1931
2083
|
};
|
|
1932
2084
|
},
|
|
@@ -1995,6 +2147,45 @@ export default {
|
|
|
1995
2147
|
exportGLTF: function (binary) {
|
|
1996
2148
|
return this.$module.scene.exportGLTF(binary);
|
|
1997
2149
|
},
|
|
2150
|
+
/**
|
|
2151
|
+
* Return a copy of the local annotations list.
|
|
2152
|
+
* This list is used for storing user created annotation
|
|
2153
|
+
* when enableLocalAnnotations is set to true.
|
|
2154
|
+
*
|
|
2155
|
+
* @vuese
|
|
2156
|
+
*/
|
|
2157
|
+
getLocalAnnotations: function () {
|
|
2158
|
+
return [...this.localAnnotationsList];
|
|
2159
|
+
},
|
|
2160
|
+
/**
|
|
2161
|
+
* Import local annotations. The annotations will only
|
|
2162
|
+
* be imported when enableLocalAnnotations is set to
|
|
2163
|
+
* true;
|
|
2164
|
+
*
|
|
2165
|
+
* @vuese
|
|
2166
|
+
*/
|
|
2167
|
+
importLocalAnnotations: function (annotationsList) {
|
|
2168
|
+
if (this.enableLocalAnnotations) {
|
|
2169
|
+
//Make sure the annotations are encoded correctly
|
|
2170
|
+
annotationsList.forEach(annotation => {
|
|
2171
|
+
const group = annotation.group;
|
|
2172
|
+
const region = annotation.region;
|
|
2173
|
+
let fullName = region.slice(-1) === "/" ? region : region + "/";
|
|
2174
|
+
const noSlash = fullName.slice(0, -1);
|
|
2175
|
+
annotation.region = noSlash;
|
|
2176
|
+
fullName = fullName + group;
|
|
2177
|
+
const featureID = encodeURIComponent(fullName);
|
|
2178
|
+
annotation.item.id = featureID;
|
|
2179
|
+
annotation.feature.id = featureID;
|
|
2180
|
+
});
|
|
2181
|
+
const featuresList = annotationsList.map((annotation) => annotation.feature);
|
|
2182
|
+
annotationFeaturesToPrimitives(this.$module.scene, featuresList);
|
|
2183
|
+
//Make a local non-reactive copy.
|
|
2184
|
+
annotationsList.forEach((annotation) => {
|
|
2185
|
+
this.localAnnotationsList.push({...annotation});
|
|
2186
|
+
});
|
|
2187
|
+
}
|
|
2188
|
+
},
|
|
1998
2189
|
/**
|
|
1999
2190
|
* Function used for reading in new scaffold metadata and a custom
|
|
2000
2191
|
* viewport. This function will ignore the state prop and
|
|
@@ -2063,12 +2254,14 @@ export default {
|
|
|
2063
2254
|
* Callback using ResizeObserver.
|
|
2064
2255
|
*/
|
|
2065
2256
|
adjustLayout: function () {
|
|
2066
|
-
|
|
2067
|
-
|
|
2068
|
-
|
|
2069
|
-
|
|
2070
|
-
|
|
2071
|
-
|
|
2257
|
+
if (this.$refs.scaffoldContainer) {
|
|
2258
|
+
let width = this.$refs.scaffoldContainer.clientWidth;
|
|
2259
|
+
this.minimisedSlider = width < 812;
|
|
2260
|
+
if (this.minimisedSlider) {
|
|
2261
|
+
this.sliderPosition = this.drawerOpen ? "right" : "left";
|
|
2262
|
+
} else {
|
|
2263
|
+
this.sliderPosition = "";
|
|
2264
|
+
}
|
|
2072
2265
|
}
|
|
2073
2266
|
},
|
|
2074
2267
|
toggleRendering: function (flag) {
|
|
@@ -2267,17 +2460,6 @@ export default {
|
|
|
2267
2460
|
padding-left: 8px;
|
|
2268
2461
|
}
|
|
2269
2462
|
|
|
2270
|
-
.bottom-draw-control {
|
|
2271
|
-
background-color: var(--el-color-primary-light-9);
|
|
2272
|
-
padding: 4px 4px 2px 4px;
|
|
2273
|
-
border-style: solid;
|
|
2274
|
-
border-color: var(--el-color-primary-light-5);
|
|
2275
|
-
border-radius: 1rem;
|
|
2276
|
-
position: absolute;
|
|
2277
|
-
right: calc(50vw - 100px);;
|
|
2278
|
-
bottom: 16px;
|
|
2279
|
-
}
|
|
2280
|
-
|
|
2281
2463
|
:deep(.non-selectable) {
|
|
2282
2464
|
user-select: none;
|
|
2283
2465
|
}
|
|
@@ -2391,15 +2573,6 @@ export default {
|
|
|
2391
2573
|
border: none;
|
|
2392
2574
|
outline: none;
|
|
2393
2575
|
}
|
|
2394
|
-
|
|
2395
|
-
&.shape {
|
|
2396
|
-
margin-left: 4px;
|
|
2397
|
-
margin-right: 4px;
|
|
2398
|
-
color: var(--el-color-primary-light-5)!important;
|
|
2399
|
-
&.active {
|
|
2400
|
-
color: var(--el-color-primary)!important;
|
|
2401
|
-
}
|
|
2402
|
-
}
|
|
2403
2576
|
}
|
|
2404
2577
|
|
|
2405
2578
|
.bottom-right-control {
|