@abi-software/scaffoldvuer 1.2.1 → 1.3.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.
@@ -5,7 +5,7 @@
5
5
  <el-col :offset="0" :span="6">
6
6
  Width:
7
7
  </el-col>
8
- <el-col :offset="0" :span="10">
8
+ <el-col :offset="0" :span="12">
9
9
  <el-slider
10
10
  v-model="width"
11
11
  class="my-slider"
@@ -16,7 +16,7 @@
16
16
  @input="modifyWidth"
17
17
  />
18
18
  </el-col>
19
- <el-col :offset="0" :span="6">
19
+ <el-col :offset="0" :span="4">
20
20
  <el-input-number
21
21
  v-model="width"
22
22
  :step="1"
@@ -27,24 +27,68 @@
27
27
  />
28
28
  </el-col>
29
29
  </el-row>
30
- <el-row v-if="createData.faceIndex > -1">
31
- <el-col :offset="0" :span="4">
32
- <el-button :icon="ElIconArrowLeft" @click="onMoveClick(-unit)"/>
33
- </el-col>
34
- <el-col :offset="3" :span="3">
35
- Move
36
- </el-col>
37
- <el-col :offset="0" :span="7">
38
- <el-input-number
39
- v-model="unit"
40
- :controls="false"
41
- class="input-box number-input"
42
- />
43
- </el-col>
44
- <el-col :offset="2" :span="2">
45
- <el-button :icon="ElIconArrowRight" @click="onMoveClick(unit)"/>
46
- </el-col>
47
- </el-row>
30
+ <template v-if="currentIndex > -1 && distance > 0">
31
+ <el-row>
32
+ <el-col :offset="0" :span="4">
33
+ <el-button
34
+ size='small'
35
+ :disabled="currentIndex === 0"
36
+ :icon="ElIconArrowLeft"
37
+ @click="changeIndex(false)"
38
+ />
39
+ </el-col>
40
+ <el-col :offset="4" :span="9">
41
+ Editing Line {{ currentIndex + 1}}
42
+ </el-col>
43
+ <el-col :offset="2" :span="2">
44
+ <el-button
45
+ size='small'
46
+ :icon="ElIconArrowRight"
47
+ @click="changeIndex(true)"
48
+ />
49
+ </el-col>
50
+ </el-row>
51
+ <el-row>
52
+ <el-col :offset="0" :span="6">
53
+ Move:
54
+ </el-col>
55
+ <el-col :offset="0" :span="16">
56
+ <el-slider
57
+ v-model="adjust"
58
+ :step="0.01"
59
+ :min="-3"
60
+ :max="3"
61
+ :show-tooltip="false"
62
+ @input="onMoveSliding()"
63
+ @change="reset()"
64
+ />
65
+ </el-col>
66
+ </el-row>
67
+ <el-row>
68
+ <el-col :offset="0" :span="6">
69
+ Length:
70
+ </el-col>
71
+ <el-col :offset="0" :span="10">
72
+ <el-slider
73
+ v-model="lengthScale"
74
+ :step="0.01"
75
+ :min="-1"
76
+ :max="1"
77
+ :show-tooltip="false"
78
+ @input="onLengthSliding()"
79
+ @change="reset()"
80
+ />
81
+ </el-col>
82
+ <el-col :offset="0" :span="6">
83
+ <el-input-number
84
+ v-model="newDistance"
85
+ :controls="false"
86
+ class="input-box number-input"
87
+ @change="onLengthInput"
88
+ />
89
+ </el-col>
90
+ </el-row>
91
+ </template>
48
92
  </el-main>
49
93
  </el-container>
50
94
  </template>
@@ -55,7 +99,8 @@
55
99
  // limited support to line width
56
100
  import { shallowRef } from 'vue';
57
101
  import {
58
- moveLine,
102
+ getLineDistance,
103
+ moveAndExtendLine,
59
104
  } from "../scripts/Utilities.js";
