Skip to content

Commit

Permalink
feat: allow zIndexing of linestrings and polygons for TerraDrawLeafle…
Browse files Browse the repository at this point in the history
…tAdapter
  • Loading branch information
JamesLMilner committed Apr 7, 2023
1 parent 9307420 commit 17a4441
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/adapters/leaflet.adapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -211,12 +211,22 @@ export class TerraDrawLeafletAdapter extends TerraDrawBaseAdapter {
const mode = feature.properties.mode as string;
const modeStyle = styling[mode];
const featureStyles = modeStyle(feature);
const paneId = String(featureStyles.zIndex);
const pane = this._panes[paneId];

if (!pane) {
this._panes[paneId] = this.createPaneStyleSheet(
paneId,
featureStyles.zIndex
);
}

if (feature.geometry.type === "LineString") {
return {
interactive: false, // Removes mouse hover cursor styles
color: featureStyles.lineStringColor,
weight: featureStyles.lineStringWidth,
pane: paneId,
};
} else if (feature.geometry.type === "Polygon") {
return {
Expand All @@ -226,6 +236,7 @@ export class TerraDrawLeafletAdapter extends TerraDrawBaseAdapter {
weight: featureStyles.polygonOutlineWidth,
stroke: true,
color: featureStyles.polygonFillColor,
pane: paneId,
};
}

Expand Down

0 comments on commit 17a4441

Please sign in to comment.