@abi-software/scaffoldvuer 0.3.0 → 0.3.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-lock.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abi-software/scaffoldvuer",
3
- "version": "0.3.0",
3
+ "version": "0.3.1",
4
4
  "lockfileVersion": 1,
5
5
  "requires": true,
6
6
  "dependencies": {
@@ -18091,9 +18091,9 @@
18091
18091
  }
18092
18092
  },
18093
18093
  "zincjs": {
18094
- "version": "1.2.0",
18095
- "resolved": "https://registry.npmjs.org/zincjs/-/zincjs-1.2.0.tgz",
18096
- "integrity": "sha512-1VzHgOgd7LxowMSx5DuwsWis2K7gPdxyKt2FF8oPGnq3mSVBvn36nE28q6hx7AvcR2ZQHiojql9lb4baIfonug==",
18094
+ "version": "1.3.0",
18095
+ "resolved": "https://registry.npmjs.org/zincjs/-/zincjs-1.3.0.tgz",
18096
+ "integrity": "sha512-zS7Fg/zhdIKUhyF56ZzzfiboHcOkgPE9D3mRdspmR2Iv6FpUPUrUDsk8VAikliJx9rvY4PNkCLjsor3Vx/eXeQ==",
18097
18097
  "requires": {
18098
18098
  "css-element-queries": "^1.2.2",
18099
18099
  "lodash": "^4.17.19",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abi-software/scaffoldvuer",
3
- "version": "0.3.0",
3
+ "version": "0.3.1",
4
4
  "license": "Apache-2.0",
5
5
  "repository": {
6
6
  "type": "git",
@@ -42,7 +42,7 @@
42
42
  "vue-custom-element": "^3.3.0",
43
43
  "vue-drag-resize": "^1.3.2",
44
44
  "vue-router": "^3.5.1",
45
- "zincjs": "^1.2.0"
45
+ "zincjs": "^1.3.0"
46
46
  },
47
47
  "devDependencies": {
48
48
  "@vue/cli-plugin-babel": "^4.0.0",
@@ -1,72 +1,38 @@
1
1
  <template>
2
- <div
3
- v-if="material!=undefined"
4
- ref="control"
5
- class="opacity-control"
6
- >
7
- <el-drawer
8
- custom-class="my-drawer"
9
- class="drawer-content"
10
- :visible.sync="drawerOpen"
11
- :append-to-body="false"
12
- :modal-append-to-body="false"
13
- size="300"
14
- :with-header="false"
15
- :wrapper-closable="false"
16
- :modal="false"
2
+ <el-container v-if="material" class="opacity-container">
3
+ <el-header
4
+ height="37px"
5
+ class="header"
17
6
  >
18
- <div
19
- v-if="drawerOpen"
20
- class="tab-button close"
21
- @click="toggleDrawer"
22
- >
23
- <i class="el-icon-arrow-right" />
7
+ <div>Opacity</div>
8
+ </el-header>
9
+ <el-main class="main">
10
+ <div class="block">
11
+ <span class="display">{{ displayString }}</span>
12
+ <el-slider
13
+ v-model="material.opacity"
14
+ class="my-slider"
15
+ :step="0.01"
16
+ :min="0"
17
+ :max="1"
18
+ :format-tooltip="formatTooltip"
19
+ :show-tooltip="false"
20
+ />
24
21
  </div>
25
- <el-container class="opacity-container">
26
- <el-header
27
- height="37px"
28
- class="header"
29
- >
30
- <div>Opacity</div>
31
- </el-header>
32
- <el-main class="main">
33
- <div class="block">
34
- <span class="display">{{ displayString }}</span>
35
- <el-slider
36
- v-model="material.opacity"
37
- class="my-slider"
38
- :step="0.01"
39
- :min="0"
40
- :max="1"
41
- :format-tooltip="formatTooltip"
42
- :show-tooltip="false"
43
- />
44
- </div>
45
- </el-main>
46
- </el-container>
47
- </el-drawer>
48
- <div
49
- v-if="!drawerOpen"
50
- class="tab-button open"
51
- @click="toggleDrawer"
52
- >
53
- <i class="el-icon-arrow-left" />
54
- </div>
55
- </div>
22
+ </el-main>
23
+ </el-container>
56
24
  </template>
57
25
 
58
26
  <script>
59
27
  /* eslint-disable no-alert, no-console */
60
28
  import Vue from "vue";
61
- import { Container, Drawer, Header, Icon, Main, Slider } from "element-ui";
29
+ import { Container, Header, Main, Slider } from "element-ui";
62
30
  import lang from "element-ui/lib/locale/lang/en";
63
31
  import locale from "element-ui/lib/locale";
64
32
 
65
33
  locale.use(lang);
66
34
  Vue.use(Container);
67
- Vue.use(Drawer);
68
35
  Vue.use(Header);
69
- Vue.use(Icon);
70
36
  Vue.use(Main);
71
37
  Vue.use(Slider);
72
38
 
@@ -75,51 +41,41 @@ Vue.use(Slider);
75
41
  */
76
42
  export default {
77
43
  name: "OpacityControls",
44
+ props: {
45
+ material: undefined,
46
+ },
78
47
  data: function() {
79
48
  return {
80
49
  displayString: "100%",
81
- material: undefined,
82
- drawerOpen: true
83
50
  };
84
51
  },
85
52
  watch: {
86
53
  "material.opacity": function() {
87
- if (this.material) {
88
- this._zincobject.setAlpha(this.material.opacity);
54
+ if (this.material && this._zincObject) {
55
+ this._zincObject.setAlpha(this.material.opacity);
89
56
  }
90
57
  }
91
58
  },
92
59
  mounted: function() {
93
- this._zincobject = undefined;
60
+ this._zincObject = undefined;
94
61
  },
95
62
  methods: {
96
63
  formatTooltip(val) {
97
64
  this.displayString = Math.floor(100 * val + 0.5) + "%";
98
65
  return this.displayString;
99
66
  },
100
- toggleDrawer: function() {
101
- this.drawerOpen = !this.drawerOpen;
102
- },
103
67
  setObject(object) {
104
- if (object) this.material = object.morph.material;
105
- else this.material = undefined;
106
- this._zincobject = object;
68
+ this._zincObject = object;
107
69
  }
108
- }
70
+ },
109
71
  };
110
72
  </script>
111
73
 
112
74
  <!-- Add "scoped" attribute to limit CSS to this component only -->
113
75
  <style scoped lang="scss">
114
76
  @import "~element-ui/packages/theme-chalk/src/container";
115
- @import "~element-ui/packages/theme-chalk/src/drawer";
116
77
  @import "~element-ui/packages/theme-chalk/src/slider";
117
78
 
118
- .opacity-control {
119
- text-align: left;
120
- width:300px;
121
- }
122
-
123
79
  .header {
124
80
  color: #606266;
125
81
  line-height: 1;
@@ -132,12 +88,6 @@ export default {
132
88
  width: 44px;
133
89
  }
134
90
 
135
- .icon {
136
- right: 17px;
137
- position: absolute;
138
- top: 10px;
139
- }
140
-
141
91
  .main {
142
92
  font-size: 13px;
143
93
  padding: 20px 17px 0 15px;
@@ -170,53 +120,4 @@ export default {
170
120
  background-color: $app-primary-color;
171
121
  }
172
122
 
173
- .drawer-content {
174
- position: relative;
175
- height: 93px;
176
- pointer-events: none;
177
- }
178
-
179
- ::v-deep .my-drawer {
180
- background: rgba(0, 0, 0, 0);
181
- box-shadow: none;
182
- }
183
-
184
- ::v-deep .my-drawer .el-drawer__body {
185
- height: 93px;
186
- }
187
-
188
- .tab-button {
189
- width: 20px;
190
- height: 40px;
191
- z-index: 8;
192
- right: 0px;
193
-
194
- box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.06);
195
- border: solid 1px #e4e7ed;
196
- background-color: #FFFFFF;
197
- text-align: center;
198
- vertical-align: middle;
199
- cursor: pointer;
200
- pointer-events: auto;
201
- //transition: bottom 0.3s;
202
-
203
- &.close {
204
- float: left;
205
- flex: 1;
206
- border-right: 0;
207
- margin-top: 26px;
208
- }
209
-
210
- &.open {
211
- position: absolute;
212
- bottom:26px;
213
- }
214
-
215
- i {
216
- margin-top: 12px;
217
- color: $app-primary-color;
218
- transform: scaleY(2.5);
219
- }
220
- }
221
-
222
123
  </style>
@@ -1,11 +1,15 @@
1
1
  <template>
2
2
  <div
3
- v-show="material!=undefined"
3
+ v-show="material || isTextureSlides"
4
4
  class="primitive-controls"
5
5
  >
6
6
  <el-drawer
7
7
  custom-class="my-drawer"
8
- class="drawer-content"
8
+ :class="{
9
+ 'drawer-content': true,
10
+ 'opacity': material !== undefined,
11
+ 'texture-slides': isTextureSlides,
12
+ }"
9
13
  :visible.sync="drawerOpen"
10
14
  :append-to-body="false"
11
15
  :modal-append-to-body="false"
@@ -24,6 +28,10 @@
24
28
  <opacity-controls
25
29
  :material="material"
26
30
  ref="opacityControls" />
31
+ <texture-slides-controls
32
+ v-show="isTextureSlides"
33
+ class="controls"
34
+ ref="tSlidesControls" />
27
35
  </el-drawer>
28
36
  <div
29
37
  v-if="!drawerOpen"
@@ -39,6 +47,7 @@
39
47
  /* eslint-disable no-alert, no-console */
40
48
  import Vue from "vue";
41
49
  import OpacityControls from "./OpacityControls";
50
+ import TextureSlidesControls from "./TextureSlidesControls";
42
51
  import { Drawer, Icon } from "element-ui";
43
52
  import lang from "element-ui/lib/locale/lang/en";
44
53
  import locale from "element-ui/lib/locale";
@@ -54,29 +63,34 @@ export default {
54
63
  name: "PrimitiveControls",
55
64
  components: {
56
65
  OpacityControls,
66
+ TextureSlidesControls,
57
67
  },
58
68
  data: function() {
59
69
  return {
60
70
  material: undefined,
61
- drawerOpen: true
71
+ isTextureSlides: false,
72
+ drawerOpen: true,
62
73
  };
63
- },
64
- watch: {
65
-
66
74
  },
67
75
  mounted: function() {
68
76
  this._zincobject = undefined;
69
77
  },
70
78
  methods: {
71
- formatTooltip(val) {
79
+ formatTooltip: function(val) {
72
80
  this.displayString = Math.floor(100 * val + 0.5) + "%";
73
81
  return this.displayString;
74
82
  },
75
83
  toggleDrawer: function() {
76
84
  this.drawerOpen = !this.drawerOpen;
77
85
  },
78
- setObject(object) {
79
- console.log(object, this.$refs)
86
+ setObject: function(object) {
87
+ this._zincobject = object;
88
+ if (object.isTextureSlides) {
89
+ this.isTextureSlides = true;
90
+ this.$refs.tSlidesControls.setObject(object);
91
+ } else {
92
+ this.isTextureSlides = false;
93
+ }
80
94
  if (object && object.morph) this.material = object.morph.material;
81
95
  else this.material = undefined;
82
96
  this.$refs.opacityControls.setObject(object);
@@ -93,7 +107,8 @@ export default {
93
107
 
94
108
  .primitive-controls {
95
109
  text-align: left;
96
- width:300px;
110
+ width:350px;
111
+ pointer-events:none;
97
112
  }
98
113
 
99
114
  .display {
@@ -108,8 +123,12 @@ export default {
108
123
 
109
124
  .drawer-content {
110
125
  position: relative;
111
- height: 93px;
112
- pointer-events: none;
126
+ &.opacity {
127
+ height: 93px;
128
+ }
129
+ &.texture-slides{
130
+ height: 250px;
131
+ }
113
132
  }
114
133
 
115
134
  ::v-deep .my-drawer {
@@ -117,10 +136,6 @@ export default {
117
136
  box-shadow: none;
118
137
  }
119
138
 
120
- ::v-deep .my-drawer .el-drawer__body {
121
- height: 93px;
122
- }
123
-
124
139
  .tab-button {
125
140
  width: 20px;
126
141
  height: 40px;
@@ -140,7 +155,7 @@ export default {
140
155
  float: left;
141
156
  flex: 1;
142
157
  border-right: 0;
143
- margin-top: 26px;
158
+ bottom: 26px;
144
159
  }
145
160
 
146
161
  &.open {
@@ -80,8 +80,8 @@
80
80
  @object-hovered="objectHovered"
81
81
  @drawer-toggled="drawerToggled"
82
82
  />
83
- <div class="opacity-box">
84
- <opacity-controls ref="opacityControl" />
83
+ <div class="primitive-controls-box">
84
+ <primitive-controls ref="primitiveControls" />
85
85
  </div>
86
86
  <el-popover
87
87
  v-if="sceneData.timeVarying"
@@ -311,7 +311,7 @@
311
311
  <script>
312
312
  /* eslint-disable no-alert, no-console */
313
313
  import Vue from "vue";
314
- import OpacityControls from "./OpacityControls";
314
+ import PrimitiveControls from "./PrimitiveControls";
315
315
  import ScaffoldTooltip from "./ScaffoldTooltip";
316
316
  import TreeControls from "./TreeControls";
317
317
  import { MapSvgIcon, MapSvgSpriteColor } from "@abi-software/svg-sprite";
@@ -350,7 +350,7 @@ const EventNotifier = require("../scripts/eventNotifier").EventNotifier;
350
350
  /**
351
351
  * A vue component of the scaffold viewer.
352
352
  *
353
- * @requires ./OpacityControls.vue
353
+ * @requires ./PrimitveControls.vue
354
354
  * @requires ./TreeControls.vue
355
355
  */
356
356
  export default {
@@ -358,7 +358,7 @@ export default {
358
358
  components: {
359
359
  MapSvgIcon,
360
360
  MapSvgSpriteColor,
361
- OpacityControls,
361
+ PrimitiveControls,
362
362
  ScaffoldTooltip,
363
363
  TreeControls,
364
364
  },
@@ -1029,8 +1029,9 @@ export default {
1029
1029
  */
1030
1030
  objectSelected: function (objects, propagate) {
1031
1031
  this.selectedObjects = objects;
1032
- if (this.selectedObjects && this.selectedObjects.length > 0)
1033
- this.$refs.opacityControl.setObject(this.selectedObjects[0]);
1032
+ if (this.selectedObjects && this.selectedObjects.length > 0) {
1033
+ this.$refs.primitiveControls.setObject(this.selectedObjects[0]);
1034
+ }
1034
1035
  this.$module.setSelectedByZincObjects(objects, undefined, propagate);
1035
1036
  },
1036
1037
  /**
@@ -1998,7 +1999,7 @@ export default {
1998
1999
  font-family: "Asap", sans-serif;
1999
2000
  }
2000
2001
 
2001
- .opacity-box {
2002
+ .primitive-controls-box {
2002
2003
  right: 0px;
2003
2004
  bottom: 200px;
2004
2005
  position: absolute;
@@ -0,0 +1,272 @@
1
+ <template>
2
+ <el-container v-show="settings.length > 0" class="t-slides-container">
3
+ <el-header height="30px" class="header">
4
+ <div>Texture Slides Settings</div>
5
+ </el-header>
6
+ <el-main class="block">
7
+ <el-row v-for="(slide, index) in settings" :key="slide.id">
8
+ <el-col :offset="0" :span="2">
9
+ <el-select
10
+ :popper-append-to-body="false"
11
+ :value="slide.direction"
12
+ placeholder="Select"
13
+ class="input-box"
14
+ popper-class="viewer_dropdown"
15
+ @change="modifyDirection($event, slide)"
16
+ >
17
+ <el-option
18
+ v-for="item in directions"
19
+ :key="item.value"
20
+ :label="item.label"
21
+ :value="item.value"
22
+ />
23
+ </el-select>
24
+ </el-col>
25
+ <el-col :offset="0" :span="14">
26
+ <el-slider
27
+ v-model="slide.value"
28
+ class="my-slider"
29
+ :step="0.01"
30
+ :min="0"
31
+ :max="1"
32
+ :show-tooltip="false"
33
+ @input="modifySlide(slide)"
34
+ />
35
+ </el-col>
36
+ <el-col :offset="0" :span="3">
37
+ <el-input-number
38
+ v-model="slide.value"
39
+ :step="0.01"
40
+ :min="0"
41
+ :max="1"
42
+ :controls="false"
43
+ class="input-box number-input"
44
+ />
45
+ </el-col>
46
+ <el-col :offset="2" :span="2">
47
+ <i
48
+ class="el-icon-close close-icon"
49
+ @click="removeSlide(index, slide)"
50
+ />
51
+ </el-col>
52
+ </el-row>
53
+ </el-main>
54
+ <el-footer height="30px" class="add-slides-text" @click.native="addNewSlide">
55
+ <el-row>
56
+ <el-col :span="2">
57
+ <i class="el-icon-plus" />
58
+ </el-col>
59
+ <el-col :span="10"> Add a new slide </el-col>
60
+ </el-row>
61
+ </el-footer>
62
+ </el-container>
63
+ </template>
64
+
65
+ <script>
66
+ /* eslint-disable no-alert, no-console */
67
+ import Vue from "vue";
68
+ import {
69
+ Col,
70
+ Container,
71
+ Footer,
72
+ Header,
73
+ Icon,
74
+ InputNumber,
75
+ Main,
76
+ Row,
77
+ Slider,
78
+ } from "element-ui";
79
+ import lang from "element-ui/lib/locale/lang/en";
80
+ import locale from "element-ui/lib/locale";
81
+
82
+ locale.use(lang);
83
+ Vue.use(Col);
84
+ Vue.use(Container);
85
+ Vue.use(Footer);
86
+ Vue.use(Header);
87
+ Vue.use(Icon);
88
+ Vue.use(InputNumber);
89
+ Vue.use(Main);
90
+ Vue.use(Slider);
91
+ Vue.use(Row);
92
+
93
+ /**
94
+ * A component to control the opacity of the target object.
95
+ */
96
+ export default {
97
+ name: "TextureSlidesControls",
98
+ data: function () {
99
+ return {
100
+ settings: [],
101
+ directions: [
102
+ {
103
+ value: "x",
104
+ label: "x",
105
+ },
106
+ {
107
+ value: "y",
108
+ label: "y",
109
+ },
110
+ {
111
+ value: "z",
112
+ label: "z",
113
+ },
114
+ ],
115
+ };
116
+ },
117
+ watch: {
118
+ settings: function () {
119
+ if (this.material && this._zincObject) {
120
+ this._zincObject.setAlpha(this.material.opacity);
121
+ }
122
+ },
123
+ },
124
+ mounted: function () {
125
+ this._zincObject = undefined;
126
+ },
127
+ methods: {
128
+ setObject: function (object) {
129
+ if (object.isTextureSlides) {
130
+ this._zincObject = object;
131
+ this.settings = this._zincObject.getTextureSettings();
132
+ } else {
133
+ this._zincObject = undefined;
134
+ this.settings = [];
135
+ }
136
+ },
137
+ addNewSlide: function () {
138
+ const newSettings = { direction: "x", value: 0 };
139
+ const returnSettings = this._zincObject.createSlide(newSettings);
140
+ this.settings.push(returnSettings);
141
+ },
142
+ modifyDirection: function(direction, slide) {
143
+ if (slide) {
144
+ slide.direction = direction;
145
+ this._zincObject.modifySlideSettings(slide);
146
+ }
147
+ },
148
+ modifySlide: function (slide) {
149
+ if (slide) {
150
+ this._zincObject.modifySlideSettings(slide);
151
+ }
152
+ },
153
+ removeSlide: function (index, slide) {
154
+ this._zincObject.removeSlideWithId(slide.id);
155
+ this.settings.splice(index, 1);
156
+ },
157
+ },
158
+ };
159
+ </script>
160
+
161
+ <!-- Add "scoped" attribute to limit CSS to this component only -->
162
+ <style scoped lang="scss">
163
+ @import "~element-ui/packages/theme-chalk/src/col";
164
+ @import "~element-ui/packages/theme-chalk/src/container";
165
+ @import "~element-ui/packages/theme-chalk/src/input-number";
166
+ @import "~element-ui/packages/theme-chalk/src/slider";
167
+ @import "~element-ui/packages/theme-chalk/src/row";
168
+
169
+ .header {
170
+ color: #606266;
171
+ line-height: 1;
172
+ padding: 8px 17px 1px 15px;
173
+ border-bottom: 1px solid #ebeef5;
174
+ font-size: 14px;
175
+ }
176
+
177
+ .add-slides-text {
178
+ color: $app-primary-color;
179
+ line-height: 1;
180
+ padding: 9px 17px 9px 15px;
181
+ border-top: 1px solid #ebeef5;
182
+ font-size: 12px;
183
+ cursor: pointer;
184
+ pointer-events: auto;
185
+ }
186
+
187
+ .display {
188
+ width: 44px;
189
+ }
190
+
191
+ .block {
192
+ pointer-events: auto;
193
+ &.el-main {
194
+ padding: 5px;
195
+ &::-webkit-scrollbar {
196
+ width: 10px;
197
+ }
198
+
199
+ &::-webkit-scrollbar-thumb {
200
+ border-radius: 10px;
201
+ box-shadow: inset 0 0 6px #c0c4cc;
202
+ }
203
+ }
204
+ }
205
+
206
+ .my-slider {
207
+ width: 109px;
208
+ top: -6px;
209
+ left: 50px;
210
+ position: relative;
211
+ }
212
+
213
+ .t-slides-container {
214
+ width: 300px;
215
+ height: 250px;
216
+ border-radius: 4px;
217
+ border: solid 1px #d8dce6;
218
+ background-color: #fff;
219
+ overflow-y: none;
220
+ }
221
+
222
+ ::v-deep .el-slider__bar {
223
+ background-color: $app-primary-color;
224
+ }
225
+
226
+ .input-box {
227
+ width: 42px;
228
+ border-radius: 4px;
229
+ border: 1px solid rgb(144, 147, 153);
230
+ background-color: var(--white);
231
+ font-weight: 500;
232
+ color: rgb(48, 49, 51);
233
+ margin-left: 8px;
234
+
235
+ &.number-input {
236
+ width: 42px;
237
+ ::v-deep .el-input__inner {
238
+ padding-left: 0px;
239
+ padding-right: 0px;
240
+ }
241
+ }
242
+
243
+ ::v-deep .el-input__inner {
244
+ color: $app-primary-color;
245
+ height: 22px;
246
+ padding-left: 8px;
247
+ padding-right: 8px;
248
+ border: none;
249
+ font-family: "Asap", sans-serif;
250
+ line-height: 22px;
251
+ }
252
+
253
+ ::v-deep .el-input,
254
+ ::v-deep .el-input__icon {
255
+ line-height: 22px;
256
+ }
257
+
258
+ .viewer_dropdown .el-select-dropdown__item {
259
+ white-space: nowrap;
260
+ color: $app-primary-color;
261
+ text-align: left;
262
+ font-family: "Asap", sans-serif;
263
+ }
264
+ }
265
+
266
+ .close-icon {
267
+ color: $app-primary-color;
268
+ top: 2px;
269
+ position: relative;
270
+ cursor: pointer;
271
+ }
272
+ </style>