@abi-software/scaffoldvuer 1.2.1 → 1.3.0-beta.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,66 @@
27
27
  />
28
28
  </el-col>
29
29
  </el-row>
30
- <el-row v-if="createData.faceIndex > -1">
30
+ <template v-if="currentIndex > -1 && distance > 0">
31
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"
32
+ <el-button
33
+ size='small'
34
+ :disabled="currentIndex === 0"
35
+ :icon="ElIconArrowLeft"
36
+ @click="changeIndex(false)"
42
37
  />
43
38
  </el-col>
39
+ <el-col :offset="4" :span="9">
40
+ Editing Line {{ currentIndex + 1}}
41
+ </el-col>
44
42
  <el-col :offset="2" :span="2">
45
- <el-button :icon="ElIconArrowRight" @click="onMoveClick(unit)"/>
43
+ <el-button
44
+ size='small'
45
+ :icon="ElIconArrowRight"
46
+ @click="changeIndex(true)"
47
+ />
46
48
  </el-col>
47
- </el-row>
49
+ <el-row>
50
+ <el-col :offset="0" :span="6">
51
+ Move:
52
+ </el-col>
53
+ <el-col :offset="0" :span="16">
54
+ <el-slider
55
+ v-model="adjust"
56
+ :step="0.01"
57
+ :min="-3"
58
+ :max="3"
59
+ :show-tooltip="false"
60
+ @input="onMoveSliding()"
61
+ @change="reset()"
62
+ />
63
+ </el-col>
64
+ </el-row>
65
+ <el-row>
66
+ <el-col :offset="0" :span="6">
67
+ Length:
68
+ </el-col>
69
+ <el-col :offset="0" :span="10">
70
+ <el-slider
71
+ v-model="lengthScale"
72
+ :step="0.01"
73
+ :min="-1"
74
+ :max="1"
75
+ :show-tooltip="false"
76
+ @input="onLengthSliding()"
77
+ @change="reset()"
78
+ />
79
+ </el-col>
80
+ <el-col :offset="0" :span="6">
81
+ <el-input-number
82
+ v-model="newDistance"
83
+ :controls="false"
84
+ class="input-box number-input"
85
+ @change="onLengthInput"
86
+ />
87
+ </el-col>
88
+ </el-row>
89
+ </template>
48
90
  </el-main>
49
91
  </el-container>
50
92
  </template>
@@ -55,7 +97,8 @@
55
97
  // limited support to line width
56
98
  import { shallowRef } from 'vue';
57
99
  import {
58
- moveLine,
100
+ getLineDistance,
101
+ moveAndExtendLine,
59
102
  } from "../scripts/Utilities.js";
