Skip to content

Commit

Permalink
Merge pull request #209 from ddjnw1yu/zoom-in-marker
Browse files Browse the repository at this point in the history
zoom in marker
  • Loading branch information
alan-wu authored May 24, 2024
2 parents c95fd17 + 103d8cf commit 4e7c00d
Show file tree
Hide file tree
Showing 6 changed files with 55 additions and 34 deletions.
58 changes: 29 additions & 29 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@
"*.js"
],
"dependencies": {
"@abi-software/flatmapvuer": "1.0.2",
"@abi-software/map-side-bar": "2.1.0",
"@abi-software/flatmapvuer": "1.0.1",
"@abi-software/map-side-bar": "^2.2.0",
"@abi-software/plotvuer": "1.0.0",
"@abi-software/scaffoldvuer": "1.0.1",
"@abi-software/simulationvuer": "1.0.0",
Expand Down
6 changes: 6 additions & 0 deletions src/components/SplitFlow.vue
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
@actionClick="actionClick"
@tabClicked="tabClicked"
@search-changed="searchChanged($event)"
@hover-changed="hoverChanged($event)"
@contextUpdate="contextUpdate($event)"
@datalink-clicked="datalinkClicked($event)"
/>
Expand Down Expand Up @@ -253,6 +254,11 @@ export default {
}
payload.data.cb(suggestions);
},
hoverChanged: function (data) {
const hoverEntries = data && data.anatomy ? data.anatomy : []
this.settingsStore.updateHoveredMarkers(hoverEntries);
EventBus.emit("markerUpdate");
},
searchChanged: function (data) {
if (data && data.type == "query-update") {
this.search = data.value;
Expand Down
8 changes: 8 additions & 0 deletions src/components/viewers/MultiFlatmap.vue
Original file line number Diff line number Diff line change
Expand Up @@ -431,6 +431,14 @@ export default {
transform: translate(45px, -7px);
}
}
&.hovered-marker {
cursor: pointer !important;
z-index: 2;
div {
scale: 2;
transform: translate(0px, -5px);
}
}
}

</style>
Expand Down
9 changes: 6 additions & 3 deletions src/mixins/DynamicMarkerMixin.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { useSettingsStore } from '../stores/settings';
* I have modified it to make sure the marker is displayed
* if the uberon is not present in the hardcoded zoom-level list.
*/
const checkMarkersAtZoomLevel = (flatmapImp, markers, zoomLevel) => {
const checkMarkersAtZoomLevel = (flatmapImp, markers, zoomLevel, hoveredMarkers) => {
if (markers) {
markers.forEach(id => {
let foundInArray = false;
Expand All @@ -19,7 +19,9 @@ const checkMarkersAtZoomLevel = (flatmapImp, markers, zoomLevel) => {
if (markerZoomLevels[i].id === id) {
foundInArray = true;
if (zoomLevel >= markerZoomLevels[i].showAtZoom) {
flatmapImp.addMarker(id, {className: "standard-marker"});
let markerClass = "standard-marker"
if (hoveredMarkers.includes(id)) markerClass = "hovered-marker"
flatmapImp.addMarker(id, { className: markerClass });
}
break;
}
Expand Down Expand Up @@ -69,7 +71,8 @@ export default {
this.zoomLevel = currentZoom;
flatmapImp.clearMarkers();
let markers = this.settingsStore.markers;
checkMarkersAtZoomLevel(flatmapImp, markers, this.zoomLevel);
let hoveredMarkers = this.settingsStore.hoveredMarkers;
checkMarkersAtZoomLevel(flatmapImp, markers, this.zoomLevel, hoveredMarkers);
if (this.entry.type === "MultiFlatmap") {
this.restoreFeaturedMarkers(flatmapImp);
}
Expand Down
4 changes: 4 additions & 0 deletions src/stores/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ export const useSettingsStore = defineStore('settings', {
facets: { species: [], gender: [], organ: [] },
facetLabels: [],
markers: [],
hoveredMarkers: [],
featuredMarkers: [],
featuredMarkerIdentifiers: [],
featuredMarkerDois: [],
Expand Down Expand Up @@ -67,6 +68,9 @@ export const useSettingsStore = defineStore('settings', {
updateMarkers(markers) {
this.markers = markers;
},
updateHoveredMarkers(markers) {
this.hoveredMarkers = markers;
},
updateFeatured(datasetIdentifiers) {
this.featuredMarkerIdentifiers = new Array(datasetIdentifiers.length);
this.featuredMarkers = new Array(datasetIdentifiers.length);
Expand Down

0 comments on commit 4e7c00d

Please sign in to comment.