@abi-software/scaffoldvuer 1.13.1-beta.9 → 1.14.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.
@@ -22,7 +22,6 @@
22
22
  @confirm-create="confirmCreate($event)"
23
23
  @cancel-create="cancelCreate()"
24
24
  @confirm-comment="confirmComment($event)"
25
- @confirm-delete="confirmDelete()"
26
25
  @tooltip-hide="onTooltipHide()"
27
26
  @create-group-suggestions="$emit('create-group-suggestions', $event)"
28
27
  @create-region-suggestions="$emit('create-region-suggestions', $event)"
@@ -106,27 +105,40 @@
106
105
  class="control-layer"
107
106
  ref="scaffoldTreeControls"
108
107
  :isReady="isReady"
108
+ :containerHeight="clientHeight"
109
109
  :show-colour-picker="enableColourPicker"
110
110
  @object-selected="objectSelected"
111
111
  @object-hovered="objectHovered"
112
112
  @drawer-toggled="drawerToggled"
113
+ @check-changed="$emit('check-changed', $event)"
113
114
  >
114
115
  <template v-slot:treeSlot>
115
116
  <slot name="treeSlot"></slot>
117
+ <primitive-controls
118
+ class="control-layer"
119
+ ref="primitiveControls"
120
+ :createData="createData"
121
+ :viewingMode="viewingMode"
122
+ :usageConfig="usageConfig"
123
+ @primitivesUpdated="primitivesUpdated"
124
+ />
116
125
  </template>
117
126
  </ScaffoldTreeControls>
118
127
  </template>
119
128
  </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>
129
+ <!--
130
+ <div class="primitive-controls-box">
131
+
132
+ <primitive-controls
133
+ class="control-layer"
134
+ ref="primitiveControls"
135
+ :createData="createData"
136
+ :viewingMode="viewingMode"
137
+ :usageConfig="usageConfig"
138
+ @primitivesUpdated="primitivesUpdated"
139
+ />
140
+ </div>
141
+ -->
130
142
  <el-popover
131
143
  v-if="timeVarying"
132
144
  ref="sliderPopover"
