@abi-software/scaffoldvuer 1.13.1-beta.8 → 1.14.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.
@@ -106,27 +106,40 @@
106
106
  class="control-layer"
107
107
  ref="scaffoldTreeControls"
108
108
  :isReady="isReady"
109
+ :containerHeight="clientHeight"
109
110
  :show-colour-picker="enableColourPicker"
110
111
  @object-selected="objectSelected"
111
112
  @object-hovered="objectHovered"
112
113
  @drawer-toggled="drawerToggled"
114
+ @check-changed="$emit('check-changed', $event)"
113
115
  >
114
116
  <template v-slot:treeSlot>
115
117
  <slot name="treeSlot"></slot>
118
+ <primitive-controls
119
+ class="control-layer"
120
+ ref="primitiveControls"
121
+ :createData="createData"
122
+ :viewingMode="viewingMode"
123
+ :usageConfig="usageConfig"
124
+ @primitivesUpdated="primitivesUpdated"
125
+ />
116
126
  </template>
117
127
  </ScaffoldTreeControls>
118
128
  </template>
119
129
  </el-popover>
120
- <div class="primitive-controls-box">
121
- <primitive-controls
122
- class="control-layer"
123
- ref="primitiveControls"
124
- :createData="createData"
125
- :viewingMode="viewingMode"
126
- :usageConfig="usageConfig"
127
- @primitivesUpdated="primitivesUpdated"
128
- />
129
- </div>
130
+ <!--
131
+ <div class="primitive-controls-box">
132
+
133
+ <primitive-controls
134
+ class="control-layer"
135
+ ref="primitiveControls"
136
+ :createData="createData"
137
+ :viewingMode="viewingMode"
138
+ :usageConfig="usageConfig"
139
+ @primitivesUpdated="primitivesUpdated"
140
+ />
141
+ </div>
142
+ -->
130
143
  <el-popover
131
144
  v-if="timeVarying"
132
145
  ref="sliderPopover"
@@ -308,66 +321,74 @@
308
321
  virtual-triggering
309
322
  >
310
323
  <div class="control-layer">
311
- <el-row class="backgroundText">Viewing Mode</el-row>
312
- <el-row class="backgroundControl">
313
- <div style="margin-bottom: 2px;">
314
- <template
315
- v-for="(value, key, index) in viewingModes"
316
- :key="key"
317
- >
318
- <template v-if="key === viewingMode">
319
- <span class="viewing-mode-title"><b >{{ key }}</b></span>
320
- </template>
321
- <template v-else>
322
- <span class="viewing-mode-unselected" @click="changeViewingMode(key)">{{ key }}</span>
323
- </template>
324
- </template>
325
- </div>
326
- <el-row class="viewing-mode-description">
327
- {{ modeDescription }}
324
+ <div class="viewing-mode-container">
325
+ <el-row class="backgroundText">Viewing Mode</el-row>
326
+ <el-row class="backgroundControl">
327
+ <div style="margin-bottom: 2px;">
328
+ <template
329
+ v-for="(value, key, index) in viewingModes"
330
+ :key="key"
331
+ >
332
+ <template v-if="key === viewingMode">
333
+ <span class="viewing-mode-title"><b >{{ key }}</b></span>
334
+ </template>
335
+ <template v-else>
336
+ <span class="viewing-mode-unselected" @click="changeViewingMode(key)">{{ key }}</span>
337
+ </template>
338
+ </template>
339
+ </div>
340
+ <el-row class="viewing-mode-description">
341
+ {{ modeDescription }}
342
+ </el-row>
343
+ <el-row v-if="viewingMode === 'Annotation' && offlineAnnotationEnabled" class="viewing-mode-description">
344
+ (Anonymous annotate)
345
+ </el-row>
328
346
  </el-row>