60
103
  import {
61
104
  ElButton as Button,
@@ -63,15 +106,12 @@ import {
63
106
  ElContainer as Container,
64
107
  ElInputNumber as InputNumber,
65
108
  ElMain as Main,
66
- ElSelect as Select,
67
109
  ElSlider as Slider,
68
- ElOption as Option,
69
110
  } from "element-plus";
70
- import {
111
+ import{
71
112
  ArrowLeft as ElIconArrowLeft,
72
113
  ArrowRight as ElIconArrowRight,
73
114
  } from '@element-plus/icons-vue';
74
-
75
115
  /**
76
116
  * A component to control the opacity of the target object.
77
117
  */
@@ -83,9 +123,7 @@ export default {
83
123
  Container,
84
124
  InputNumber,
85
125
  Main,
86
- Select,
87
126
  Slider,
88
- Option,
89
127
  ElIconArrowLeft,
90
128
  ElIconArrowRight,
91
129
  },
@@ -96,23 +134,85 @@ export default {
96
134
  },
97
135
  data: function () {
98
136
  return {
137
+ adjust: 0,
138
+ pAdjust: 0,
139
+ lengthScale: 0,
140
+ newDistance: 0,
99
141
  width: 1,
100
- unit: 0.1,
142
+ currentIndex: 0,
101
143
  ElIconArrowLeft: shallowRef(ElIconArrowLeft),
102
144
  ElIconArrowRight: shallowRef(ElIconArrowRight),
145
+ edited: false,
103
146
  };
104
147
  },
148
+ watch: {
149
+ "createData.faceIndex": {
150
+ handler: function (value) {
151
+ if (this._zincObject?.isLines2) {
152
+ this.currentIndex = value;
153
+ this.distance = getLineDistance(this._zincObject, this.currentIndex);
154
+ }
155
+ },
156
+ immediate: true,
157
+ },
158
+ },
105
159
  mounted: function () {
106
160
  this._zincObject = undefined;
107
161
  },
108
162
  methods: {
109
- onMoveClick: function(unit) {
110
- moveLine(this._zincObject, this.createData.faceIndex, unit);
163
+ changeIndex: function(increment) {
164
+ if (increment) {
165
+ const dist = getLineDistance(this._zincObject, this.currentIndex + 1);
166
+ if (dist > 0) {
167
+ this.currentIndex++;
168
+ this.reset();
169
+ }
170
+ } else {
171
+ this.currentIndex--;
172
+ this.reset();
173
+ }
174
+ },
175
+ onLengthInput: function() {
176
+ if (this.newDistance !== 0) {
177
+ this.distance = this.newDistance;
178
+ this.edited = moveAndExtendLine(
179
+ this._zincObject, this.currentIndex, this.newDistance, true) || this.edited;
180
+ } else {
181
+ this.newDistance = this.distance;
182
+ }
183
+ },
184
+ onLengthSliding: function() {
185
+ this.newDistance = Math.pow(10, this.lengthScale) * this.distance;
186
+ this.edited = moveAndExtendLine(
187
+ this._zincObject, this.currentIndex, this.newDistance, true) || this.edited;
188
+ },
189
+ onMoveSliding: function() {
190
+ const diff = (this.adjust - this.pAdjust) * this.distance;
191
+ this.edited = moveAndExtendLine(
192
+ this._zincObject, this.currentIndex, diff, false) || this.edited;
193
+ this.pAdjust = this.adjust;
194
+ },
195
+ reset: function() {
196
+ this.adjust = 0;
197
+ this.pAdjust = 0;
198
+ this.lengthScale = 0;
199
+ this.distance = getLineDistance(this._zincObject, this.currentIndex);
200
+ this.newDistance = this.distance;
201
+ if (this.edited) {
202
+ this.$emit("primitivesUpdated", this._zincObject);
203
+ this.edited = false;
204
+ }
111
205
  },
112
206
  setObject: function (object) {
113
- if (object.isLines) {
207
+ this.currentIndex = -1;
208
+ this.distance = 0;
209
+ if (object.isLines2) {
114
210
  this._zincObject = object;
115
211
  this.width = this._zincObject.getMorph().material.linewidth;
212
+ if (object.isEditable) {
213
+ this.currentIndex = 0;
214
+ this.distance = getLineDistance(object, this.currentIndex);
215
+ }
116
216
  } else {
117
217
  this._zincObject = undefined;
118
218
  this.linewidth = 10;
@@ -49,13 +49,86 @@
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,
@@ -65,6 +138,10 @@ import {
65
138
  ElSlider as Slider,
66
139
  ElOption as Option,
67
140
  } from "element-plus";
141
+ import{
142
+ ArrowLeft as ElIconArrowLeft,
143
+ ArrowRight as ElIconArrowRight,
144
+ } from '@element-plus/icons-vue';
68
145
 
69
146
  /**
70
147
  * A component to control the opacity of the target object.
@@ -79,7 +156,10 @@ export default {
79
156
  Select,
80
157
  Slider,
81
158
  Option,
159
+ ElIconArrowLeft,
160
+ ElIconArrowRight,
82
161
  },
162
+ inject: ['boundingDims'],
83
163
  data: function () {
84
164
  return {
85
165
  attenuation: false,
@@ -94,17 +174,80 @@ export default {
94
174
  label: "off",
95
175
  },
96
176
  ],
177
+ min: [0, 0, 0],
178
+ max: [1, 1, 1],
179
+ translation: [0, 0, 0],
180
+ pTranslation: [0, 0, 0],
181
+ currentIndex: -1,
182
+ ElIconArrowLeft: shallowRef(ElIconArrowLeft),
183
+ ElIconArrowRight: shallowRef(ElIconArrowRight),
184
+ edited: false,
97
185
  };
98
186
  },
99
187
  mounted: function () {
100
188
  this._zincObject = undefined;
101
189
  },
190
+ watch: {
191
+ boundingDims: {
192
+ handler: function (value) {
193
+ const size = value.size;
194
+ this.min = [
195
+ -size[0] / 2,
196
+ -size[1] / 2,
197
+ -size[2] / 2,
198
+ ];
199
+ this.max = [
200
+ size[0] / 2,
201
+ size[1] / 2,
202
+ size[2] / 2,
203
+ ];
204
+ },
205
+ immediate: true,
206
+ deep: true,
207
+ },
208
+ },
102
209
  methods: {
210
+ changeIndex: function(increment) {
211
+ if (increment) {
212
+ if (this._zincObject.drawRange > this.currentIndex + 1) {
213
+ this.currentIndex++;
214
+ this.reset();
215
+ }
216
+ } else {
217
+ this.currentIndex--;
218
+ this.reset();
219
+ }
220
+ },
221
+ onMoveSliding: function() {
222
+ const diff = [
223
+ this.translation[0] - this.pTranslation[0],
224
+ this.translation[1] - this.pTranslation[1],
225
+ this.translation[2] - this.pTranslation[2],
226
+ ];
227
+ this.edited = movePoint(this._zincObject, this.currentIndex, diff) || this.edited;
228
+ for (let i = 0; i < 3; i++) {
229
+ this.pTranslation[i] = this.translation[i];
230
+ }
231
+ },
232
+ reset: function() {
233
+ this.translation = [0, 0, 0];
234
+ this.pTranslation = [0, 0, 0];
235
+ if (this.edited) {
236
+ this.$emit("primitivesUpdated", this._zincObject);
237
+ this.edited = false;
238
+ }
239
+ },
103
240
  setObject: function (object) {
241
+ this.currentIndex = -1;
104
242
  if (object.isPointset) {
105
243
  this._zincObject = object;
106
244
  this.size = this._zincObject.morph.material.size;
107
- this.attenuation = this._zincObject.morph.material.sizeAttenuation
245
+ this.attenuation = this._zincObject.morph.material.sizeAttenuation;
246
+ if (object.isEditable) {
247
+ if (this._zincObject.drawRange > 0) {
248
+ this.currentIndex = 0;
249
+ }
250
+ }
108
251
  } else {
109
252
  this._zincObject = undefined;
110
253
  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>