60
105
  import {
61
106
  ElButton as Button,
@@ -63,15 +108,12 @@ import {
63
108
  ElContainer as Container,
64
109
  ElInputNumber as InputNumber,
65
110
  ElMain as Main,
66
- ElSelect as Select,
67
111
  ElSlider as Slider,
68
- ElOption as Option,
69
112
  } from "element-plus";
70
- import {
113
+ import{
71
114
  ArrowLeft as ElIconArrowLeft,
72
115
  ArrowRight as ElIconArrowRight,
73
116
  } from '@element-plus/icons-vue';
74
-
75
117
  /**
76
118
  * A component to control the opacity of the target object.
77
119
  */
@@ -83,9 +125,7 @@ export default {
83
125
  Container,
84
126
  InputNumber,
85
127
  Main,
86
- Select,
87
128
  Slider,
88
- Option,
89
129
  ElIconArrowLeft,
90
130
  ElIconArrowRight,
91
131
  },
@@ -96,23 +136,86 @@ export default {
96
136
  },
97
137
  data: function () {
98
138
  return {
139
+ adjust: 0,
140
+ pAdjust: 0,
141
+ lengthScale: 0,
142
+ distance: 0,
143
+ newDistance: 0,
99
144
  width: 1,
100
- unit: 0.1,
145
+ currentIndex: 0,
101
146
  ElIconArrowLeft: shallowRef(ElIconArrowLeft),
102
147
  ElIconArrowRight: shallowRef(ElIconArrowRight),
148
+ edited: false,
103
149
  };
104
150
  },
151
+ watch: {
152
+ "createData.faceIndex": {
153
+ handler: function (value) {
154
+ if (this._zincObject?.isLines2) {
155
+ this.currentIndex = value;
156
+ this.distance = getLineDistance(this._zincObject, this.currentIndex);
157
+ }
158
+ },
159
+ immediate: true,
160
+ },
161
+ },
105
162
  mounted: function () {
106
163
  this._zincObject = undefined;
107
164
  },
108
165
  methods: {
109
- onMoveClick: function(unit) {
110
- moveLine(this._zincObject, this.createData.faceIndex, unit);
166
+ changeIndex: function(increment) {
167
+ if (increment) {
168
+ const dist = getLineDistance(this._zincObject, this.currentIndex + 1);
169
+ if (dist > 0) {
170
+ this.currentIndex++;
171
+ this.reset();
172
+ }
173
+ } else {
174
+ this.currentIndex--;
175
+ this.reset();
176
+ }
177
+ },
178
+ onLengthInput: function() {
179
+ if (this.newDistance !== 0) {
180
+ this.distance = this.newDistance;
181
+ this.edited = moveAndExtendLine(
182
+ this._zincObject, this.currentIndex, this.newDistance, true) || this.edited;
183
+ } else {
184
+ this.newDistance = this.distance;
185
+ }
186
+ },
187
+ onLengthSliding: function() {
188
+ this.newDistance = Math.pow(10, this.lengthScale) * this.distance;
189
+ this.edited = moveAndExtendLine(
190
+ this._zincObject, this.currentIndex, this.newDistance, true) || this.edited;
191
+ },
192
+ onMoveSliding: function() {
193
+ const diff = (this.adjust - this.pAdjust) * this.distance;
194
+ this.edited = moveAndExtendLine(
195
+ this._zincObject, this.currentIndex, diff, false) || this.edited;
196
+ this.pAdjust = this.adjust;
197
+ },
198
+ reset: function() {
199
+ this.adjust = 0;
200
+ this.pAdjust = 0;
201
+ this.lengthScale = 0;
202
+ this.distance = getLineDistance(this._zincObject, this.currentIndex);
203
+ this.newDistance = this.distance;
204
+ if (this.edited) {
205
+ this.$emit("primitivesUpdated", this._zincObject);
206
+ this.edited = false;
207
+ }
111
208
  },
112
209
  setObject: function (object) {
113
- if (object.isLines) {
210
+ this.currentIndex = -1;
211
+ this.distance = 0;
212
+ if (object.isLines2) {
114
213
  this._zincObject = object;
115
214
  this.width = this._zincObject.getMorph().material.linewidth;
215
+ if (object.isEditable) {
216
+ this.currentIndex = 0;
217
+ this.distance = getLineDistance(object, this.currentIndex);
218
+ }
116
219
  } else {
117
220
  this._zincObject = undefined;
118
221
  this.linewidth = 10;
@@ -49,22 +49,100 @@
49
49
  </el-select>
50
50
  </el-col>
51
51
  </el-row>
52
+ <template v-if="currentIndex > -1">
53
+ <el-row>
54
+ <el-col :offset="0" :span="4">
55
+ <el-button
56
+ size='small'
57
+ :disabled="currentIndex === 0"
58
+ :icon="ElIconArrowLeft"
59
+ @click="changeIndex(false)"
60
+ />
61
+ </el-col>
62
+ <el-col :offset="4" :span="9">
63
+ Editing Point {{ currentIndex + 1}}
64
+ </el-col>
65
+ <el-col :offset="2" :span="2">
66
+ <el-button
67
+ size='small'
68
+ :icon="ElIconArrowRight"
69
+ @click="changeIndex(true)"
70
+ />
71
+ </el-col>
72
+ </el-row>
73
+ <el-row>
74
+ <el-col :offset="0" :span="6">
75
+ x:
76
+ </el-col>
77
+ <el-col :offset="0" :span="16">
78
+ <el-slider
79
+ v-model="translation[0]"
80
+ :step="0.01"
81
+ :min="min[0]"
82
+ :max="max[0]"
83
+ :show-tooltip="false"
84
+ @input="onMoveSliding()"
85
+ @change="reset()"
86
+ />
87
+ </el-col>
88
+ </el-row>
89
+ <el-row>
90
+ <el-col :offset="0" :span="6">
91
+ y:
92
+ </el-col>
93
+ <el-col :offset="0" :span="16">
94
+ <el-slider
95
+ v-model="translation[1]"
96
+ :step="0.01"
97
+ :min="min[1]"
98
+ :max="max[1]"
99
+ :show-tooltip="false"
100
+ @input="onMoveSliding()"
101
+ @change="reset()"
102
+ />
103
+ </el-col>
104
+ </el-row>
105
+ <el-row>
106
+ <el-col :offset="0" :span="6">
107
+ z:
108
+ </el-col>
109
+ <el-col :offset="0" :span="16">
110
+ <el-slider
111
+ v-model="translation[2]"
112
+ :step="0.01"
113
+ :min="min[2]"
114
+ :max="max[2]"
115
+ :show-tooltip="false"
116
+ @input="onMoveSliding()"
117
+ @change="reset()"
118
+ />
119
+ </el-col>
120
+ </el-row>
121
+ </template>
52
122
  </el-main>
53
123
  </el-container>
54
124
  </template>
55
125
 
56
126
  <script>
57
127
  /* eslint-disable no-alert, no-console */
58
-
128
+ import { shallowRef } from 'vue';
129
+ import {
130
+ movePoint,
131
+ } from "../scripts/Utilities.js";
59
132
  import {
60
133
  ElCol as Col,
61
134
  ElContainer as Container,
62
135
  ElInputNumber as InputNumber,
63
136
  ElMain as Main,
137
+ ElRow as Row,
64
138
  ElSelect as Select,
65
139
  ElSlider as Slider,
66
140
  ElOption as Option,
67
141
  } from "element-plus";
142
+ import{
143
+ ArrowLeft as ElIconArrowLeft,
144
+ ArrowRight as ElIconArrowRight,
145
+ } from '@element-plus/icons-vue';
68
146
 
69
147
  /**
70
148
  * A component to control the opacity of the target object.
@@ -78,8 +156,12 @@ export default {
78
156
  Main,
79
157
  Select,
80
158
  Slider,
159
+ Row,
81
160
  Option,
161
+ ElIconArrowLeft,
162
+ ElIconArrowRight,
82
163
  },
164
+ inject: ['boundingDims'],
83
165
  data: function () {
84
166
  return {
85
167
  attenuation: false,
@@ -94,17 +176,80 @@ export default {
94
176
  label: "off",
95
177
  },
96
178
  ],
179
+ min: [0, 0, 0],
180
+ max: [1, 1, 1],
181
+ translation: [0, 0, 0],
182
+ pTranslation: [0, 0, 0],
183
+ currentIndex: -1,
184
+ ElIconArrowLeft: shallowRef(ElIconArrowLeft),
185
+ ElIconArrowRight: shallowRef(ElIconArrowRight),
186
+ edited: false,
97
187
  };
98
188
  },
99
189
  mounted: function () {
100
190
  this._zincObject = undefined;
101
191
  },
192
+ watch: {
193
+ boundingDims: {
194
+ handler: function (value) {
195
+ const size = value.size;
196
+ this.min = [
197
+ -size[0] / 2,
198
+ -size[1] / 2,
199
+ -size[2] / 2,
200
+ ];
201
+ this.max = [
202
+ size[0] / 2,
203
+ size[1] / 2,
204
+ size[2] / 2,
205
+ ];
206
+ },
207
+ immediate: true,
208
+ deep: true,
209
+ },
210
+ },
102
211
  methods: {
212
+ changeIndex: function(increment) {
213
+ if (increment) {
214
+ if (this._zincObject.drawRange > this.currentIndex + 1) {
215
+ this.currentIndex++;
216
+ this.reset();
217
+ }
218
+ } else {
219
+ this.currentIndex--;
220
+ this.reset();
221
+ }
222
+ },
223
+ onMoveSliding: function() {
224
+ const diff = [
225
+ this.translation[0] - this.pTranslation[0],
226
+ this.translation[1] - this.pTranslation[1],
227
+ this.translation[2] - this.pTranslation[2],
228
+ ];
229
+ this.edited = movePoint(this._zincObject, this.currentIndex, diff) || this.edited;
230
+ for (let i = 0; i < 3; i++) {
231
+ this.pTranslation[i] = this.translation[i];
232
+ }
233
+ },
234
+ reset: function() {
235
+ this.translation = [0, 0, 0];
236
+ this.pTranslation = [0, 0, 0];
237
+ if (this.edited) {
238
+ this.$emit("primitivesUpdated", this._zincObject);
239
+ this.edited = false;
240
+ }
241
+ },
103
242
  setObject: function (object) {
243
+ this.currentIndex = -1;
104
244
  if (object.isPointset) {
105
245
  this._zincObject = object;
106
246
  this.size = this._zincObject.morph.material.size;
107
- this.attenuation = this._zincObject.morph.material.sizeAttenuation
247
+ this.attenuation = this._zincObject.morph.material.sizeAttenuation;
248
+ if (object.isEditable) {
249
+ if (this._zincObject.drawRange > 0) {
250
+ this.currentIndex = 0;
251
+ }
252
+ }
108
253
  } else {
109
254
  this._zincObject = undefined;
110
255
  this.size = 10;
@@ -12,7 +12,7 @@
12
12
  :zincObject="zincObject"
13
13
  ref="opacityControls" />
14
14
  </el-collapse-item>
15
- <el-collapse-item title="Transformation" name="trControls">
15
+ <el-collapse-item v-show="!isEditable" title="Transformation" name="trControls">
16
16
  <transformation-controls
17
17
  class="transformation-controls"
18
18
  ref="transformationControls" />
@@ -25,13 +25,17 @@
25
25
  <el-collapse-item v-show="isPointset" title="Points" name="pControls">
26
26
  <points-controls
27
27
  class="pointset-controls"
28
- ref="pointsetControls" />
28
+ ref="pointsetControls"
29
+ @primitivesUpdated="$emit('primitivesUpdated', $event)"
30
+ />
29
31
  </el-collapse-item>
30
32
  <el-collapse-item v-show="isLines" title="Lines" name="lControls">
31
33
  <lines-controls
32
34
  class="lines-controls"
33
35
  ref="linesControls"
34
- :createData="createData" />
36
+ :createData="createData"
37
+ @primitivesUpdated="$emit('primitivesUpdated', $event)"
38
+ />
35
39
  </el-collapse-item>
36
40
  </el-collapse>
37
41
  </div>
@@ -91,6 +95,7 @@ export default {
91
95
  isLines: false,
92
96
  drawerOpen: true,
93
97
  zincObject: undefined,
98
+ isEditable: false,
94
99
  };
95
100
  },
96
101
  methods: {
@@ -107,10 +112,11 @@ export default {
107
112
  } else {
108
113
  this.zincObject = undefined;
109
114
  }
115
+ this.isEditable = this.zincObject?.isEditable ? true : false;
110
116
  this.isPointset = false;
111
117
  this.isTextureSlides = false;
112
118
  this.isLines = false;
113
- this.activeName = "oControls";
119
+ this.activeName = "trControls";
114
120
  if (object) {
115
121
  if (object.isTextureSlides) {
116
122
  this.isTextureSlides = true;
@@ -19,7 +19,7 @@
19
19
  :createData="createData"
20
20
  @confirm-create="$emit('confirm-create', $event)"
21
21
  @cancel-create="$emit('cancel-create')"
22
- />
22
+ />
23
23
  <Tooltip
24
24
  class="p-tooltip"
25
25
  v-show="annotationDisplay && !createData.toBeConfirmed"
@@ -27,19 +27,50 @@
27
27
  :annotationDisplay="true"
28
28
  :annotationEntry="annotationEntry"
29
29
  />
30
+ <div v-if="createData.toBeDeleted" class="delete-container">
31
+ <el-row>
32
+ <el-col :span="10">Delete this feature?</el-col>
33
+ <el-col :span="7">
34
+ <el-button
35
+ class="delete-button"
36
+ :icon="ElIconDelete"
37
+ @click="$emit('confirm-delete')"
38
+ >
39
+ Delete
40
+ </el-button>
41
+ </el-col>
42
+ <el-col :span="6">
43
+ <el-button
44
+ class="delete-button"
45
+ @click="$emit('cancel-create')"
46
+ >
47
+ Dismiss
48
+ </el-button>
49
+ </el-col>
50
+ </el-row>
51
+ </div>
30
52
  </template>
31
53
  </el-popover>
32
54
  </div>
33
55
  </template>
34
56
 
35
57
  <script>
58
+ import { shallowRef } from 'vue';
36
59
  /* eslint-disable no-alert, no-console */
37
- import { ElPopover as Popover } from "element-plus";
60
+ import {
61
+ ElCol as Col,
62
+ ElIcon as Icon,
63
+ ElPopover as Popover,
64
+ ElRow as Row,
65
+ } from "element-plus";
66
+ import {
67
+ Delete as ElIconDelete,
68
+ } from '@element-plus/icons-vue'
38
69
  import CreateTooltiipContent from "./CreateTooltipContent.vue";
39
- import { Tooltip } from "@abi-software/flatmapvuer";
40
- import "@abi-software/flatmapvuer/dist/style.css";
41
70
  import { mapState } from 'pinia';
42
71
  import { useMainStore } from "@/store/index";
72
+ import { Tooltip } from '@abi-software/map-utilities'
73
+ import '@abi-software/map-utilities/dist/style.css'
43
74
 
44
75
  /**
45
76
  * A component to control the opacity of the target object.
@@ -47,8 +78,12 @@ import { useMainStore } from "@/store/index";
47
78
  export default {
48
79
  name: "ScaffoldTooltip",
49
80
  components: {
81
+ Col,
50
82
  CreateTooltiipContent,
83
+ ElIconDelete,
84
+ Icon,
51
85
  Popover,
86
+ Row,
52
87
  Tooltip,
53
88
  },
54
89
  props: {
@@ -96,7 +131,8 @@ export default {
96
131
  data: function () {
97
132
  return {
98
133
  display: false,
99
- annotationEntry: { }
134
+ annotationEntry: { },
135
+ ElIconDelete: shallowRef(ElIconDelete),
100
136
  };
101
137
  },
102
138
  computed: {
@@ -206,5 +242,23 @@ export default {
206
242
  display:none;
207
243
  }
208
244
  }
245
+
246
+ .delete-container {
247
+ margin-top: 12px;
248
+ margin-bottom: 12px;
249
+ font-size: 14px;
250
+ .delete-button {
251
+ pointer-events: auto;
252
+ cursor: pointer;
253
+ margin-left:8px;
254
+ padding-left: 8px;
255
+ padding-right: 8px;
256
+ height: 24px !important;
257
+ color: $app-primary-color;
258
+ &:hover {
259
+ background-color: var(--el-color-primary-light-9);
260
+ }
261
+ }
262
+ }
209
263
  }
210
264
  </style>