329
- <el-row v-if="viewingMode === 'Annotation' && offlineAnnotationEnabled" class="viewing-mode-description">
330
- (Anonymous annotate)
347
+ </div>
348
+ <div class="colour-radio-container">
349
+ <el-row class="backgroundSpacer"></el-row>
350
+ <el-row class="backgroundText">Organs display</el-row>
351
+ <el-row class="backgroundControl">
352
+ <el-radio-group
353
+ v-model="colourRadio"
354
+ class="scaffold-radio"
355
+ @change="setColour(colourRadio, true)"
356
+ >
357
+ <el-radio :value="true">Colour</el-radio>
358
+ <el-radio :value="false">Greyscale</el-radio>
359
+ </el-radio-group>
331
360
  </el-row>
332
- </el-row>
333
- <el-row class="backgroundSpacer"></el-row>
334
- <el-row class="backgroundText">Organs display</el-row>
335
- <el-row class="backgroundControl">
336
- <el-radio-group
337
- v-model="colourRadio"
338
- class="scaffold-radio"
339
- @change="setColour(colourRadio, true)"
340
- >
341
- <el-radio :value="true">Colour</el-radio>
342
- <el-radio :value="false">Greyscale</el-radio>
343
- </el-radio-group>
344
- </el-row>
345
- <el-row class="backgroundSpacer"></el-row>
346
- <el-row class="backgroundText">Outlines display</el-row>
347
- <el-row class="backgroundControl">
348
- <el-radio-group
349
- v-model="outlinesRadio"
350
- class="scaffold-radio"
351
- @change="setOutlines(outlinesRadio, true)"
352
- >
353
- <el-radio :value="true">Show</el-radio>
354
- <el-radio :value="false">Hide</el-radio>
355
- </el-radio-group>
356
- </el-row>
357
- <el-row class="backgroundSpacer"></el-row>
358
- <el-row class="backgroundText"> Change background </el-row>
359
- <el-row class="backgroundChooser">
360
- <div
361
- v-for="item in availableBackground"
362
- :key="item"
363
- :class="[
364
- 'backgroundChoice',
365
- item,
366
- item == currentBackground ? 'active' : '',
367
- ]"
368
- @click="backgroundChangeCallback(item)"
369
- />
370
- </el-row>
361
+ </div>
362
+ <div class="outlines-radio-container">
363
+ <el-row class="backgroundSpacer"></el-row>
364
+ <el-row class="backgroundText">Outlines display</el-row>
365
+ <el-row class="backgroundControl">
366
+ <el-radio-group
367
+ v-model="outlinesRadio"
368
+ class="scaffold-radio"
369
+ @change="setOutlines(outlinesRadio, true)"
370
+ >
371
+ <el-radio :value="true">Show</el-radio>
372
+ <el-radio :value="false">Hide</el-radio>
373
+ </el-radio-group>
374
+ </el-row>
375
+ </div>
376
+ <div class="background-colour-container">
377
+ <el-row class="backgroundSpacer"></el-row>
378
+ <el-row class="backgroundText"> Change background </el-row>
379
+ <el-row class="backgroundChooser">
380
+ <div
381
+ v-for="item in availableBackground"
382
+ :key="item"
383
+ :class="[
384
+ 'backgroundChoice',
385
+ item,
386
+ item == currentBackground ? 'active' : '',
387
+ ]"
388
+ @click="backgroundChangeCallback(item)"
389
+ />
390
+ </el-row>
391
+ </div>
371
392
  </div>
372
393
  </el-popover>
373
394
  <div
