Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixed rendering layers Bubbles + Points #2612

Open
wants to merge 8 commits into
base: next
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 5 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
5 changes: 5 additions & 0 deletions .changeset/rare-singers-tease.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@evidence-dev/core-components': patch
---

fixed bubbles + points layering issue
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,16 @@ export class EvidenceMap {
link
) {
if (!Leaflet) throw new Error('Leaflet is not yet available');
const marker = Leaflet.circleMarker(coords, circleOptions).addTo(this.#map);
const pointsLayer = Leaflet.layerGroup().addTo(this.#map);
const bubblesLayer = Leaflet.layerGroup().addTo(this.#map);
const marker = Leaflet.circleMarker(coords, circleOptions);
// handle layering
if (circleOptions.markerType === 'points') {
marker.addTo(pointsLayer);
} else if (circleOptions.markerType === 'bubbles') {
marker.addTo(bubblesLayer);
marker.bringToBack();
}
this.updateMarkerStyle(marker, circleOptions); // Initial style setting and storage

marker.on('click', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,10 @@
export let size = undefined; // column containing size data
/** @type {number} */
export let opacity = 0.8;
/** @type {'bubble' | 'points' }*/
export let pointStyle = 'bubbles';
/** @type {'categorical' | 'scalar' | undefined} */
export let legendType = undefined;
</script>

<Points sizeCol={size} {opacity} {legendType} {...$$restProps} />
<Points sizeCol={size} {opacity} {pointStyle} {legendType} {...$$restProps} />
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,9 @@

let values, colorScale, sizeExtents, maxData, maxSizeSq;

/** @type {'bubble' | 'points' }*/
export let pointStyle = 'points';

/**
* Initialize the component.
* @returns {Promise<void>}
Expand Down Expand Up @@ -300,7 +303,8 @@
opacity: opacity,
weight: borderWidth,
color: borderColor,
className: `outline-none ${pointClass}`
className: `outline-none ${pointClass}`,
markerType: pointStyle
}}
selectedOptions={{
fillColor: selectedColor,
Expand Down