@abi-software/scaffoldvuer 1.8.1-beta.0 → 1.8.1-beta.2
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 +29 -39
- package/dist/scaffoldvuer.umd.cjs +27 -27
- package/dist/style.css +1 -1
- package/package.json +2 -2
- package/src/components/ScaffoldVuer.vue +35 -44
- package/src/components.d.ts +5 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@abi-software/scaffoldvuer",
|
|
3
|
-
"version": "1.8.1-beta.
|
|
3
|
+
"version": "1.8.1-beta.2",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"*.js"
|
|
42
42
|
],
|
|
43
43
|
"dependencies": {
|
|
44
|
-
"@abi-software/map-utilities": "^1.4.
|
|
44
|
+
"@abi-software/map-utilities": "^1.4.3-beta.3",
|
|
45
45
|
"@abi-software/sparc-annotation": "^0.3.2",
|
|
46
46
|
"@abi-software/svg-sprite": "^1.0.1",
|
|
47
47
|
"@element-plus/icons-vue": "^2.3.1",
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
/>
|
|
30
30
|
<div v-show="displayUI && !isTransitioning">
|
|
31
31
|
<DrawToolbar
|
|
32
|
-
v-if="viewingMode === 'Annotation' && (authorisedUser ||
|
|
32
|
+
v-if="viewingMode === 'Annotation' && (authorisedUser || offlineAnnotationEnabled)"
|
|
33
33
|
:toolbarOptions="toolbarOptions"
|
|
34
34
|
:activeDrawTool="activeDrawTool"
|
|
35
35
|
:activeDrawMode="activeDrawMode"
|
|
@@ -310,7 +310,7 @@
|
|
|
310
310
|
<el-row class="viewing-mode-description">
|
|
311
311
|
{{ modeDescription }}
|
|
312
312
|
</el-row>
|
|
313
|
-
<el-row v-if="viewingMode === 'Annotation' &&
|
|
313
|
+
<el-row v-if="viewingMode === 'Annotation' && offlineAnnotationEnabled" class="viewing-mode-description">
|
|
314
314
|
(Offline annotate)
|
|
315
315
|
</el-row>
|
|
316
316
|
</el-row>
|
|
@@ -805,8 +805,8 @@ export default {
|
|
|
805
805
|
},
|
|
806
806
|
openMapRef: undefined,
|
|
807
807
|
backgroundIconRef: undefined,
|
|
808
|
-
|
|
809
|
-
|
|
808
|
+
offlineAnnotationEnabled: false,
|
|
809
|
+
offlineAnnotations: markRaw([]),
|
|
810
810
|
authorisedUser: undefined,
|
|
811
811
|
toolbarOptions: [
|
|
812
812
|
"Delete",
|
|
@@ -1004,11 +1004,11 @@ export default {
|
|
|
1004
1004
|
* local annotation list.
|
|
1005
1005
|
*/
|
|
1006
1006
|
removeFromOfflineAnnotation: function(regionPath, groupName) {
|
|
1007
|
-
for (let i = 0; i < this.
|
|
1008
|
-
const annotation = this.
|
|
1007
|
+
for (let i = 0; i < this.offlineAnnotations.length; i++) {
|
|
1008
|
+
const annotation = this.offlineAnnotations[i];
|
|
1009
1009
|
if (annotation.region === regionPath &&
|
|
1010
1010
|
annotation.group === groupName) {
|
|
1011
|
-
this.
|
|
1011
|
+
this.offlineAnnotations.splice(i, 1);
|
|
1012
1012
|
return;
|
|
1013
1013
|
}
|
|
1014
1014
|
}
|
|
@@ -1026,7 +1026,7 @@ export default {
|
|
|
1026
1026
|
//Remove relevant objects from the rest of the app.
|
|
1027
1027
|
if (objects.length === 0) {
|
|
1028
1028
|
this.$_searchIndex.removeZincObject(zincObject, zincObject.uuid);
|
|
1029
|
-
if (this.
|
|
1029
|
+
if (this.offlineAnnotationEnabled) {
|
|
1030
1030
|
this.removeFromOfflineAnnotation(regionPath, groupName);
|
|
1031
1031
|
}
|
|
1032
1032
|
}
|
|
@@ -1111,18 +1111,18 @@ export default {
|
|
|
1111
1111
|
region, group, this.url, comment);
|
|
1112
1112
|
this.existDrawnFeatures = markRaw(this.existDrawnFeatures.filter(feature => feature.id !== annotation.item.id));
|
|
1113
1113
|
this.existDrawnFeatures.push(annotation.feature);
|
|
1114
|
-
if (this.
|
|
1114
|
+
if (this.offlineAnnotationEnabled) {
|
|
1115
1115
|
annotation.group = group;
|
|
1116
1116
|
let regionPath = region;
|
|
1117
1117
|
if (regionPath.slice(-1) === "/") {
|
|
1118
1118
|
regionPath = regionPath.slice(0, -1);
|
|
1119
1119
|
}
|
|
1120
1120
|
annotation.region = regionPath;
|
|
1121
|
-
this.
|
|
1121
|
+
this.offlineAnnotations = JSON.parse(sessionStorage.getItem('offline-annotation')) || [];
|
|
1122
1122
|
//Remove previous entry if there is matching region and group
|
|
1123
1123
|
this.removeFromOfflineAnnotation(regionPath, group);
|
|
1124
|
-
this.
|
|
1125
|
-
sessionStorage.setItem('offline-annotation', JSON.stringify(this.
|
|
1124
|
+
this.offlineAnnotations.push(annotation);
|
|
1125
|
+
sessionStorage.setItem('offline-annotation', JSON.stringify(this.offlineAnnotations));
|
|
1126
1126
|
}
|
|
1127
1127
|
this.$emit('userPrimitivesUpdated', {region, group, zincObject});
|
|
1128
1128
|
},
|
|
@@ -1220,8 +1220,8 @@ export default {
|
|
|
1220
1220
|
this.existDrawnFeatures = markRaw(this.existDrawnFeatures.filter(feature => feature.id !== annotation.item.id));
|
|
1221
1221
|
const childRegion = this.$module.scene.getRootRegion().findChildFromPath(regionPath);
|
|
1222
1222
|
childRegion.removeZincObject(this._editingZincObject);
|
|
1223
|
-
if (this.
|
|
1224
|
-
sessionStorage.setItem('offline-annotation', JSON.stringify(this.
|
|
1223
|
+
if (this.offlineAnnotationEnabled) {
|
|
1224
|
+
sessionStorage.setItem('offline-annotation', JSON.stringify(this.offlineAnnotations));
|
|
1225
1225
|
}
|
|
1226
1226
|
}
|
|
1227
1227
|
}
|
|
@@ -1481,7 +1481,7 @@ export default {
|
|
|
1481
1481
|
}
|
|
1482
1482
|
},
|
|
1483
1483
|
activateAnnotationMode: function(names, event) {
|
|
1484
|
-
if (this.authorisedUser || this.
|
|
1484
|
+
if (this.authorisedUser || this.offlineAnnotationEnabled) {
|
|
1485
1485
|
this.createData.toBeDeleted = false;
|
|
1486
1486
|
if ((this.createData.shape !== "") || (this.createData.editingIndex > -1)) {
|
|
1487
1487
|
// Create new shape bsaed on current settings
|
|
@@ -1984,13 +1984,13 @@ export default {
|
|
|
1984
1984
|
this.$refs.scaffoldTreeControls.removeRegion('__annotation');
|
|
1985
1985
|
// Offline annotations are removed when switch viewing mode
|
|
1986
1986
|
// Restore data in case need to save settings, doesn't affect anything
|
|
1987
|
-
this.
|
|
1987
|
+
this.offlineAnnotations = annotations;
|
|
1988
1988
|
},
|
|
1989
1989
|
addAnnotationFeature: async function () {
|
|
1990
1990
|
let drawnFeatures;
|
|
1991
|
-
if (this.
|
|
1992
|
-
this.
|
|
1993
|
-
drawnFeatures = this.
|
|
1991
|
+
if (this.offlineAnnotationEnabled) {
|
|
1992
|
+
this.offlineAnnotations = JSON.parse(sessionStorage.getItem('offline-annotation')) || [];
|
|
1993
|
+
drawnFeatures = this.offlineAnnotations.filter((offline) => offline.resource === this.url).map(offline => offline.feature);
|
|
1994
1994
|
} else {
|
|
1995
1995
|
drawnFeatures = [];
|
|
1996
1996
|
const drawn = await getDrawnAnnotations(this.annotator, this.userToken, this.url);
|
|
@@ -2020,10 +2020,10 @@ export default {
|
|
|
2020
2020
|
this.annotator.authenticate(this.userToken).then((userData) => {
|
|
2021
2021
|
if (userData.name && userData.email && userData.canUpdate) {
|
|
2022
2022
|
this.authorisedUser = userData;
|
|
2023
|
-
this.
|
|
2023
|
+
this.offlineAnnotationEnabled = false;
|
|
2024
2024
|
} else {
|
|
2025
2025
|
this.authorisedUser = undefined;
|
|
2026
|
-
this.
|
|
2026
|
+
this.offlineAnnotationEnabled = true;
|
|
2027
2027
|
}
|
|
2028
2028
|
this.addAnnotationFeature();
|
|
2029
2029
|
this.loading = false;
|
|
@@ -2221,10 +2221,8 @@ export default {
|
|
|
2221
2221
|
if (options.background) {
|
|
2222
2222
|
this.backgroundChangeCallback(options.background);
|
|
2223
2223
|
}
|
|
2224
|
-
if (options.
|
|
2225
|
-
|
|
2226
|
-
sessionStorage.setItem('offline-annotation', options.offlineAnnotation.value);
|
|
2227
|
-
}
|
|
2224
|
+
if (options.offlineAnnotations) {
|
|
2225
|
+
sessionStorage.setItem('offline-annotation', options.offlineAnnotations);
|
|
2228
2226
|
}
|
|
2229
2227
|
if (options.viewingMode) {
|
|
2230
2228
|
this.changeViewingMode(options.viewingMode);
|
|
@@ -2246,7 +2244,7 @@ export default {
|
|
|
2246
2244
|
},
|
|
2247
2245
|
setURLFinishCallback: function (options) {
|
|
2248
2246
|
return () => {
|
|
2249
|
-
this.
|
|
2247
|
+
this.offlineAnnotations.length = 0;
|
|
2250
2248
|
this.updateSettingsfromScene();
|
|
2251
2249
|
this.$module.updateTime(0.01);
|
|
2252
2250
|
this.$module.updateTime(0);
|
|
@@ -2295,15 +2293,8 @@ export default {
|
|
|
2295
2293
|
if (this.lastSelected && this.lastSelected.group) {
|
|
2296
2294
|
state.search = {...this.lastSelected};
|
|
2297
2295
|
}
|
|
2298
|
-
if (this.
|
|
2299
|
-
|
|
2300
|
-
const expiry = new Date().getTime() + 24 * 60 * 60 * 1000;
|
|
2301
|
-
sessionStorage.setItem('offline-annotation-expiry', expiry);
|
|
2302
|
-
}
|
|
2303
|
-
state.offlineAnnotation = {
|
|
2304
|
-
expiry: sessionStorage.getItem('offline-annotation-expiry'),
|
|
2305
|
-
value: sessionStorage.getItem('offline-annotation'),
|
|
2306
|
-
};
|
|
2296
|
+
if (this.offlineAnnotationEnabled) {
|
|
2297
|
+
state.offlineAnnotations = sessionStorage.getItem('offline-annotation');
|
|
2307
2298
|
}
|
|
2308
2299
|
return state;
|
|
2309
2300
|
},
|
|
@@ -2324,7 +2315,7 @@ export default {
|
|
|
2324
2315
|
background: state.background,
|
|
2325
2316
|
viewingMode: this.viewingMode,
|
|
2326
2317
|
search: state.search,
|
|
2327
|
-
|
|
2318
|
+
offlineAnnotations: state.offlineAnnotations,
|
|
2328
2319
|
});
|
|
2329
2320
|
} else {
|
|
2330
2321
|
if (state.background || state.search || state.viewport || state.viewingMode || state.visibility) {
|
|
@@ -2338,7 +2329,7 @@ export default {
|
|
|
2338
2329
|
viewport: state.viewport,
|
|
2339
2330
|
visibility: state.visibility,
|
|
2340
2331
|
search: state.search,
|
|
2341
|
-
|
|
2332
|
+
offlineAnnotations: state.offlineAnnotations,
|
|
2342
2333
|
})
|
|
2343
2334
|
);
|
|
2344
2335
|
}
|
|
@@ -2358,23 +2349,23 @@ export default {
|
|
|
2358
2349
|
/**
|
|
2359
2350
|
* Return a copy of the local annotations list.
|
|
2360
2351
|
* This list is used for storing user created annotation
|
|
2361
|
-
* when
|
|
2352
|
+
* when offlineAnnotationEnabled is set to true.
|
|
2362
2353
|
*
|
|
2363
2354
|
* @public
|
|
2364
2355
|
*/
|
|
2365
2356
|
getOfflineAnnotations: function () {
|
|
2366
|
-
return [...this.
|
|
2357
|
+
return [...this.offlineAnnotations];
|
|
2367
2358
|
},
|
|
2368
2359
|
/**
|
|
2369
2360
|
* Import local annotations. The annotations will only
|
|
2370
|
-
* be imported when
|
|
2361
|
+
* be imported when offlineAnnotationEnabled is set to
|
|
2371
2362
|
* true;
|
|
2372
2363
|
*
|
|
2373
2364
|
* @public
|
|
2374
2365
|
* @arg {Array} `annotationsList`
|
|
2375
2366
|
*/
|
|
2376
2367
|
importOfflineAnnotations: function (annotationsList) {
|
|
2377
|
-
if (this.
|
|
2368
|
+
if (this.offlineAnnotationEnabled) {
|
|
2378
2369
|
//Make sure the annotations are encoded correctly
|
|
2379
2370
|
annotationsList.forEach(annotation => {
|
|
2380
2371
|
const group = annotation.group;
|
|
@@ -2391,9 +2382,9 @@ export default {
|
|
|
2391
2382
|
annotationFeaturesToPrimitives(this.$module.scene, featuresList);
|
|
2392
2383
|
//Make a local non-reactive copy.
|
|
2393
2384
|
annotationsList.forEach((annotation) => {
|
|
2394
|
-
this.
|
|
2385
|
+
this.offlineAnnotations.push({...annotation});
|
|
2395
2386
|
});
|
|
2396
|
-
sessionStorage.setItem('offline-annotation', JSON.stringify(this.
|
|
2387
|
+
sessionStorage.setItem('offline-annotation', JSON.stringify(this.offlineAnnotations));
|
|
2397
2388
|
}
|
|
2398
2389
|
},
|
|
2399
2390
|
|
|
@@ -2428,7 +2419,7 @@ export default {
|
|
|
2428
2419
|
viewURL: this.viewURL,
|
|
2429
2420
|
viewport: state?.viewport,
|
|
2430
2421
|
visibility: state?.visibility,
|
|
2431
|
-
|
|
2422
|
+
offlineAnnotations: state?.offlineAnnotations,
|
|
2432
2423
|
})
|
|
2433
2424
|
);
|
|
2434
2425
|
if (this.fileFormat === "gltf") {
|
package/src/components.d.ts
CHANGED
|
@@ -7,6 +7,7 @@ export {}
|
|
|
7
7
|
|
|
8
8
|
declare module 'vue' {
|
|
9
9
|
export interface GlobalComponents {
|
|
10
|
+
ElAutocomplete: typeof import('element-plus/es')['ElAutocomplete']
|
|
10
11
|
ElButton: typeof import('element-plus/es')['ElButton']
|
|
11
12
|
ElCol: typeof import('element-plus/es')['ElCol']
|
|
12
13
|
ElCollapse: typeof import('element-plus/es')['ElCollapse']
|
|
@@ -19,6 +20,7 @@ declare module 'vue' {
|
|
|
19
20
|
ElIconDelete: typeof import('@element-plus/icons-vue')['Delete']
|
|
20
21
|
ElIconPlus: typeof import('@element-plus/icons-vue')['Plus']
|
|
21
22
|
ElIconWarningFilled: typeof import('@element-plus/icons-vue')['WarningFilled']
|
|
23
|
+
ElInput: typeof import('element-plus/es')['ElInput']
|
|
22
24
|
ElInputNumber: typeof import('element-plus/es')['ElInputNumber']
|
|
23
25
|
ElMain: typeof import('element-plus/es')['ElMain']
|
|
24
26
|
ElOption: typeof import('element-plus/es')['ElOption']
|
|
@@ -26,6 +28,9 @@ declare module 'vue' {
|
|
|
26
28
|
ElRow: typeof import('element-plus/es')['ElRow']
|
|
27
29
|
ElSelect: typeof import('element-plus/es')['ElSelect']
|
|
28
30
|
ElSlider: typeof import('element-plus/es')['ElSlider']
|
|
31
|
+
ElSwitch: typeof import('element-plus/es')['ElSwitch']
|
|
32
|
+
ElTable: typeof import('element-plus/es')['ElTable']
|
|
33
|
+
ElTableColumn: typeof import('element-plus/es')['ElTableColumn']
|
|
29
34
|
ElTabPane: typeof import('element-plus/es')['ElTabPane']
|
|
30
35
|
ElTabs: typeof import('element-plus/es')['ElTabs']
|
|
31
36
|
LinesControls: typeof import('./components/LinesControls.vue')['default']
|