@@ -826,6 +838,7 @@ export default {
826
838
  data: function () {
827
839
  return {
828
840
  annotator: undefined,
841
+ clientHeight: 300,
829
842
  colourRadio: true,
830
843
  createData: {
831
844
  drawingBox: false,
@@ -1059,6 +1072,7 @@ export default {
1059
1072
  this.$module.addOrganPartRemovedCallback(this.zincObjectRemoved);
1060
1073
  this.$module.initialiseRenderer(this.$refs.display);
1061
1074
  this.toggleRendering(this.render);
1075
+ this.clientHeight = this.$refs.scaffoldContainer.$el.clientHeight;
1062
1076
  this.ro = new ResizeObserver(this.adjustLayout).observe(
1063
1077
  this.$refs.scaffoldContainer.$el
1064
1078
  );
@@ -1333,9 +1347,9 @@ export default {
1333
1347
  this.offlineAnnotations = JSON.parse(sessionStorage.getItem('anonymous-annotation')) || [];
1334
1348
  const found = this.offlineAnnotations.find((element) => {
1335
1349
  return element.group === annotation.group &&
1336
- element.region === annotation.region &&
1337
- element.resource === annotation.resource &&
1338
- element.feature.geometry.type === annotation.feature.geometry.type;
1350
+ element.region === annotation.region &&
1351
+ element.resource === annotation.resource &&
1352
+ element.feature.geometry.type === annotation.feature.geometry.type;
1339
1353
  });
1340
1354
  if (found) {
1341
1355
  Object.assign(found, annotation);
@@ -1377,7 +1391,6 @@ export default {
1377
1391
  element.feature.geometry.type === annotation.feature.geometry.type;
1378
1392
  });
1379
1393
  if (found) {
1380
- //console.log('found', found)
1381
1394
  Object.assign(found, annotation);
1382
1395
  }
1383
1396
  sessionStorage.setItem('anonymous-annotation', JSON.stringify(this.offlineAnnotations));
@@ -1420,6 +1433,8 @@ export default {
1420
1433
  [this.createData.points[0], this.createData.points[1]],
1421
1434
  0x00ee22,
1422
1435
  );
1436
+ } else if (payload.deleting) {
1437
+ this.confirmDelete(payload);
1423
1438
  } else if (payload.editingIndex > -1) {
1424
1439
  if (this._editingZincObject) {
1425
1440
  let editedPoint = undefined;
@@ -1505,21 +1520,53 @@ export default {
1505
1520
  * Confirm delete of user created primitive.
1506
1521
  * This is only called from callback.
1507
1522
  */
1508
- confirmDelete: function () {
1523
+ confirmDelete: function (payload) {
1509
1524
  if (this._editingZincObject?.isEditable) {
1510
1525
  const regionPath = this._editingZincObject.region.getFullPath() + "/";
1511
1526
  const group = this._editingZincObject.groupName;
1527
+ let toBeDeleted = true;
1528
+ if (payload.editingIndex > -1 && this._editingZincObject.isPointset) {
1529
+ toBeDeleted = 1 > this._editingZincObject.deleteVertices(payload.editingIndex);
1530
+ }
1531
+ const message = toBeDeleted ? "Deleted" : "Removed a vertex";
1532
+
1512
1533
  const annotation = addUserAnnotationWithFeature(this.annotator, this.userToken,
1513
- this._editingZincObject, regionPath, group, this.url, "Deleted");
1534
+ this._editingZincObject, regionPath, group, this.url, message);
1514
1535
  if (annotation) {
1515
1536
  this.existDrawnFeatures = markRaw(this.existDrawnFeatures.filter(feature => feature.id !== annotation.item.id));
1516
- const childRegion = this.$module.scene.getRootRegion().findChildFromPath(regionPath);
1517
- childRegion.removeZincObject(this._editingZincObject);
1537
+ if (toBeDeleted) {
1538
+ const childRegion = this.$module.scene.getRootRegion().findChildFromPath(regionPath);
1539
+ childRegion.removeZincObject(this._editingZincObject);
1540
+ }
1518
1541
  if (this.offlineAnnotationEnabled) {
1542
+ annotation.group = group;
1543
+ let regionPath = payload.region;
1544
+ if (regionPath.slice(-1) === "/") {
1545
+ regionPath = regionPath.slice(0, -1);
1546
+ }
1547
+ annotation.region = regionPath;
1519
1548
  this.offlineAnnotations = JSON.parse(sessionStorage.getItem('anonymous-annotation')) || [];
1520
- this.offlineAnnotations = this.offlineAnnotations.filter(offline => offline.item.id !== annotation.item.id);
1549
+ if (toBeDeleted) {
1550
+ this.offlineAnnotations = this.offlineAnnotations.filter(offline => offline.item.id !== annotation.item.id);
1551
+ } else {
1552
+ //Do not remove completely if there is primitive left
1553
+ const found = this.offlineAnnotations.find((element) => {
1554
+ return element.group === group &&
1555
+ element.region === annotation.region &&
1556
+ element.resource === annotation.resource &&
1557
+ element.feature.geometry.type === annotation.feature.geometry.type;
1558
+ });
1559
+ Object.assign(found, annotation);
1560
+ this.existDrawnFeatures.push(annotation.feature);
1561
+ }
1521
1562
  sessionStorage.setItem('anonymous-annotation', JSON.stringify(this.offlineAnnotations));
1522
1563
  }
1564
+ this.$emit('userPrimitivesUpdated', {
1565
+ region: this._editingZincObject.region,
1566
+ group,
1567
+ zincObject: this._editingZincObject,
1568
+ deleted: true
1569
+ });
1523
1570
  }
1524
1571
  }
1525
1572
  this.cancelCreate();
@@ -1825,6 +1872,23 @@ export default {
1825
1872
  setTimeout(this.stopFreeSpin, 4000);
1826
1873
  }
1827
1874
  },
1875
+ activateDeleteMode: function(eventIdentifiers) {
1876
+ const zincObject = getDeletableObjects(eventIdentifiers);
1877
+ if (zincObject) {
1878
+ const editing = getEditablePoint(eventIdentifiers);
1879
+ const editingIndex = editing?.index !== undefined ? editing.index : -1;
1880
+ this._editingZincObject = zincObject;
1881
+ this.createData.faceIndex = -1;
1882
+ this.createData.editingIndex = editingIndex;
1883
+ this.createData.renaming = false;
1884
+ this.createData.tempGroupName = this._editingZincObject.groupName;
1885
+ this.createData.regionPrefix = this._editingZincObject.region.getFullPath();
1886
+ this.createData.toBeConfirmed = true;
1887
+ this.createData.toBeDeleted = true;
1888
+ this.tData.x = 50;
1889
+ this.tData.y = 200;
1890
+ }
1891
+ },
1828
1892
  activateEditingMode: function(eventIdentifiers) {
1829
1893
  let editing = getEditablePoint(eventIdentifiers);
1830
1894
  if (editing) {
@@ -1851,6 +1915,7 @@ export default {
1851
1915
  this.createData.tempGroupName = this._editingZincObject.groupName;
1852
1916
  this.createData.regionPrefix = this._editingZincObject.region.getFullPath();
1853
1917
  this.createData.toBeConfirmed = true;
1918
+ this.createData.toBeDeleted = false;
1854
1919
  this.showRegionTooltipWithAnnotations(eventIdentifiers, false, false);
1855
1920
  this.tData.x = 50;
1856
1921
  this.tData.y = 200;
@@ -1871,11 +1936,7 @@ export default {
1871
1936
  if (this.activeDrawMode === "Edit") {
1872
1937
  this.activateEditingMode(event.identifiers);
1873
1938
  } else if (this.activeDrawMode === "Delete") {
1874
- const zincObject = getDeletableObjects(event);
1875
- if (zincObject) {
1876
- this.createData.toBeDeleted = true;
1877
- this._editingZincObject = zincObject;
1878
- }
1939
+ this.activateDeleteMode(event.identifiers);
1879
1940
  }
1880
1941
  if (this.activeDrawMode !== "Point" && this.activeDrawMode !== "LineString") {
1881
1942
  this.showRegionTooltipWithAnnotations(event.identifiers, true, false);
@@ -1891,6 +1952,7 @@ export default {
1891
1952
  this._editingZincObject = zincObject;
1892
1953
  this.createData.faceIndex = -1;
1893
1954
  this.createData.renaming = false;
1955
+ this.createData.toBeDeleted = false;
1894
1956
  this.createData.editingIndex = index;
1895
1957
  this.createData.regionPrefix = this._editingZincObject.region.getFullPath();
1896
1958
  this.createData.tempGroupName = this._editingZincObject.groupName;
@@ -1900,6 +1962,7 @@ export default {
1900
1962
  this._editingZincObject = zincObject;
1901
1963
  this.createData.faceIndex = faceIndex;
1902
1964
  this.createData.renaming = false;
1965
+ this.createData.toBeDeleted = false;
1903
1966
  this.createData.editingIndex = vertexIndex;
1904
1967
  this.createData.regionPrefix = this._editingZincObject.region.getFullPath();
1905
1968
  this.createData.tempGroupName = this._editingZincObject.groupName;
@@ -2144,9 +2207,10 @@ export default {
2144
2207
  *
2145
2208
  * @arg region Region to set the disable/enable checkbox
2146
2209
  * @arg flag Disable the checkbox when true and enable when false
2210
+ * @arg childrenOnly Only disable/enable any child graphics/regions
2147
2211
  */
2148
- setRegionCheckboxDisabled: function(region, flag) {
2149
- this.$refs.scaffoldTreeControls.setRegionCheckboxDisabled(region, flag);
2212
+ setRegionCheckboxDisabled: function(region, flag, childrenOnly = true) {
2213
+ this.$refs.scaffoldTreeControls.setRegionCheckboxDisabled(region, flag, childrenOnly);
2150
2214
  },
2151
2215
  /**
2152
2216
  * @public
@@ -3008,6 +3072,7 @@ export default {
3008
3072
  adjustLayout: function () {
3009
3073
  if (this.$refs.scaffoldContainer?.$el) {
3010
3074
  let width = this.$refs.scaffoldContainer.$el.clientWidth;
3075
+ this.clientHeight = this.$refs.scaffoldContainer.$el.clientHeight;
3011
3076
  this.minimisedSlider = width < 812;
3012
3077
  if (this.minimisedSlider) {
3013
3078
  this.sliderPosition = this.drawerOpen ? "right" : "left";
@@ -3274,7 +3339,7 @@ export default {
3274
3339
  transition: all 1s ease;
3275
3340
 
3276
3341
  &.open {
3277
- left: 322px;
3342
+ left: 302px;
3278
3343
  }
3279
3344
 
3280
3345
  &.close {
@@ -1,6 +1,13 @@
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>
4
11
  <el-row class="slide-row">
5
12
  <el-col :offset="0" :span="8">
6
13
  Brightness
@@ -74,7 +81,7 @@
74
81
  <el-slider
75
82
  v-model="slide.value"
76
83
  class="my-slider"
77
- :step="0.005"
84
+ :step="0.001"
78
85
  :min="0"
79
86
  :max="1"
80
87
  :show-tooltip="false"
@@ -84,7 +91,8 @@
84
91
  <el-col :offset="0" :span="6">
85
92
  <el-input-number
86
93
  v-model="slide.value"
87
- :step="0.01"
94
+ @change="modifySlide(slide)"
95
+ :step="0.001"
88
96
  :min="0"
89
97
  :max="1"
90
98
  :controls="false"
@@ -119,6 +127,7 @@ import {
119
127
  Plus as ElIconPlus,
120
128
  } from '@element-plus/icons-vue'
121
129
  import {
130
+ ElCheckbox as Checkbox,
122
131
  ElCol as Col,
123
132
  ElContainer as Container,
124
133
  ElDivider as Divider,
@@ -139,6 +148,7 @@ import { markRaw } from 'vue';
139
148
  export default {
140
149
  name: "TextureSlidesControls",
141
150
  components: {
151
+ Checkbox,
142
152
  Col,
143
153
  Container,
144
154
  Divider,
@@ -157,6 +167,7 @@ export default {
157
167
  return {
158
168
  brightness: 0.0,
159
169
  contrast: 1.0,
170
+ discardAlpha: true,
160
171
  settings: [],
161
172
  directions: [
162
173
  {
@@ -191,6 +202,14 @@ export default {
191
202
  }
192
203
  },
193
204
  immediate: false,
205
+ },
206
+ discardAlpha: {
207
+ handler: function (value) {
208
+ if (this.zincObject) {
209
+ this.zincObject.discardAlphaPixel(value);
210
+ }
211
+ },
212
+ immediate: false,
194
213
  }
195
214
  },
196
215
  methods: {
@@ -200,11 +219,13 @@ export default {
200
219
  this.settings = this.zincObject.getTextureSettings();
201
220
  this.brightness = this.zincObject.getBrightness();
202
221
  this.contrast = this.zincObject.getContrast();
222
+ this.discardAlpha = this.zincObject.isAlphaPixelDiscarded();
203
223
  } else {
204
224
  this.zincObject = undefined;
205
225
  this.settings = [];
206
226
  this.brightness = 0.0;
207
227
  this.contrast = 1.0;
228
+ this.discardAlpha = true;
208
229
  }
209
230
  },
210
231
  addNewSlide: function () {
@@ -276,7 +297,7 @@ export default {
276
297
 
277
298
  .t-slides-container {
278
299
  width: 250px;
279
- height: 218px;
300
+ height: 250px;
280
301
  overflow-y: auto;
281
302
  }
282
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,6 +8,7 @@ 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']
@@ -16,7 +17,6 @@ declare module 'vue' {
16
17
  ElFooter: typeof import('element-plus/es')['ElFooter']
17
18
  ElIcon: typeof import('element-plus/es')['ElIcon']
18
19
  ElIconArrowLeft: typeof import('@element-plus/icons-vue')['ArrowLeft']
19
- ElIconArrowRight: typeof import('@element-plus/icons-vue')['ArrowRight']
20
20
  ElIconDelete: typeof import('@element-plus/icons-vue')['Delete']
21
21
  ElIconPlus: typeof import('@element-plus/icons-vue')['Plus']
22
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;