Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions scripts/vendorsjs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ mkdir -p umap/static/umap/vendors/editinosm/ && cp -r node_modules/leaflet-editi
mkdir -p umap/static/umap/vendors/editinosm/ && cp -r node_modules/leaflet-editinosm/edit-in-osm.png umap/static/umap/vendors/editinosm/
mkdir -p umap/static/umap/vendors/minimap/ && cp -r node_modules/leaflet-minimap/dist/** umap/static/umap/vendors/minimap/
mkdir -p umap/static/umap/vendors/loading/ && cp -r node_modules/leaflet-loading/src/Control.Loading.* umap/static/umap/vendors/loading/
mkdir -p umap/static/umap/vendors/markercluster/ && cp -r node_modules/leaflet.markercluster/dist/leaflet.markercluster.* umap/static/umap/vendors/markercluster/
mkdir -p umap/static/umap/vendors/markercluster/ && cp -r node_modules/leaflet.markercluster/dist/MarkerCluster.* umap/static/umap/vendors/markercluster/
mkdir -p umap/static/umap/vendors/heat/ && cp -r node_modules/leaflet.heat/dist/leaflet-heat.js umap/static/umap/vendors/heat/
mkdir -p umap/static/umap/vendors/fullscreen/ && cp -r node_modules/leaflet-fullscreen/dist/** umap/static/umap/vendors/fullscreen/
mkdir -p umap/static/umap/vendors/measurable/ && cp -r node_modules/leaflet-measurable/Leaflet.Measurable.* umap/static/umap/vendors/measurable/
Expand Down
8 changes: 4 additions & 4 deletions umap/static/umap/js/modules/data/features.js
Original file line number Diff line number Diff line change
Expand Up @@ -793,11 +793,11 @@ export class Point extends Feature {

zoomTo(event) {
if (this.datalayer.isClustered() && !this.ui._icon) {
// callback is mandatory for zoomToShowLayer
this.datalayer.layer.zoomToShowLayer(this.ui, event.callback || (() => {}))
} else {
super.zoomTo(event)
this.ui._cluster.zoomToCoverage().then(() => {
this.ui._cluster.spiderfy()
})
}
super.zoomTo(event)
}
}

Expand Down
7 changes: 4 additions & 3 deletions umap/static/umap/js/modules/data/layer.js
Original file line number Diff line number Diff line change
Expand Up @@ -1194,10 +1194,11 @@ export class DataLayer {
}

toggle(force) {
// From now on, do not try to how/hidedataChanged
// automatically this layer.
let display = force
// From now on, do not try to how/hide
// automatically this layer, as user
// has taken control on this.
this._forcedVisibility = true
let display = force
if (force === undefined) {
if (!this.isVisible()) display = true
else display = false
Expand Down
32 changes: 10 additions & 22 deletions umap/static/umap/js/modules/rendering/icon.js
Original file line number Diff line number Diff line change
Expand Up @@ -214,31 +214,19 @@ const Ball = DefaultIcon.extend({

export const Cluster = DivIcon.extend({
options: {
iconSize: [40, 40],
},

initialize: function (datalayer, cluster) {
this.datalayer = datalayer
this.cluster = cluster
iconSize: [32, 32],
className: 'umap-cluster-icon',
},

createIcon: function () {
const container = DomUtil.create('div', 'leaflet-marker-icon marker-cluster')
const div = DomUtil.create('div', '', container)
const span = DomUtil.create('span', '', div)
const backgroundColor = this.datalayer.getColor()
span.textContent = this.cluster.getChildCount()
div.style.backgroundColor = backgroundColor
return container
},

computeTextColor: function (el) {
let color
const backgroundColor = this.datalayer.getColor()
if (this.datalayer.properties.cluster?.textColor) {
color = this.datalayer.properties.cluster.textColor
}
return color || DomUtil.TextColorFromBackgroundColor(el, backgroundColor)
const template = '<div><span data-ref=counter></span></div>'
const [root, { counter }] = Utils.loadTemplateWithRefs(template)
this.root = root
this.counter = counter
this.counter.textContent = this.options.getCounter()
this.root.style.backgroundColor = this.options.color
this._setIconStyles(this.root, 'icon')
return this.root
},
})

Expand Down
Loading