@abi-software/scaffoldvuer 1.5.0 → 1.6.0-beta.1

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": "@abi-software/scaffoldvuer",
3
- "version": "1.5.0",
3
+ "version": "1.6.0-beta.1",
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.1.2",
44
+ "@abi-software/map-utilities": "^1.2.0-beta.8",
45
45
  "@abi-software/sparc-annotation": "^0.3.1",
46
46
  "@abi-software/svg-sprite": "^1.0.1",
47
47
  "@element-plus/icons-vue": "^2.3.1",
package/src/App.vue CHANGED
@@ -297,7 +297,8 @@
297
297
 
298
298
  <script>
299
299
  /* eslint-disable no-alert, no-console */
300
- import { shallowRef } from 'vue';
300
+ import { AnnotationService } from '@abi-software/sparc-annotation'
301
+ import { markRaw, shallowRef } from 'vue';
301
302
  import { ScaffoldVuer } from "./components/index.js";
302
303
  import DropZone from "./app/DropZone.vue";
303
304
  import ModelsTable from "./app/ModelsTable.vue";
@@ -356,6 +357,11 @@ export default {
356
357
  ModelsTable,
357
358
  HelpModeDialog,
358
359
  },
360
+ provide() {
361
+ return {
362
+ $annotator: this.annotator,
363
+ }
364
+ },
359
365
  data: function () {
360
366
  return {
361
367
  consoleOn: true,
@@ -406,7 +412,8 @@ export default {
406
412
  router: useRouter(),
407
413
  ElIconSetting: shallowRef(ElIconSetting),
408
414
  ElIconFolderOpened: shallowRef(ElIconFolderOpened),
409
- auto: NaN
415
+ auto: NaN,
416
+ annotator: markRaw(new AnnotationService(`https://mapcore-demo.org/devel/flatmap/v4/annotator`)),
410
417
  };
411
418
  },
412
419
  watch: {
@@ -14,7 +14,7 @@
14
14
  <template #default>
15
15
  <div class="tooltip-text">{{ label }}</div>
16
16
  <div class="tooltip-text" v-if="region">Region: {{ region }}</div>
17
- <CreateTooltiipContent
17
+ <CreateTooltipContent
18
18
  v-show="createData.toBeConfirmed"
19
19
  :createData="createData"
20
20
  @confirm-create="$emit('confirm-create', $event)"
@@ -66,10 +66,9 @@ import {
66
66
  import {
67
67
  Delete as ElIconDelete,
68
68
  } from '@element-plus/icons-vue'
69
- import CreateTooltiipContent from "./CreateTooltipContent.vue";
70
69
  import { mapState } from 'pinia';
71
70
  import { useMainStore } from "@/store/index";
72
- import { Tooltip } from '@abi-software/map-utilities'
71
+ import { CreateTooltipContent, Tooltip } from '@abi-software/map-utilities'
73
72
  import '@abi-software/map-utilities/dist/style.css'
74
73
 
75
74
  /**
@@ -79,7 +78,7 @@ export default {
79
78
  name: "ScaffoldTooltip",
80
79
  components: {
81
80
  Col,
82
- CreateTooltiipContent,
81
+ CreateTooltipContent,
83
82
  ElIconDelete,
84
83
  Icon,
85
84
  Popover,
@@ -165,9 +164,7 @@ export default {
165
164
  }
166
165
  },
167
166
  hideTriggered: function() {
168
- if (this.createData.toBeConfirmed) {
169
- this.$emit('cancel-create');
170
- }
167
+ this.$emit('tooltip-hide');
171
168
  },
172
169
  },
173
170
  watch: {
@@ -17,7 +17,8 @@
17
17
  :annotationDisplay="annotationDisplay"
18
18
  @confirm-create="confirmCreate($event)"
19
19
  @cancel-create="cancelCreate()"
20
- @confirm-delete="confirmDelete($event)"
20
+ @confirm-delete="confirmDelete()"
21
+ @tooltip-hide="onTooltipHide()"
21
22
  />
22
23
  <div
23
24
  id="organsDisplayArea"
@@ -382,7 +383,7 @@
382
383
 
383
384
  <script>
384
385
  /* eslint-disable no-alert, no-console */
385
- import { markRaw, shallowRef } from 'vue';
386
+ import { inject, markRaw, provide, shallowRef } from 'vue';
386
387
  import {
387
388
  WarningFilled as ElIconWarningFilled,
388
389
  ArrowDown as ElIconArrowDown,
@@ -454,10 +455,21 @@ export default {
454
455
  ScaffoldTreeControls
455
456
  },
456
457
  setup(props) {
457
- const annotator = markRaw(new AnnotationService(`${props.flatmapAPI}annotator`));
458
- return { annotator };
458
+ let annotator = inject('$annotator')
459
+ if (!annotator) {
460
+ annotator = markRaw(new AnnotationService(`${props.flatmapAPI}annotator`));
461
+ provide('$annotator', annotator)
462
+ }
463
+ return { annotator }
459
464
  },
460
465
  props: {
466
+ /**
467
+ * The option to show annotation information in sidebar
468
+ */
469
+ annotationSidebar: {
470
+ type: Boolean,
471
+ default: false,
472
+ },
461
473
  /**
462
474
  * URL of the zincjs metadata. This value will be ignored if a valid
463
475
  * state prop is also provided.
@@ -698,7 +710,6 @@ export default {
698
710
  return {
699
711
  flatmapAPI: this.flatmapAPI,
700
712
  scaffoldUrl: this.url,
701
- $annotator: this.annotator,
702
713
  boundingDims: this.boundingDims,
703
714
  };
704
715
  },
@@ -902,6 +913,24 @@ export default {
902
913
  }
903
914
  this.previousMarkerLabels = markRaw({...labels});
904
915
  },
916
+ annotationDisplay: function(value) {
917
+ if (this.annotationSidebar) {
918
+ if (value) {
919
+ const region = this.tData.region ? this.tData.region +"/" : "";
920
+ const annotationEntry = {
921
+ "featureId": region + this.tData.label,
922
+ "resourceId": this.url,
923
+ "resource": this.url,
924
+ };
925
+ this.$emit('annotation-open', {annotationEntry: annotationEntry,
926
+ commitCallback: this.commitAnnotationEvent});
927
+ } else {
928
+ if (!this.createData.toBeConfirmed || !this.createData.toBeDeleted) {
929
+ this.$emit("annotation-close");
930
+ }
931
+ }
932
+ }
933
+ }
905
934
  },
906
935
  beforeCreate: function () {
907
936
  this.$module = new OrgansViewer();
@@ -1171,13 +1200,16 @@ export default {
1171
1200
  this.$module.scene.removeTemporaryPrimitive(this._tempPoint);
1172
1201
  this._tempPoint = undefined;
1173
1202
  }
1203
+ if (this.annotationSidebar){
1204
+ this.$emit("annotation-close");
1205
+ }
1174
1206
  },
1175
1207
  /**
1176
1208
  * Internal only.
1177
1209
  * Confirm delete of user created primitive.
1178
1210
  * This is only called from callback.
1179
1211
  */
1180
- confirmDelete: function() {
1212
+ confirmDelete: function() {
1181
1213
  if (this._editingZincObject?.isEditable) {
1182
1214
  const regionPath = this._editingZincObject.region.getFullPath() + "/";
1183
1215
  const group = this._editingZincObject.groupName;
@@ -1191,6 +1223,15 @@ export default {
1191
1223
  }
1192
1224
  this.cancelCreate();
1193
1225
  },
1226
+ /**
1227
+ * Internal only.
1228
+ * This is triggered when tooltip is hidden
1229
+ */
1230
+ onTooltipHide: function() {
1231
+ if (this.createData.toBeConfirmed && !this.annotationSidebar) {
1232
+ this.cancelCreate();
1233
+ }
1234
+ },
1194
1235
  formatTooltip(val) {
1195
1236
  if (this.timeMax >= 1000) {
1196
1237
  if (val) {
@@ -1387,21 +1428,21 @@ export default {
1387
1428
  if (this.createData.toBeConfirmed === false) {
1388
1429
  this.createData.points.length = 0;
1389
1430
  this.createData.points.push(coords);
1431
+ this.createData.toBeConfirmed = true;
1390
1432
  this.showRegionTooltipWithAnnotations(data, true, false);
1391
1433
  this.tData.x = 50;
1392
1434
  this.tData.y = 200;
1393
1435
  this._tempPoint = this.$module.scene.addTemporaryPoints([coords], 0xffff00);
1394
- this.createData.toBeConfirmed = true;
1395
1436
  }
1396
1437
  },
1397
1438
  drawLine: function(coords, data) {
1398
1439
  if (this.createData.toBeConfirmed === false) {
1399
1440
  if (this.createData.points.length === 1) {
1400
1441
  this.createData.points.push(coords);
1442
+ this.createData.toBeConfirmed = true;
1401
1443
  this.showRegionTooltipWithAnnotations(data, true, false);
1402
1444
  this.tData.x = 50;
1403
1445
  this.tData.y = 200;
1404
- this.createData.toBeConfirmed = true;
1405
1446
  } else {
1406
1447
  this._tempPoint = this.$module.scene.addTemporaryPoints([coords], 0xffff00);
1407
1448
  this.createData.points.push(coords);
@@ -1463,8 +1504,6 @@ export default {
1463
1504
  }
1464
1505
  if (this.activeDrawMode !== "Point" && this.activeDrawMode !== "LineString") {
1465
1506
  this.showRegionTooltipWithAnnotations(event.identifiers, true, false);
1466
- this.tData.x = 50;
1467
- this.tData.y = 200;
1468
1507
  } else {
1469
1508
  this.showRegionTooltipWithAnnotations(event.identifiers, true, true);
1470
1509
  }
@@ -1883,13 +1922,31 @@ export default {
1883
1922
  if (this.$module.scene) {
1884
1923
  const result = getObjectsFromAnnotations(this.$module.scene, annotations);
1885
1924
  if (result && result.objects.length > 0) {
1886
- return this.showRegionTooltipWithObjects(
1887
- result.label,
1888
- result.objects,
1889
- result.regionPath,
1890
- resetView,
1891
- liveUpdates
1892
- );
1925
+ if (!this.annotationSidebar) {
1926
+ return this.showRegionTooltipWithObjects(
1927
+ result.label,
1928
+ result.objects,
1929
+ result.regionPath,
1930
+ resetView,
1931
+ liveUpdates
1932
+ );
1933
+ } else {
1934
+ this.tData.visible = false;
1935
+ const region = this.tData.region ? this.tData.region +"/" : "";
1936
+ const annotationEntry = {
1937
+ "featureId": region + this.tData.label,
1938
+ "resourceId": this.url,
1939
+ "resource": this.url,
1940
+ };
1941
+ this.$emit('annotation-open', {
1942
+ annotationEntry: annotationEntry,
1943
+ createData: this.createData,
1944
+ confirmCreate: this.confirmCreate,
1945
+ cancelCreate: this.cancelCreate,
1946
+ confirmDelete: this.confirmDelete,
1947
+ });
1948
+ return;
1949
+ }
1893
1950
  }
1894
1951
  }
1895
1952
  this.hideRegionTooltip();
@@ -7,21 +7,18 @@ export {}
7
7
 
8
8
  declare module 'vue' {
9
9
  export interface GlobalComponents {
10
- CreateTooltipContent: typeof import('./components/CreateTooltipContent.vue')['default']
11
10
  ElButton: typeof import('element-plus/es')['ElButton']
12
11
  ElCol: typeof import('element-plus/es')['ElCol']
13
12
  ElCollapse: typeof import('element-plus/es')['ElCollapse']
14
13
  ElCollapseItem: typeof import('element-plus/es')['ElCollapseItem']
15
14
  ElContainer: typeof import('element-plus/es')['ElContainer']
16
15
  ElFooter: typeof import('element-plus/es')['ElFooter']
17
- ElHeader: typeof import('element-plus/es')['ElHeader']
18
16
  ElIcon: typeof import('element-plus/es')['ElIcon']
19
17
  ElIconArrowLeft: typeof import('@element-plus/icons-vue')['ArrowLeft']
20
18
  ElIconArrowRight: typeof import('@element-plus/icons-vue')['ArrowRight']
21
19
  ElIconDelete: typeof import('@element-plus/icons-vue')['Delete']
22
20
  ElIconPlus: typeof import('@element-plus/icons-vue')['Plus']
23
21
  ElIconWarningFilled: typeof import('@element-plus/icons-vue')['WarningFilled']
24
- ElInput: typeof import('element-plus/es')['ElInput']
25
22
  ElInputNumber: typeof import('element-plus/es')['ElInputNumber']
26
23
  ElMain: typeof import('element-plus/es')['ElMain']
27
24
  ElOption: typeof import('element-plus/es')['ElOption']
@@ -1,201 +0,0 @@
1
- <template>
2
- <el-container class="create-container">
3
- <el-header height="30px" class="header">
4
- <div>Create {{ createData.shape }}</div>
5
- </el-header>
6
- <el-main class="slides-block">
7
- <span class="create-text">
8
- Primitives will be created in the
9
- <br>
10
- __annotation region
11
- </span>
12
- <el-row class="row" v-show="showPoint">
13
- <el-col :offset="0" :span="8">
14
- Position:
15
- </el-col>
16
- <el-col :offset="0" :span="16">
17
- <el-row v-for="{ value, i } in createData.points" :key="i" class="value">
18
- {{ i }}
19
- </el-row>
20
- </el-col>
21
- </el-row>
22
- <el-row class="row">
23
- <el-col :offset="0" :span="8">
24
- Region:
25
- </el-col>
26
- <el-col :offset="0" :span="16">
27
- <el-input
28
- v-model="region"
29
- placeholder="__annotation"
30
- size="small"
31
- />
32
- </el-col>
33
- </el-row>
34
- <el-row class="row">
35
- <el-col :offset="0" :span="8">
36
- Group:
37
- </el-col>
38
- <el-col :offset="0" :span="16">
39
- <el-input
40
- v-model="group"
41
- :placeholder="createData.shape"
42
- size="small"
43
- />
44
- </el-col>
45
- </el-row>
46
- <el-row>
47
- <el-col :offset="0" :span="12">
48
- <el-button
49
- type="primary"
50
- plain
51
- @click="confirm"
52
- >
53
- {{ confirmText }}
54
- </el-button>
55
- </el-col>
56
- <el-col :offset="0" :span="12">
57
- <el-button
58
- type="primary"
59
- plain
60
- @click="cancel"
61
- >
62
- Cancel
63
- </el-button>
64
- </el-col>
65
- </el-row>
66
- </el-main>
67
- </el-container>
68
- </template>
69
-
70
- <script>
71
- /* eslint-disable no-alert, no-console */
72
-
73
- import {
74
- ElButton as Button,
75
- ElCol as Col,
76
- ElContainer as Container,
77
- ElHeader as Header,
78
- ElInput as Input,
79
- ElMain as Main,
80
-
81
- } from "element-plus";
82
-
83
- /**
84
- * A component to control the opacity of the target object.
85
- */
86
- export default {
87
- name: "CreateTooltipContent",
88
- components: {
89
- Button,
90
- Col,
91
- Container,
92
- Header,
93
- Input,
94
- Main,
95
- },
96
- props: {
97
- createData: {
98
- type: Object,
99
- },
100
- },
101
- watch: {
102
- "createData.shape": {
103
- handler: function (value) {
104
- this.group = value;
105
- this.$emit("cancel-create");
106
- },
107
- immediate: true,
108
- },
109
- },
110
- computed: {
111
- confirmText: function () {
112
- if (this.createData.editingIndex > -1) {
113
- return "Edit";
114
- }
115
- return "Confirm";
116
- },
117
- },
118
- data: function () {
119
- return {
120
- group: "default",
121
- region: "",
122
- showPoint: false,
123
- }
124
- },
125
- methods: {
126
- confirm: function () {
127
- this.$emit(
128
- "confirm-create",
129
- {
130
- region: "__annotation/" + this.region,
131
- group: this.group,
132
- shape: this.createData.shape,
133
- editingIndex: this.createData.editingIndex,
134
- }
135
- );
136
- this.group = this.createData.shape;
137
- },
138
- cancel: function () {
139
- this.$emit("cancel-create");
140
- },
141
- },
142
- };
143
- </script>
144
-
145
- <!-- Add "scoped" attribute to limit CSS to this component only -->
146
- <style scoped lang="scss">
147
- .header {
148
- color: #606266;
149
- line-height: 1;
150
- padding: 8px 17px 1px 15px;
151
- border-bottom: 1px solid #ebeef5;
152
- font-size: 14px;
153
- }
154
-
155
- .row {
156
- margin: 4px;
157
- text-align: left;
158
- }
159
-
160
- :deep(.create-text) {
161
- max-width: 220px;
162
- height:35px;
163
- font-size: 12px;
164
- }
165
-
166
-
167
- .create-container {
168
- width: 250px;
169
- height: auto;
170
- border-radius: 4px;
171
- border: solid 1px #d8dce6;
172
- background-color: #fff;
173
- overflow-y: none;
174
- user-select: auto;
175
- pointer-events: auto;
176
- }
177
-
178
- .value {
179
- font-size: 12px;
180
- }
181
-
182
- .input-box {
183
- width: 42px;
184
- border-radius: 4px;
185
- border: 1px solid rgb(144, 147, 153);
186
- background-color: var(--white);
187
- font-weight: 500;
188
- color: rgb(48, 49, 51);
189
- margin-left: 8px;
190
- height: 24px;
191
-
192
- &.number-input {
193
- width: 42px;
194
- :deep(.el-input__wrapper) {
195
- padding-left: 0px;
196
- padding-right: 0px;
197
- }
198
- }
199
- }
200
-
201
- </style>