@@ -818,6 +839,7 @@ export default {
818
839
  data: function () {
819
840
  return {
820
841
  annotator: undefined,
842
+ clientHeight: 300,
821
843
  colourRadio: true,
822
844
  createData: {
823
845
  drawingBox: false,
@@ -1051,6 +1073,7 @@ export default {
1051
1073
  this.$module.addOrganPartRemovedCallback(this.zincObjectRemoved);
1052
1074
  this.$module.initialiseRenderer(this.$refs.display);
1053
1075
  this.toggleRendering(this.render);
1076
+ this.clientHeight = this.$refs.scaffoldContainer.$el.clientHeight;
1054
1077
  this.ro = new ResizeObserver(this.adjustLayout).observe(
1055
1078
  this.$refs.scaffoldContainer.$el
1056
1079
  );
@@ -1434,6 +1457,9 @@ export default {
1434
1457
  this.renameAnnotations(payload.region, payload.group,
1435
1458
  this._editingZincObject, oldGroupName);
1436
1459
  }
1460
+ else if (payload.deleting) {
1461
+ this.confirmDelete();
1462
+ }
1437
1463
  if (object) {
1438
1464
  this.addAndEditAnnotations(payload.region, payload.group, object.zincObject, "Create");
1439
1465
  object.zincObject.isEditable = true;
@@ -1512,6 +1538,12 @@ export default {
1512
1538
  this.offlineAnnotations = this.offlineAnnotations.filter(offline => offline.item.id !== annotation.item.id);
1513
1539
  sessionStorage.setItem('anonymous-annotation', JSON.stringify(this.offlineAnnotations));
1514
1540
  }
1541
+ this.$emit('userPrimitivesUpdated', {
1542
+ region: this._editingZincObject.region,
1543
+ group,
1544
+ zincObject: this._editingZincObject,
1545
+ deleted: true
1546
+ });
1515
1547
  }
1516
1548
  }
1517
1549
  this.cancelCreate();
@@ -1817,6 +1849,21 @@ export default {
1817
1849
  setTimeout(this.stopFreeSpin, 4000);
1818
1850
  }
1819
1851
  },
1852
+ activateDeleteMode: function(eventIdentifiers) {
1853
+ const zincObject = getDeletableObjects(eventIdentifiers);
1854
+ if (zincObject) {
1855
+ this._editingZincObject = zincObject;
1856
+ this.createData.faceIndex = -1;
1857
+ this.createData.editingIndex = -1;
1858
+ this.createData.renaming = false;
1859
+ this.createData.tempGroupName = this._editingZincObject.groupName;
1860
+ this.createData.regionPrefix = this._editingZincObject.region.getFullPath();
1861
+ this.createData.toBeConfirmed = true;
1862
+ this.createData.toBeDeleted = true;
1863
+ this.tData.x = 50;
1864
+ this.tData.y = 200;
1865
+ }
1866
+ },
1820
1867
  activateEditingMode: function(eventIdentifiers) {
1821
1868
  let editing = getEditablePoint(eventIdentifiers);
1822
1869
  if (editing) {
@@ -1843,6 +1890,7 @@ export default {
1843
1890
  this.createData.tempGroupName = this._editingZincObject.groupName;
1844
1891
  this.createData.regionPrefix = this._editingZincObject.region.getFullPath();
1845
1892
  this.createData.toBeConfirmed = true;
1893
+ this.createData.toBeDeleted = false;
1846
1894
  this.showRegionTooltipWithAnnotations(eventIdentifiers, false, false);
1847
1895
  this.tData.x = 50;
1848
1896
  this.tData.y = 200;
@@ -1863,11 +1911,7 @@ export default {
1863
1911
  if (this.activeDrawMode === "Edit") {
1864
1912
  this.activateEditingMode(event.identifiers);
1865
1913
  } else if (this.activeDrawMode === "Delete") {
1866
- const zincObject = getDeletableObjects(event);
1867
- if (zincObject) {
1868
- this.createData.toBeDeleted = true;
1869
- this._editingZincObject = zincObject;
1870
- }
1914
+ this.activateDeleteMode(event.identifiers);
1871
1915
  }
1872
1916
  if (this.activeDrawMode !== "Point" && this.activeDrawMode !== "LineString") {
1873
1917
  this.showRegionTooltipWithAnnotations(event.identifiers, true, false);
@@ -1883,6 +1927,7 @@ export default {
1883
1927
  this._editingZincObject = zincObject;
1884
1928
  this.createData.faceIndex = -1;
1885
1929
  this.createData.renaming = false;
1930
+ this.createData.toBeDeleted = false;
1886
1931
  this.createData.editingIndex = index;
1887
1932
  this.createData.regionPrefix = this._editingZincObject.region.getFullPath();
1888
1933
  this.createData.tempGroupName = this._editingZincObject.groupName;
@@ -1892,6 +1937,7 @@ export default {
1892
1937
  this._editingZincObject = zincObject;
1893
1938
  this.createData.faceIndex = faceIndex;
1894
1939
  this.createData.renaming = false;
1940
+ this.createData.toBeDeleted = false;
1895
1941
  this.createData.editingIndex = vertexIndex;
1896
1942
  this.createData.regionPrefix = this._editingZincObject.region.getFullPath();
1897
1943
  this.createData.tempGroupName = this._editingZincObject.groupName;
@@ -2130,6 +2176,17 @@ export default {
2130
2176
  //Hide tooltip as location may
2131
2177
  //this.hideRegionTooltip();
2132
2178
  },
2179
+ /**
2180
+ * @public
2181
+ * Disable/enable target region and its children checkbox
2182
+ *
2183
+ * @arg region Region to set the disable/enable checkbox
2184
+ * @arg flag Disable the checkbox when true and enable when false
2185
+ * @arg childrenOnly Only disable/enable any child graphics/regions
2186
+ */
2187
+ setRegionCheckboxDisabled: function(region, flag, childrenOnly = true) {
2188
+ this.$refs.scaffoldTreeControls.setRegionCheckboxDisabled(region, flag, childrenOnly);
2189
+ },
2133
2190
  /**
2134
2191
  * @public
2135
2192
  * Function to toggle on/off overlay help.
@@ -2990,6 +3047,7 @@ export default {
2990
3047
  adjustLayout: function () {
2991
3048
  if (this.$refs.scaffoldContainer?.$el) {
2992
3049
  let width = this.$refs.scaffoldContainer.$el.clientWidth;
3050
+ this.clientHeight = this.$refs.scaffoldContainer.$el.clientHeight;
2993
3051
  this.minimisedSlider = width < 812;
2994
3052
  if (this.minimisedSlider) {
2995
3053
  this.sliderPosition = this.drawerOpen ? "right" : "left";
@@ -3256,7 +3314,7 @@ export default {
3256
3314
  transition: all 1s ease;
3257
3315
 
3258
3316
  &.open {
3259
- left: 322px;
3317
+ left: 302px;
3260
3318
  }
3261
3319
 
3262
3320
  &.close {
@@ -1,6 +1,64 @@
1
1
  <template>
2
2
  <el-container class="t-slides-container">
3
3
  <el-main class="slides-block">
4
+ <el-row class="slide-row">
5
+ <el-checkbox
6
+ v-model="discardAlpha"
7
+ >
8
+ Discard Translucent Pixel
9
+ </el-checkbox>
10
+ </el-row>
11
+ <el-row class="slide-row">
12
+ <el-col :offset="0" :span="8">
13
+ Brightness
14
+ </el-col>
15
+ <el-col :offset="0" :span="10">
16
+ <el-slider
17
+ v-model="brightness"
18
+ class="my-slider"
19
+ :step="0.01"
20
+ :min="-1"
21
+ :max="1"
22
+ :show-tooltip="false"
23
+ />
24
+ </el-col>
25
+ <el-col :offset="0" :span="6">
26
+ <el-input-number
27
+ v-model="brightness"
28
+ :step="0.01"
29
+ :min="-1"
30
+ :max="1"
31
+ :controls="false"
32
+ class="input-box number-input"
33
+ />
34
+ </el-col>
35
+ </el-row>
36
+ <el-row class="slide-row">
37
+ <el-col :offset="0" :span="8">
38
+ Contrast
39
+ </el-col>
40
+ <el-col :offset="0" :span="10">
41
+ <el-slider
42
+ v-model="contrast"
43
+ class="my-slider"
44
+ :step="0.01"
45
+ :min="0"
46
+ :max="10"
47
+ :show-tooltip="false"
48
+ />
49
+ </el-col>
50
+ <el-col :offset="0" :span="6">
51
+ <el-input-number
52
+ v-model="contrast"
53
+ :step="0.01"
54
+ :min="0"
55
+ :max="10"
56
+ :controls="false"
57
+ class="input-box number-input"
58
+ />
59
+ </el-col>
60
+ </el-row>
61
+ <el-divider />
4
62
  <el-row v-for="(slide, index) in settings" :key="slide.id" class="slide-row">
5
63
  <el-col :offset="0" :span="6">
6
64
  <el-select
@@ -23,7 +81,7 @@
23
81
  <el-slider
24
82
  v-model="slide.value"
25
83
  class="my-slider"
26
- :step="0.005"
84
+ :step="0.001"
27
85
  :min="0"
28
86
  :max="1"
29
87
  :show-tooltip="false"
@@ -33,7 +91,8 @@
33
91
  <el-col :offset="0" :span="6">
34
92
  <el-input-number
35
93
  v-model="slide.value"
36
- :step="0.01"
94
+ @change="modifySlide(slide)"
95
+ :step="0.001"
37
96
  :min="0"
38
97
  :max="1"
39
98
  :controls="false"
@@ -68,8 +127,10 @@ import {
68
127
  Plus as ElIconPlus,
69
128
  } from '@element-plus/icons-vue'
70
129
  import {
130
+ ElCheckbox as Checkbox,
71
131
  ElCol as Col,
72
132
  ElContainer as Container,
133
+ ElDivider as Divider,
73
134
  ElFooter as Footer,
74
135
  ElIcon as Icon,
75
136
  ElInputNumber as InputNumber,
@@ -87,8 +148,10 @@ import { markRaw } from 'vue';
87
148
  export default {
88
149
  name: "TextureSlidesControls",
89
150
  components: {
151
+ Checkbox,
90
152
  Col,
91
153
  Container,
154
+ Divider,
92
155
  Footer,
93
156
  Icon,
94
157
  InputNumber,
@@ -102,6 +165,9 @@ export default {
102
165
  },
103
166
  data: function () {
104
167
  return {
168
+ brightness: 0.0,
169
+ contrast: 1.0,
170
+ discardAlpha: true,
105
171
  settings: [],
106
172
  directions: [
107
173
  {
@@ -120,14 +186,46 @@ export default {
120
186
  zincObject: undefined,
121
187
  };
122
188
  },
189
+ watch: {
190
+ brightness: {
191
+ handler: function (value) {
192
+ if (this.zincObject) {
193
+ this.zincObject.setBrightness(value);
194
+ }
195
+ },
196
+ immediate: false,
197
+ },
198
+ contrast: {
199
+ handler: function (value) {
200
+ if (this.zincObject) {
201
+ this.zincObject.setContrast(value);
202
+ }
203
+ },
204
+ immediate: false,
205
+ },
206
+ discardAlpha: {
207
+ handler: function (value) {
208
+ if (this.zincObject) {
209
+ this.zincObject.discardAlphaPixel(value);
210
+ }
211
+ },
212
+ immediate: false,
213
+ }
214
+ },
123
215
  methods: {
124
216
  setObject: function (object) {
125
217
  if (object.isTextureSlides) {
126
218
  this.zincObject = markRaw(object);
127
219
  this.settings = this.zincObject.getTextureSettings();
220
+ this.brightness = this.zincObject.getBrightness();
221
+ this.contrast = this.zincObject.getContrast();
222
+ this.discardAlpha = this.zincObject.isAlphaPixelDiscarded();
128
223
  } else {
129
224
  this.zincObject = undefined;
130
225
  this.settings = [];
226
+ this.brightness = 0.0;
227
+ this.contrast = 1.0;
228
+ this.discardAlpha = true;
131
229
  }
132
230
  },
133
231
  addNewSlide: function () {
@@ -168,6 +266,10 @@ export default {
168
266
  direction:ltr;
169
267
  }
170
268
 
269
+ :deep(.el-divider--horizontal) {
270
+ margin: 8px 0;
271
+ }
272
+
171
273
  .slides-block {
172
274
  direction:rtl;
173
275
  pointer-events: auto;
@@ -195,7 +297,7 @@ export default {
195
297
 
196
298
  .t-slides-container {
197
299
  width: 250px;
198
- height: 150px;
300
+ height: 250px;
199
301
  overflow-y: auto;
200
302
  }
201
303
 
@@ -159,6 +159,7 @@ export default {
159
159
  calculateMinAndMax: function() {
160
160
  if (this.zincObject) {
161
161
  const originalPos = this.zincObject?.userData?.originalPos;
162
+ const morph = this.zincObject.getGroup();
162
163
  if (originalPos && this.boundingDims) {
163
164
  this.min = [
164
165
  originalPos[0] - this.boundingDims.size[0],
@@ -215,7 +216,8 @@ export default {
215
216
  .slides-block {
216
217
  pointer-events: auto;
217
218
  &.el-main {
218
- padding: 5px;
219
+ padding: 0px 4px 8px 4px;
220
+ overflow: unset;
219
221
  &::-webkit-scrollbar {
220
222
  width: 10px;
221
223
  }
@@ -263,7 +265,7 @@ export default {
263
265
  .tool-row {
264
266
  align-items:center;
265
267
  text-align: center;
266
- padding-top:8px;
268
+ padding-top:4px;
267
269
  }
268
270
 
269
271
  </style>
@@ -8,14 +8,15 @@ export {}
8
8
  declare module 'vue' {
9
9
  export interface GlobalComponents {
10
10
  ElButton: typeof import('element-plus/es')['ElButton']
11
+ ElCheckbox: typeof import('element-plus/es')['ElCheckbox']
11
12
  ElCol: typeof import('element-plus/es')['ElCol']
12
13
  ElCollapse: typeof import('element-plus/es')['ElCollapse']
13
14
  ElCollapseItem: typeof import('element-plus/es')['ElCollapseItem']
14
15
  ElContainer: typeof import('element-plus/es')['ElContainer']
16
+ ElDivider: typeof import('element-plus/es')['ElDivider']
15
17
  ElFooter: typeof import('element-plus/es')['ElFooter']
16
18
  ElIcon: typeof import('element-plus/es')['ElIcon']
17
19
  ElIconArrowLeft: typeof import('@element-plus/icons-vue')['ArrowLeft']
18
- ElIconArrowRight: typeof import('@element-plus/icons-vue')['ArrowRight']
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']
@@ -50,6 +50,16 @@ export const getEditablePoint = (eventIdentifiers) => {
50
50
  return undefined;
51
51
  }
52
52
 
53
+ export const getDeletableObjects = (eventIdentifiers) => {
54
+ const zincObject = eventIdentifiers[0].data?.zincObject;
55
+ if (zincObject) {
56
+ if (zincObject.isEditable) {
57
+ return zincObject;
58
+ }
59
+ }
60
+ return undefined;
61
+ }
62
+
53
63
  export const getEditableLines = (eventIdentifiers) => {
54
64
  const zincObject = eventIdentifiers[0].data?.zincObject;
55
65
  if (zincObject) {
@@ -82,17 +92,6 @@ export const getClickedObjects = (event) => {
82
92
  return undefined;
83
93
  }
84
94
 
85
- export const getDeletableObjects = (event) => {
86
- const zincObjects = event.zincObjects;
87
- if (zincObjects.length > 0 && zincObjects[0]) {
88
- const zincObject = zincObjects[0];
89
- if (zincObject.isEditable) {
90
- return zincObject;
91
- }
92
- }
93
- return undefined;
94
- }
95
-
96
95
  export const movePoint = (zincObject, index, diff) => {
97
96
  if (zincObject?.isEditable && zincObject?.isPointset) {
98
97
  let found = false;