@abi-software/flatmapvuer 0.5.8 → 0.5.9-alpha-connected-paths.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.
@@ -279,7 +279,14 @@
279
279
  :appendToBody="false"
280
280
  trigger="click"
281
281
  popper-class="background-popper"
282
- >
282
+ >
283
+ <el-row class="backgroundText">HighlightTool</el-row>
284
+ <el-row class="backgroundControl">
285
+ <el-radio-group v-model="highlightToolOn" class="flatmap-radio" @change="setHighlightTool">
286
+ <el-radio :label="true">On</el-radio>
287
+ <el-radio :label="false">Off</el-radio>
288
+ </el-radio-group>
289
+ </el-row>
283
290
  <el-row class="backgroundText">Organs display</el-row>
284
291
  <el-row class="backgroundControl">
285
292
  <el-radio-group v-model="colourRadio" class="flatmap-radio" @change="setColour">
@@ -353,6 +360,8 @@
353
360
  <Tooltip
354
361
  ref="tooltip"
355
362
  class="tooltip"
363
+ @highlightConnectedPaths="highlightConnectedPaths"
364
+ @onClose="closeTooltip"
356
365
  :entry="tooltipEntry"
357
366
  />
358
367
  </div>
@@ -510,6 +519,9 @@ export default {
510
519
  this.mapImp.setColour({ colour: flag, outline: this.outlinesRadio });
511
520
  }
512
521
  },
522
+ setHighlightTool: function(flag) {
523
+ this.highlightToolOn = flag;
524
+ },
513
525
  /**
514
526
  * Function to toggle outlines f organs.
515
527
  */
@@ -576,6 +588,22 @@ export default {
576
588
  payload.keys.forEach(key => this.mapImp.enableSckanPath(key, payload.value));
577
589
  }
578
590
  },
591
+ highlightConnectedPaths: function(payload) {
592
+ if (this.mapImp) {
593
+ let paths = [...this.mapImp.pathModelNodes(payload)]
594
+ // The line below matches the paths to the annIdToFeatureId map to get the feature ids
595
+
596
+ let pathFeatures = paths.map(p=>this.mapImp.featureProperties(p))
597
+ let toHighlight = []
598
+ pathFeatures.forEach(p=>{
599
+ this.mapImp.nodePathModels(p.featureId).forEach(f=>{
600
+ toHighlight.push(f)
601
+ })
602
+ })
603
+ // display connected paths
604
+ this.mapImp.zoomToFeatures(toHighlight, {noZoomIn: true});
605
+ }
606
+ },
579
607
  systemSelected: function(payload) {
580
608
  if (this.mapImp) {
581
609
  this.mapImp.enableSystem(payload.key, payload.value);
@@ -641,11 +669,18 @@ export default {
641
669
  provenanceTaxonomy: data.taxons ? JSON.parse(data.taxons) : undefined
642
670
  };
643
671
  if (eventType === "click") {
644
- this.currentActive = data.models ? data.models : "";
645
- } else if (eventType === "mouseenter") {
672
+
673
+ if (this.highlightToolOn) {
674
+ this.highlightConnectedPaths([data.models])
675
+ } else {
676
+ console.log('active changed')
677
+ this.currentActive = data.models ? data.models : "";
678
+ }
679
+ } else if (eventType === "mouseenter" && !this.highlightToolOn) {
680
+ console.log('active changed')
646
681
  this.currentHover = data.models ? data.models : "";
647
682
  }
648
- if (data && data.type !== "marker" && eventType === "click"){
683
+ if (data && data.type !== "marker" && eventType === "click" && !this.highlightToolOn){
649
684
  this.checkAndCreatePopups(payload);
650
685
  }
651
686
  this.$emit("resource-selected", payload);
@@ -662,6 +697,7 @@ export default {
662
697
  // result 0 is the connection, result 1 is the pubmed results from flatmap
663
698
  if(results[0] || results[1] ||( data.feature.hyperlinks && data.feature.hyperlinks.length > 0)){
664
699
  this.resourceForTooltip = data.resource[0];
700
+ data.resourceForTooltip = this.resourceForTooltip;
665
701
  this.createTooltipFromNeuronCuration(data);
666
702
  }
667
703
  },
@@ -677,6 +713,12 @@ export default {
677
713
  "block";
678
714
  };
679
715
  },
716
+ closeTooltip: function() {
717
+ this.$refs.tooltip.$el.style.display = "none";
718
+ document.querySelectorAll('.maplibregl-popup').forEach(item => {
719
+ item.style.display = "none";
720
+ });
721
+ },
680
722
  createTooltipFromNeuronCuration: async function(data) {
681
723
  this.tooltipEntry = await this.flatmapQueries.createTooltipData(data);
682
724
  this.displayTooltip();
@@ -1146,6 +1188,7 @@ export default {
1146
1188
  currentBackground: "white",
1147
1189
  availableBackground: ["white", "lightskyblue", "black"],
1148
1190
  loading: false,
1191
+ highlightToolOn: false,
1149
1192
  flatmapMarker: flatmapMarker,
1150
1193
  tooltipEntry: createUnfilledTooltipData(),
1151
1194
  connectivityTooltipVisible: false,
@@ -6,6 +6,9 @@
6
6
  <div v-if="entry.provenanceTaxonomyLabel && entry.provenanceTaxonomyLabel.length > 0" class="subtitle">
7
7
  {{provSpeciesDescription}}
8
8
  </div>
9
+ <el-button @click="showConnectedPaths">
10
+ Show connected paths
11
+ </el-button>
9
12
  </div>
10
13
  <div class="block" v-else>
11
14
  <span class="title">{{entry.featureId}}</span>
@@ -187,6 +190,10 @@ export default {
187
190
  titleCase: function(title){
188
191
  return titleCase(title)
189
192
  },
193
+ showConnectedPaths(){
194
+ this.$emit('highlightConnectedPaths', this.entry.featureId)
195
+ this.$emit('onClose')
196
+ },
190
197
  capitalise: function(text){
191
198
  return capitalise(text)
192
199
  },