Skip to content
This repository has been archived by the owner on Jun 3, 2024. It is now read-only.

Commit

Permalink
QMAPS-709 list item hover/click
Browse files Browse the repository at this point in the history
  • Loading branch information
xem committed Apr 24, 2019
1 parent 775321b commit 3d3c1f2
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 11 deletions.
18 changes: 9 additions & 9 deletions src/adapters/scene_category.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@ export default class SceneCategory {

addCategoryMarkers(pois) {
pois.forEach((poi) => {
const marker = document.createElement('div')

marker.className = 'category_marker'
this.markers.push(
new Marker(marker)
.setLngLat(poi.latLon)
.addTo(this.map)
)
}
const marker = document.createElement('div')
poi.marker_id = poi.id.replace("pj:", "marker_")
marker.className = 'category_marker'
marker.id = poi.marker_id
this.markers.push(
new Marker(marker)
.setLngLat(poi.latLon)
.addTo(this.map)
)}
)
}
}
13 changes: 13 additions & 0 deletions src/panel/category_panel.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,19 @@ export class CategoryPanel {
}

removeCategoryMarkers(){
//todo
}

selectPoi(poi){
// todo
console.log(poi);
}

highlightPoiMarker(poi){
document.querySelector("#" + poi.marker_id).classList.add("active")
}

unhighlightPoiMarker(poi){
document.querySelector("#" + poi.marker_id).classList.remove("active")
}
}
3 changes: 2 additions & 1 deletion src/scss/includes/panels/categories.scss
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,8 @@
margin: -7px 0 0 4px;
}

.category_marker:hover {
.category_marker:hover,
.category_marker.active {
width: 30px;
height: 37px;
margin: -10px 0 0 4px;
Expand Down
2 changes: 1 addition & 1 deletion src/views/category_panel.dot
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
}
}}

<div class="category__panel__item" {{= click(this.selectPoi, this, poi) }}>
<div class="category__panel__item" {{= click(this.selectPoi, this, poi) }} {{= mouseover(this.highlightPoiMarker, this, poi) }} {{= mouseout(this.unhighlightPoiMarker, this, poi) }}>
<div class="category__panel__item_inner">

<div class="category__panel__image" {{? image}}style="background-image:url('{{= image}}')"{{?}}>{{? !image }}TODO: icon{{?}}</div>
Expand Down

0 comments on commit 3d3c1f2

Please sign in to comment.