highlight markers
add .umap-icon-active class for currently selected marker icon. CSS styles override the marker styles to display * in the foreground * with full opacity * with larger sizes where possible (ball and circle)
This commit is contained in:
parent
7696203159
commit
3594bc2605
3 changed files with 46 additions and 1 deletions
|
@ -562,6 +562,10 @@ L.U.Marker = L.Marker.extend({
|
||||||
if (!this.isReadOnly()) this.on('mouseover', this._enableDragging)
|
if (!this.isReadOnly()) this.on('mouseover', this._enableDragging)
|
||||||
this.on('mouseout', this._onMouseOut)
|
this.on('mouseout', this._onMouseOut)
|
||||||
this._popupHandlersAdded = true // prevent Leaflet from binding event on bindPopup
|
this._popupHandlersAdded = true // prevent Leaflet from binding event on bindPopup
|
||||||
|
this.once('add', () => {
|
||||||
|
this.on('popupopen', this.options.icon.highlight, this.options.icon)
|
||||||
|
this.on('popupclose', this.options.icon.resetHighlight, this.options.icon)
|
||||||
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
hasGeom: function () {
|
hasGeom: function () {
|
||||||
|
|
|
@ -38,6 +38,13 @@ L.U.Icon = L.DivIcon.extend({
|
||||||
formatUrl: function (url, feature) {
|
formatUrl: function (url, feature) {
|
||||||
return L.Util.greedyTemplate(url || '', feature ? feature.extendedProperties() : {})
|
return L.Util.greedyTemplate(url || '', feature ? feature.extendedProperties() : {})
|
||||||
},
|
},
|
||||||
|
|
||||||
|
highlight: function () {
|
||||||
|
L.DomUtil.addClass(this.elements.main, 'umap-icon-active')
|
||||||
|
},
|
||||||
|
resetHighlight: function () {
|
||||||
|
L.DomUtil.removeClass(this.elements.main, 'umap-icon-active')
|
||||||
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
L.U.Icon.Default = L.U.Icon.extend({
|
L.U.Icon.Default = L.U.Icon.extend({
|
||||||
|
@ -95,7 +102,6 @@ L.U.Icon.Default = L.U.Icon.extend({
|
||||||
L.U.Icon.Circle = L.U.Icon.extend({
|
L.U.Icon.Circle = L.U.Icon.extend({
|
||||||
initialize: function (map, options) {
|
initialize: function (map, options) {
|
||||||
const default_options = {
|
const default_options = {
|
||||||
iconAnchor: new L.Point(6, 6),
|
|
||||||
popupAnchor: new L.Point(0, -6),
|
popupAnchor: new L.Point(0, -6),
|
||||||
tooltipAnchor: new L.Point(6, 0),
|
tooltipAnchor: new L.Point(6, 0),
|
||||||
className: 'umap-circle-icon',
|
className: 'umap-circle-icon',
|
||||||
|
|
|
@ -1143,6 +1143,10 @@ a.add-datalayer:hover,
|
||||||
text-align: center;
|
text-align: center;
|
||||||
line-height: 32px;
|
line-height: 32px;
|
||||||
}
|
}
|
||||||
|
.umap-div-icon.umap-icon-active .icon_container {
|
||||||
|
box-shadow: 7px 10px 10px 1px white;
|
||||||
|
opacity: 1.0!important;
|
||||||
|
}
|
||||||
.umap-div-icon .icon_container img {
|
.umap-div-icon .icon_container img {
|
||||||
vertical-align: middle;
|
vertical-align: middle;
|
||||||
max-width: 24px!important; /* leaflet.css has !important, so... */
|
max-width: 24px!important; /* leaflet.css has !important, so... */
|
||||||
|
@ -1159,6 +1163,9 @@ a.add-datalayer:hover,
|
||||||
opacity: 0.9;
|
opacity: 0.9;
|
||||||
/*box-shadow: 4px 8px 6px -3px black;*/
|
/*box-shadow: 4px 8px 6px -3px black;*/
|
||||||
}
|
}
|
||||||
|
.umap-div-icon.umap-icon-active .icon_arrow {
|
||||||
|
opacity: 1.0!important;
|
||||||
|
}
|
||||||
.umap-drop-icon .icon_arrow {
|
.umap-drop-icon .icon_arrow {
|
||||||
border-left: 10px solid transparent;
|
border-left: 10px solid transparent;
|
||||||
border-right: 10px solid transparent;
|
border-right: 10px solid transparent;
|
||||||
|
@ -1169,6 +1176,9 @@ a.add-datalayer:hover,
|
||||||
top: -4px;
|
top: -4px;
|
||||||
width: 0;
|
width: 0;
|
||||||
}
|
}
|
||||||
|
.umap-drop-icon.umap-icon-active .icon_arrow {
|
||||||
|
opacity: 1.0!important;
|
||||||
|
}
|
||||||
.umap-drop-icon .icon_container {
|
.umap-drop-icon .icon_container {
|
||||||
background-color: #2470B5;
|
background-color: #2470B5;
|
||||||
border-radius: 16px 16px 16px 16px;
|
border-radius: 16px 16px 16px 16px;
|
||||||
|
@ -1179,6 +1189,10 @@ a.add-datalayer:hover,
|
||||||
text-align: center;
|
text-align: center;
|
||||||
width: 32px;
|
width: 32px;
|
||||||
}
|
}
|
||||||
|
.umap-drop-icon.umap-icon-active .icon_container {
|
||||||
|
box-shadow: 4px 11px 10px -2px white;
|
||||||
|
opacity: 1.0!important;
|
||||||
|
}
|
||||||
.umap-drop-icon .icon_container img {
|
.umap-drop-icon .icon_container img {
|
||||||
vertical-align: middle;
|
vertical-align: middle;
|
||||||
max-width: 24px !important;
|
max-width: 24px !important;
|
||||||
|
@ -1193,9 +1207,18 @@ a.add-datalayer:hover,
|
||||||
.umap-circle-icon {
|
.umap-circle-icon {
|
||||||
border: 1px solid white;
|
border: 1px solid white;
|
||||||
border-radius: 10px 10px 10px 10px;
|
border-radius: 10px 10px 10px 10px;
|
||||||
|
margin-left: -6px;
|
||||||
|
margin-top: -6px;
|
||||||
height: 12px;
|
height: 12px;
|
||||||
width: 12px;
|
width: 12px;
|
||||||
}
|
}
|
||||||
|
.umap-circle-icon.umap-icon-active {
|
||||||
|
height: 16px;
|
||||||
|
margin-left: -8px;
|
||||||
|
margin-top: -8px;
|
||||||
|
opacity: 1.0!important;
|
||||||
|
width: 16px;
|
||||||
|
}
|
||||||
.umap-ball-icon .icon_container {
|
.umap-ball-icon .icon_container {
|
||||||
background-color: darkblue;
|
background-color: darkblue;
|
||||||
background: radial-gradient(circle at 6px 38% , white -4px, darkblue 8px) repeat scroll 0 0 transparent;
|
background: radial-gradient(circle at 6px 38% , white -4px, darkblue 8px) repeat scroll 0 0 transparent;
|
||||||
|
@ -1206,6 +1229,14 @@ a.add-datalayer:hover,
|
||||||
text-align: center;
|
text-align: center;
|
||||||
width: 16px;
|
width: 16px;
|
||||||
}
|
}
|
||||||
|
.umap-ball-icon.umap-icon-active .icon_container {
|
||||||
|
box-shadow: 1px 23px 6px -3px white;
|
||||||
|
margin-left: -2px;
|
||||||
|
margin-top: -4px;
|
||||||
|
height: 20px;
|
||||||
|
opacity: 1.0!important;
|
||||||
|
width: 20px;
|
||||||
|
}
|
||||||
.umap-ball-icon .icon_arrow {
|
.umap-ball-icon .icon_arrow {
|
||||||
background-color: black;
|
background-color: black;
|
||||||
height: 16px;
|
height: 16px;
|
||||||
|
@ -1215,6 +1246,10 @@ a.add-datalayer:hover,
|
||||||
top: -1px;
|
top: -1px;
|
||||||
width: 2px;
|
width: 2px;
|
||||||
}
|
}
|
||||||
|
.umap-icon-active {
|
||||||
|
z-index: 9500!important;
|
||||||
|
opacity: 1.0!important;
|
||||||
|
}
|
||||||
.umap-edit-enabled .readonly {
|
.umap-edit-enabled .readonly {
|
||||||
cursor: not-allowed;
|
cursor: not-allowed;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue