@abi-software/flatmapvuer 1.20.1-demo.2 → 1.21.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/src/App.vue CHANGED
@@ -10,8 +10,7 @@
10
10
  <div class="options-container">
11
11
  <el-row :gutter="20">
12
12
  <el-col :span="8">
13
- <el-button @click="startHelpTour" size="small">Help Tour</el-button>
14
- <el-button @click="startHelpHover" size="small">Hover Help</el-button>
13
+ <el-button @click="helpMode = !helpMode" size="small">Help Mode</el-button>
15
14
  </el-col>
16
15
  <el-col :span="8">
17
16
  <el-button @click="saveSettings()" size="small">Save Settings</el-button>
@@ -58,6 +57,12 @@
58
57
  @ready="FlatmapReady"
59
58
  @context-restored="FlatmapReady"
60
59
  :initial="initial"
60
+ :helpMode="helpMode"
61
+ :helpModeDialog="useHelpModeDialog"
62
+ :helpModeActiveItem="helpModeActiveItem"
63
+ @help-mode-last-item="onHelpModeLastItem"
64
+ @shown-tooltip="onTooltipShown"
65
+ @shown-map-tooltip="onMapTooltipShown"
61
66
  :displayMinimap="true"
62
67
  :enableOpenMapUI="true"
63
68
  :flatmapAPI="flatmapAPI"
@@ -67,8 +72,14 @@
67
72
  @flatmapChanged="onFlatmapChanged"
68
73
  />
69
74
 
70
- <HelpModeTour v-model="helpTourOpen" :steps="helpTourSteps" />
71
- <HelpModeHover v-model="helpHoverOpen" :steps="helpTourSteps" />
75
+ <HelpModeDialog
76
+ v-if="helpMode && useHelpModeDialog"
77
+ ref="multiflatmapHelp"
78
+ :multiflatmapRef="multiflatmapRef"
79
+ :lastItem="helpModeLastItem"
80
+ @show-next="onHelpModeShowNext"
81
+ @finish-help-mode="onFinishHelpMode"
82
+ />
72
83
  </div>
73
84
  </template>
74
85
 
@@ -78,15 +89,14 @@ import { markRaw, shallowRef } from 'vue';
78
89
  import { Setting as ElIconSetting } from '@element-plus/icons-vue';
79
90
  import './icons/mapicon-species-style.css';
80
91
  import MultiFlatmapVuer from './components/MultiFlatmapVuer.vue';
81
- import { HelpModeHover, HelpModeTour } from '@abi-software/map-utilities';
92
+ import { HelpModeDialog } from '@abi-software/map-utilities';
82
93
  import '@abi-software/map-utilities/dist/style.css';
83
94
 
84
95
  export default {
85
96
  name: 'app',
86
97
  components: {
87
98
  MultiFlatmapVuer,
88
- HelpModeTour,
89
- HelpModeHover,
99
+ HelpModeDialog,
90
100
  },
91
101
  methods: {
92
102
  saveSettings: function () {
@@ -156,18 +166,35 @@ export default {
156
166
  this.$refs.multi.getCurrentFlatmap().searchAndShowResult(this.searchText, true);
157
167
  },
158
168
  onFlatmapChanged: function (activeSpecies) {
169
+ this.helpMode = false;
159
170
  // Update current flatmapImp after changing species
160
171
  if (this.$refs.multi.$refs[activeSpecies][0].mapImp) {
161
172
  window.flatmapImp = this.$refs.multi.$refs[activeSpecies][0].mapImp;
162
173
  }
163
174
  },
164
- startHelpTour: function () {
165
- this.helpTourSteps = this.$refs.multi.getHelpModeSteps();
166
- this.helpTourOpen = true;
175
+ onHelpModeShowNext: function () {
176
+ this.helpModeActiveItem += 1;
177
+ },
178
+ onHelpModeLastItem: function (isLastItem) {
179
+ if (isLastItem) {
180
+ this.helpModeLastItem = true;
181
+ }
182
+ },
183
+ onFinishHelpMode: function () {
184
+ this.helpMode = false;
185
+ // reset help mode to default values
186
+ this.helpModeActiveItem = 0;
187
+ this.helpModeLastItem = false;
188
+ },
189
+ onTooltipShown: function () {
190
+ if (this.$refs.multi && this.$refs.multiflatmapHelp) {
191
+ this.$refs.multiflatmapHelp.toggleTooltipHighlight();
192
+ }
167
193
  },
168
- startHelpHover: function () {
169
- this.helpTourSteps = this.$refs.multi.getHelpModeSteps();
170
- this.helpHoverOpen = true;
194
+ onMapTooltipShown: function () {
195
+ if (this.$refs.multi && this.$refs.multiflatmapHelp) {
196
+ this.$refs.multiflatmapHelp.toggleTooltipPinHighlight();
197
+ }
171
198
  },
172
199
  },
173
200
  provide() {
@@ -241,9 +268,10 @@ export default {
241
268
  },
242
269
  displayCloseButton: false,
243
270
  initial: 'Human Male',
244
- helpTourOpen: false,
245
- helpTourSteps: [],
246
- helpHoverOpen: false,
271
+ helpMode: false,
272
+ helpModeActiveItem: 0,
273
+ helpModeLastItem: false,
274
+ useHelpModeDialog: true,
247
275
  multiflatmapRef: null,
248
276
  mapSettings: [],
249
277
  // flatmapAPI: 'https://mapcore-demo.org/current/flatmap/v2/'
@@ -306,6 +334,13 @@ export default {
306
334
  window.multiflatmapRef = this.multiflatmapRef;
307
335
  //window.flatmapRef = this.multiflatmapRef.getCurrentFlatmap();
308
336
  },
337
+ watch: {
338
+ helpMode: function (newVal) {
339
+ if (!newVal) {
340
+ this.helpModeActiveItem = 0;
341
+ }
342
+ },
343
+ },
309
344
  };
310
345
  </script>
311
346