@abi-software/scaffoldvuer 1.11.3 → 1.11.4-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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abi-software/scaffoldvuer",
3
- "version": "1.11.3",
3
+ "version": "1.11.4-beta.0",
4
4
  "license": "Apache-2.0",
5
5
  "repository": {
6
6
  "type": "git",
package/src/App.vue CHANGED
@@ -22,6 +22,7 @@
22
22
  :marker-cluster="markerCluster"
23
23
  :minimap-settings="minimapSettings"
24
24
  :show-colour-picker="showColourPicker"
25
+ :positionalRotation="positionalRotation"
25
26
  :render="render"
26
27
  :region="region"
27
28
  :view-u-r-l="viewURL"
@@ -191,18 +192,7 @@
191
192
  <el-col>
192
193
  <el-row :gutter="20" justify="center" align="middle">
193
194
  <el-col>
194
- <el-switch v-model="syncMode" active-text="Sync Mode" active-color="#8300bf" />
195
- </el-col>
196
- </el-row>
197
- <el-row :gutter="20" justify="center" align="middle" v-if="syncMode">
198
- <el-col :span="8">
199
- <el-input-number v-model="zoom" :min="1.0" :controls="false" placeholder="Please input" aria-label="zoom" />
200
- </el-col>
201
- <el-col :span="8">
202
- <el-input-number v-model="pos[0]" :min="-1.0" :max="1.0" :controls="false" placeholder="Please input" aria-label="x" />
203
- </el-col>
204
- <el-col :span="8">
205
- <el-input-number v-model="pos[1]" :min="-1.0" :max="1.0" :controls="false" aria-label="y" />
195
+ <el-switch v-model="positionalRotation" active-text="Rotation Helper" active-color="#8300bf" />
206
196
  </el-col>
207
197
  </el-row>
208
198
  </el-col>
@@ -408,13 +398,13 @@ export default {
408
398
  displayMarkers: false,
409
399
  onClickMarkers: false,
410
400
  wireframe: false,
411
- syncMode: false,
412
401
  currentTime: 0,
413
402
  displayMinimap: false,
414
403
  tumbleOn: false,
415
404
  tumbleDirection: [1.0, 0.0],
416
405
  showColourPicker: true,
417
406
  markerCluster: false,
407
+ positionalRotation: false,
418
408
  minimapSettings: {
419
409
  x_offset: 16,
420
410
  y_offset: 50,
@@ -428,8 +418,6 @@ export default {
428
418
  viewURL: "",
429
419
  renderInfoOn: false,
430
420
  rendererInfo: undefined,
431
- zoom: 1,
432
- pos: [0, 0],
433
421
  format: "metadata",
434
422
  sceneSettings: [],
435
423
  searchInput: "",
@@ -488,9 +476,6 @@ export default {
488
476
  deep: true,
489
477
  immediate: true,
490
478
  },
491
- syncMode: function (val) {
492
- this.$refs.scaffold.toggleSyncControl(val);
493
- },
494
479
  helpMode: function (newVal) {
495
480
  if (!newVal) {
496
481
  this.helpModeActiveItem = 0;
@@ -0,0 +1,192 @@
1
+ <template>
2
+ <div
3
+ ref="overlay"
4
+ >
5
+ <div v-if="positionalRotation" ref="topLayer"
6
+ @mousemove.capture="forwardEvent"
7
+ @mouseover.capture="forwardEvent"
8
+ @click.capture="forwardEvent"
9
+ >
10
+ <div class="rotation-overlay top"
11
+ @mousedown="(event) => {setRotationMode(event, 'vertical'); forwardEvent(event)}"
12
+ @mouseup="forwardEvent"
13
+ >
14
+ <span>Click and drag here to rotate vertically</span>
15
+ </div>
16
+ <div class="rotation-overlay bottom"
17
+ @mousedown="(event) => {setRotationMode(event, 'vertical'); forwardEvent(event)}"
18
+ @mouseup="forwardEvent"
19
+ >
20
+ <span>Click and drag here to rotate vertically</span>
21
+ </div>
22
+ <div class="rotation-overlay left"
23
+ @mousedown="(event) => {setRotationMode(event, 'horizontal'); forwardEvent(event)}"
24
+ @mouseup="forwardEvent"
25
+ >
26
+ <span>Click and drag here to rotate horizontally</span>
27
+ </div>
28
+ <div class="rotation-overlay right"
29
+ @mousedown="(event) => {setRotationMode(event, 'horizontal'); forwardEvent(event)}"
30
+ @mouseup="forwardEvent"
31
+ >
32
+ <span>Click and drag here to rotate horizontally</span>
33
+ </div>
34
+ </div>
35
+ <div class="content-layer" ref="contentLayer"
36
+ @mouseleave.capture="skipWhenInBound"
37
+ @mousedown.capture="(event) => contentMouseActive(event, true)"
38
+ @mouseup.capture="(event) => contentMouseActive(event, false)"
39
+ >
40
+ <slot />
41
+ </div>
42
+ </div>
43
+ </template>
44
+
45
+ <script>
46
+ /* eslint-disable no-alert, no-console */
47
+
48
+ export default {
49
+ name: "ScaffoldOverlay",
50
+ data: function () {
51
+ return {
52
+ lockRotationMode: false,
53
+ }
54
+ },
55
+ props: {
56
+ /**
57
+ * Experimental feature to restrict rotation at
58
+ * one-axis based on position of the initial click
59
+ */
60
+ positionalRotation: {
61
+ type: Boolean,
62
+ default: false,
63
+ },
64
+ },
65
+ methods: {
66
+ contentMouseActive: function(event, flag) {
67
+ if (this.positionalRotation) {
68
+ const topLayer = this.$refs.topLayer;
69
+
70
+ if (topLayer) {
71
+ if (!flag) {
72
+ this.lockRotationMode = false;
73
+ this.setRotationMode(undefined, "free");
74
+ topLayer.style.pointerEvents = 'auto';
75
+ }
76
+ else {
77
+ this.lockRotationMode = true;
78
+ topLayer.style.pointerEvents = 'none';
79
+ }
80
+ }
81
+ }
82
+ event.preventDefault();
83
+ },
84
+ setRotationMode: function(event, mode) {
85
+ if (!this.lockRotationMode) {
86
+ this.$emit('onRotationModeChange', mode);
87
+ }
88
+ if (event) {
89
+ event.preventDefault();
90
+ event.stopPropagation();
91
+ }
92
+ },
93
+ skipWhenInBound: function(event) {
94
+ if (this.positionalRotation) {
95
+ const topLayer = this.$refs.topLayer;
96
+ const contentLayer = this.$refs.contentLayer;
97
+ if (topLayer && contentLayer) {
98
+ const pointerEvents = topLayer.style.pointerEvents;
99
+ topLayer.style.pointerEvents = 'none';
100
+ const elementBelow = document.elementFromPoint(event.clientX, event.clientY);
101
+ topLayer.style.pointerEvents = pointerEvents;
102
+ if (contentLayer.contains(elementBelow)) {
103
+ event.stopPropagation();
104
+ }
105
+ }
106
+ }
107
+ },
108
+ forwardEvent: function(event) {
109
+ const topLayer = this.$refs.topLayer;
110
+ if (!topLayer) return;
111
+ // Find the element directly underneath the cursor
112
+ const pointerEvents = topLayer.style.pointerEvents;
113
+ topLayer.style.pointerEvents = 'none';
114
+ const elementBelow = document.elementFromPoint(event.clientX, event.clientY);
115
+ //const elementBelow = this.$el;
116
+ topLayer.style.pointerEvents = 'auto';
117
+ topLayer.style.pointerEvents = pointerEvents;
118
+ //const elementBelow = this.$refs.contentLayer;
119
+ // Hide the top layer from pointer events
120
+ // If there's an element below, dispatch a new event on it
121
+ if (elementBelow) {
122
+ // We create a new MouseEvent, copying the properties from the original event.
123
+ // This is more robust than dispatching the original event itself.
124
+ const newEvent = new MouseEvent(
125
+ event.type,
126
+ {
127
+ bubbles: event.bubbles,
128
+ cancelable: event.cancelable,
129
+ view: event.view,
130
+ clientX: event.clientX,
131
+ clientY: event.clientY,
132
+ button: event.button,
133
+ }
134
+ );
135
+
136
+ elementBelow.dispatchEvent(newEvent);
137
+ }
138
+ event.stopPropagation();
139
+ event.preventDefault();
140
+ }
141
+ }
142
+ }
143
+ </script>
144
+
145
+ <style scoped lang="scss">
146
+ .rotation-overlay {
147
+ z-index: 2;
148
+ background-color: transparent;
149
+ position:absolute;
150
+ opacity: 0;
151
+ &:hover {
152
+ opacity: 1;
153
+ background-color: rgba(173,216,230, 0.1)
154
+ }
155
+ &.top {
156
+ top:0%;
157
+ height:20%;
158
+ left: 35%;
159
+ width: 30%;
160
+ }
161
+ &.bottom {
162
+ bottom:0%;
163
+ height:20%;
164
+ left: 35%;
165
+ width: 30%;
166
+ }
167
+ &.left {
168
+ top:35%;
169
+ height:30%;
170
+ left: 0%;
171
+ width: 20%;
172
+ }
173
+ &.right {
174
+ top:35%;
175
+ height:30%;
176
+ right: 0%;
177
+ width: 20%;
178
+ }
179
+ span {
180
+ position: relative;
181
+ color:black;
182
+ opacity:0.5;
183
+ top: 50%;
184
+ }
185
+ }
186
+
187
+ .content-layer {
188
+ width: 100%;
189
+ height: 100%;
190
+ }
191
+
192
+ </style>
@@ -1,10 +1,12 @@
1
1
  <template>
2
- <div
2
+ <scaffold-overlay
3
3
  ref="scaffoldContainer"
4
4
  v-loading="loading"
5
5
  class="scaffold-container"
6
6
  element-loading-text="Loading..."
7
7
  element-loading-background="rgba(0, 0, 0, 0.3)"
8
+ :positionalRotation="positionalRotation"
9
+ @onRotationModeChange="setRotationMode"
8
10
  >
9
11
  <map-svg-sprite-color />
10
12
  <scaffold-tooltip
@@ -410,7 +412,7 @@
410
412
  </el-row>
411
413
  </div>
412
414
  </div>
413
- </div>
415
+ </scaffold-overlay>
414
416
  </template>
415
417
 
416
418
  <script>
@@ -422,6 +424,7 @@ import {
422
424
  ArrowLeft as ElIconArrowLeft,
423
425
  } from '@element-plus/icons-vue'
424
426
  import PrimitiveControls from "./PrimitiveControls.vue";
427
+ import ScaffoldOverlay from "./ScaffoldOverlay.vue";
425
428
  import ScaffoldTooltip from "./ScaffoldTooltip.vue";
426
429
  import ScaffoldTreeControls from "./ScaffoldTreeControls.vue";
427
430
  import { MapSvgIcon, MapSvgSpriteColor } from "@abi-software/svg-sprite";
@@ -489,6 +492,7 @@ export default {
489
492
  Radio,
490
493
  RadioGroup,
491
494
  Row,
495
+ ScaffoldOverlay,
492
496
  Select,
493
497
  Slider,
494
498
  TabPane,
@@ -684,6 +688,14 @@ export default {
684
688
  type: Boolean,
685
689
  default: false,
686
690
  },
691
+ /**
692
+ * Experimental feature to restrict rotation at
693
+ * one-axis based on position of the initial click
694
+ */
695
+ positionalRotation: {
696
+ type: Boolean,
697
+ default: false,
698
+ },
687
699
  /**
688
700
  * Define what is considered as nerves.
689
701
  */
@@ -1027,7 +1039,7 @@ export default {
1027
1039
  this.$module.initialiseRenderer(this.$refs.display);
1028
1040
  this.toggleRendering(this.render);
1029
1041
  this.ro = new ResizeObserver(this.adjustLayout).observe(
1030
- this.$refs.scaffoldContainer
1042
+ this.$refs.scaffoldContainer.$el
1031
1043
  );
1032
1044
  this.helpTextWait = [];
1033
1045
  this.helpTextWait.length = this.hoverVisibilities.length;
@@ -1567,6 +1579,13 @@ export default {
1567
1579
  }
1568
1580
  }
1569
1581
  },
1582
+ setRotationMode: function(mode) {
1583
+ if (this.$module.scene) {
1584
+ console.log("here", mode)
1585
+ const cameracontrol = this.$module.scene.getZincCameraControls();
1586
+ cameracontrol.setRotationMode(mode);
1587
+ }
1588
+ },
1570
1589
  updateViewURL: function (viewURL) {
1571
1590
  if (viewURL) {
1572
1591
  if (this.isReady) {
@@ -1819,7 +1838,7 @@ export default {
1819
1838
  if (event.identifiers.length > 0 && event.identifiers[0]) {
1820
1839
  if (event.identifiers[0].coords) {
1821
1840
  const offsets =
1822
- this.$refs.scaffoldContainer.getBoundingClientRect();
1841
+ this.$refs.scaffoldContainer.$el.getBoundingClientRect();
1823
1842
  this.tData.x = event.identifiers[0].coords.x - offsets.left;
1824
1843
  this.tData.y = event.identifiers[0].coords.y - offsets.top;
1825
1844
  }
@@ -2778,8 +2797,8 @@ export default {
2778
2797
  * Callback using ResizeObserver.
2779
2798
  */
2780
2799
  adjustLayout: function () {
2781
- if (this.$refs.scaffoldContainer) {
2782
- let width = this.$refs.scaffoldContainer.clientWidth;
2800
+ if (this.$refs.scaffoldContainer?.$el) {
2801
+ let width = this.$refs.scaffoldContainer.$el.clientWidth;
2783
2802
  this.minimisedSlider = width < 812;
2784
2803
  if (this.minimisedSlider) {
2785
2804
  this.sliderPosition = this.drawerOpen ? "right" : "left";
@@ -36,6 +36,7 @@ declare module 'vue' {
36
36
  PrimitiveControls: typeof import('./components/PrimitiveControls.vue')['default']
37
37
  RouterLink: typeof import('vue-router')['RouterLink']
38
38
  RouterView: typeof import('vue-router')['RouterView']
39
+ ScaffoldOverlay: typeof import('./components/ScaffoldOverlay.vue')['default']
39
40
  ScaffoldTooltip: typeof import('./components/ScaffoldTooltip.vue')['default']
40
41
  ScaffoldTreeControls: typeof import('./components/ScaffoldTreeControls.vue')['default']
41
42
  ScaffoldVuer: typeof import('./components/ScaffoldVuer.vue')['default']