@abi-software/map-utilities 1.1.3-beta.0 → 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.0",
3
+ "version": "1.1.3-beta.2",
4
4
  "files": [
5
5
  "dist/*",
6
6
  "src/*",
package/src/App.vue CHANGED
@@ -38,6 +38,7 @@ const drawnTypes = [
38
38
  { value: "Polygon", label: "Polygon" },
39
39
  { value: "None", label: "None" },
40
40
  ];
41
+ const showConnectivityGraph = ref(false);
41
42
 
42
43
  onMounted(() => {
43
44
  console.log("🚀 ~ onMounted ~ appRef:", appRef.value);
@@ -422,6 +423,25 @@ function changeHover(value) {
422
423
  </el-button>
423
424
  </el-col>
424
425
  </el-row>
426
+ <el-row>
427
+ <el-col>
428
+ <h3>Connectivity Graph</h3>
429
+ </el-col>
430
+ <el-col>
431
+ <el-button
432
+ @click="showConnectivityGraph = true"
433
+ size="small"
434
+ >
435
+ Show connectivity graph
436
+ </el-button>
437
+ <el-button
438
+ @click="showConnectivityGraph = false"
439
+ size="small"
440
+ >
441
+ Hide connectivity graph
442
+ </el-button>
443
+ </el-col>
444
+ </el-row>
425
445
 
426
446
  <DrawToolbar
427
447
  v-show="isFlatmap"
@@ -491,6 +511,11 @@ function changeHover(value) {
491
511
  @setColour="setColour"
492
512
  @checkChanged="checkChanged"
493
513
  />
514
+ <ConnectivityGraph
515
+ v-if="showConnectivityGraph"
516
+ entry="ilxtr:neuron-type-aacar-13"
517
+ map-server="https://mapcore-demo.org/curation/flatmap/"
518
+ />
494
519
  </div>
495
520
  </template>
496
521
 
@@ -508,4 +533,9 @@ function changeHover(value) {
508
533
  top: calc(50% - 100px);
509
534
  left: calc(50% - 200px);
510
535
  }
536
+ .connectivity-graph {
537
+ width: 600px;
538
+ height: 600px;
539
+ margin-top: 1rem;
540
+ }
511
541
  </style>
@@ -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() {
@@ -106,7 +157,6 @@ export default {
106
157
  }
107
158
  }
108
159
  }
109
- // this.#sourceSelector.innerHTML = sourceList.join('')
110
160
  return firstSource;
111
161
  },
112
162
  setPathList: async function (source) {
@@ -184,6 +234,17 @@ export default {
184
234
  hideSpinner: function () {
185
235
  // hide loading spinner
186
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
+ },
187
248
  },
188
249
  };
189
250
  </script>
@@ -202,10 +263,13 @@ export default {
202
263
  border: solid 1px #e4e7ed;
203
264
  }
204
265
 
205
- .node-key {
266
+ .control-panel {
206
267
  position: absolute;
207
268
  top: 1rem;
208
269
  right: 1rem;
270
+ }
271
+
272
+ .node-key {
209
273
  border: 1px solid $app-primary-color;
210
274
  padding: 4px;
211
275
  background-color: rgba(240, 240, 240, 0.8);
@@ -228,4 +292,57 @@ export default {
228
292
  width: 12px;
229
293
  height: 12px;
230
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
+ }
231
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
  {
@@ -189,7 +205,10 @@ class CytoscapeGraph
189
205
  roots: connectivityGraph.roots
190
206
  },
191
207
  directed: true,
192
- style: GRAPH_STYLE
208
+ style: GRAPH_STYLE,
209
+ minZoom: 0.5,
210
+ maxZoom: 10,
211
+ wheelSensitivity: 0.4,
193
212
  }).on('mouseover', 'node', this.overNode.bind(this))
194
213
  .on('mouseout', 'node', this.exitNode.bind(this))
195
214
  .on('position', 'node', this.moveNode.bind(this))
@@ -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']