@abi-software/map-utilities 1.1.3-beta.1 → 1.1.3-beta.2

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/map-utilities",
3
- "version": "1.1.3-beta.1",
3
+ "version": "1.1.3-beta.2",
4
4
  "files": [
5
5
  "dist/*",
6
6
  "src/*",
@@ -1,13 +1,56 @@
1
1
  <template>
2
2
  <div class="connectivity-graph">
3
3
  <div ref="graphCanvas" class="graph-canvas"></div>
4
- <div class="node-key">
5
- <div class="key-head">Node type:</div>
6
- <div>
7
- <div><span>Node:</span><span class="key-box" style="background: #80F0F0"/></div>
8
- <div><span>Axon:</span><span class="key-box" style="background: green"/></div>
9
- <div><span>Dendrite:</span><span class="key-box" style="background: red"/></div>
10
- <div><span>Both:</span><span class="key-box" style="background: gray"/></div>
4
+ <div class="control-panel">
5
+ <div class="node-key">
6
+ <div class="key-head">Node type:</div>
7
+ <div>
8
+ <div><span>Node:</span><span class="key-box" style="background: #80F0F0"/></div>
9
+ <div><span>Axon:</span><span class="key-box" style="background: green"/></div>
10
+ <div><span>Dendrite:</span><span class="key-box" style="background: red"/></div>
11
+ <div><span>Both:</span><span class="key-box" style="background: gray"/></div>
12
+ </div>
13
+ </div>
14
+ <div class="tools">
15
+ <el-tooltip
16
+ :content="resetLabel"
17
+ placement="bottom"
18
+ effect="control-tooltip"
19
+ >
20
+ <el-button
21
+ class="control-button"
22
+ :class="theme"
23
+ size="small"
24
+ @click="reset"
25
+ >
26
+ <el-icon color="white">
27
+ <el-icon-aim />
28
+ </el-icon>
29
+ <span class="visually-hidden">{{ resetLabel }}</span>
30
+ </el-button>
31
+ </el-tooltip>
32
+ <el-tooltip
33
+ :content="zoomLockLabel"
34
+ placement="bottom"
35
+ effect="control-tooltip"
36
+ >
37
+ <el-button
38
+ class="control-button"
39
+ :class="theme"
40
+ size="small"
41
+ @click="toggleZoom"
42
+ >
43
+ <el-icon color="white">
44
+ <template v-if="zoomEnabled">
45
+ <el-icon-lock />
46
+ </template>
47
+ <template v-else>
48
+ <el-icon-unlock />
49
+ </template>
50
+ </el-icon>
51
+ <span class="visually-hidden">{{ zoomLockLabel }}</span>
52
+ </el-button>
53
+ </el-tooltip>
11
54
  </div>
12
55
  </div>
13
56
  </div>
@@ -17,6 +60,10 @@
17
60
  import { ConnectivityGraph } from './graph';
18
61
 
19
62
  const MIN_SCHEMA_VERSION = 1.3;
63
+ const RESET_LABEL = 'Reset position';
64
+ const ZOOM_LOCK_LABEL = 'Lock zoom (to scroll)';
65
+ const ZOOM_UNLOCK_LABEL = 'Unlock zoom';
66
+ const APP_PRIMARY_COLOR = '#8300bf';
20
67
 
21
68
  export default {
22
69
  name: 'ConnectivityGraph',
@@ -40,6 +87,10 @@ export default {
40
87
  knowledgeByPath: new Map(),
41
88
  labelledTerms: new Set(),
42
89
  labelCache: new Map(),
90
+ resetLabel: RESET_LABEL,
91
+ zoomLockLabel: ZOOM_LOCK_LABEL,
92
+ iconColor: APP_PRIMARY_COLOR,
93
+ zoomEnabled: false,
43
94
  };
44
95
  },
45
96
  mounted() {
@@ -183,6 +234,17 @@ export default {
183
234
  hideSpinner: function () {
184
235
  // hide loading spinner
185
236
  },
237
+ reset: function () {
238
+ this.connectivityGraph.reset();
239
+ },
240
+ /**
241
+ * Enable/disable user zoom for scrolling
242
+ */
243
+ toggleZoom: function () {
244
+ this.zoomEnabled = !this.zoomEnabled;
245
+ this.zoomLockLabel = this.zoomEnabled ? ZOOM_UNLOCK_LABEL : ZOOM_LOCK_LABEL;
246
+ this.connectivityGraph.enableZoom(!this.zoomEnabled);
247
+ },
186
248
  },
187
249
  };
188
250
  </script>
@@ -201,10 +263,13 @@ export default {
201
263
  border: solid 1px #e4e7ed;
202
264
  }
203
265
 
204
- .node-key {
266
+ .control-panel {
205
267
  position: absolute;
206
268
  top: 1rem;
207
269
  right: 1rem;
270
+ }
271
+
272
+ .node-key {
208
273
  border: 1px solid $app-primary-color;
209
274
  padding: 4px;
210
275
  background-color: rgba(240, 240, 240, 0.8);
@@ -227,4 +292,57 @@ export default {
227
292
  width: 12px;
228
293
  height: 12px;
229
294
  }
295
+
296
+ .tools {
297
+ margin-top: 1rem;
298
+ display: flex;
299
+ flex-direction: row;
300
+ gap: 0.5rem;
301
+ align-items: flex-end;
302
+ justify-content: flex-end;
303
+ }
304
+
305
+ .control-button {
306
+ margin: 0 !important;
307
+ padding: 0.25rem !important;
308
+ font-size: 14px !important;
309
+ border-color: $app-primary-color !important;
310
+ background: $app-primary-color !important;
311
+ transition: all 0.25s ease;
312
+
313
+ &,
314
+ &:focus,
315
+ &:active {
316
+ box-shadow: none !important;
317
+ }
318
+
319
+ &:hover {
320
+ background: $lightPurple !important;
321
+ }
322
+ }
323
+
324
+ .visually-hidden {
325
+ clip: rect(0 0 0 0);
326
+ clip-path: inset(50%);
327
+ height: 1px;
328
+ overflow: hidden;
329
+ position: absolute;
330
+ white-space: nowrap;
331
+ width: 1px;
332
+ }
333
+ </style>
334
+
335
+ <style lang="scss">
336
+ .el-popper.is-control-tooltip {
337
+ padding: 4px 10px;
338
+ font-family: Asap;
339
+ background: #f3ecf6 !important;
340
+ border: 1px solid $app-primary-color;
341
+
342
+ & .el-popper__arrow::before {
343
+ border: 1px solid;
344
+ border-color: $app-primary-color;
345
+ background: #f3ecf6;
346
+ }
347
+ }
230
348
  </style>
@@ -81,6 +81,22 @@ export class ConnectivityGraph
81
81
  }
82
82
  }
83
83
 
84
+ reset()
85
+ //=================
86
+ {
87
+ if (this.cy?.cy) {
88
+ this.cy.cy.reset()
89
+ }
90
+ }
91
+
92
+ enableZoom(option)
93
+ //=================
94
+ {
95
+ if (this.cy?.cy) {
96
+ this.cy.cy.userZoomingEnabled(option)
97
+ }
98
+ }
99
+
84
100
  get elements()
85
101
  //============
86
102
  {
@@ -18,6 +18,7 @@ declare module 'vue' {
18
18
  ElCol: typeof import('element-plus/es')['ElCol']
19
19
  ElColorPicker: typeof import('element-plus/es')['ElColorPicker']
20
20
  ElIcon: typeof import('element-plus/es')['ElIcon']
21
+ ElIconAim: typeof import('@element-plus/icons-vue')['Aim']
21
22
  ElIconArrowDown: typeof import('@element-plus/icons-vue')['ArrowDown']
22
23
  ElIconArrowUp: typeof import('@element-plus/icons-vue')['ArrowUp']
23
24
  ElIconClose: typeof import('@element-plus/icons-vue')['Close']
@@ -25,6 +26,8 @@ declare module 'vue' {
25
26
  ElIconDelete: typeof import('@element-plus/icons-vue')['Delete']
26
27
  ElIconEdit: typeof import('@element-plus/icons-vue')['Edit']
27
28
  ElIconFinished: typeof import('@element-plus/icons-vue')['Finished']
29
+ ElIconLock: typeof import('@element-plus/icons-vue')['Lock']
30
+ ElIconUnlock: typeof import('@element-plus/icons-vue')['Unlock']
28
31
  ElIconWarning: typeof import('@element-plus/icons-vue')['Warning']
29
32
  ElInput: typeof import('element-plus/es')['ElInput']
30
33
  ElMain: typeof import('element-plus/es')['ElMain']