Skip to content

Commit

Permalink
fix: maintain drawing labels when modifying features (#493)
Browse files Browse the repository at this point in the history
  • Loading branch information
jessicamcinchak authored Sep 2, 2024
1 parent fbf0373 commit 978cbc4
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/components/my-map/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -562,7 +562,9 @@ export class MyMap extends LitElement {

// Assign a label to each feature based on its' index
sketches.forEach((sketch, i) => {
sketch.set("label", `${i + 1}`); // needs to be type string in order to be parsed by Style "Text"
// If this feature already exists and is only being modified, use its' current label, else use index (needs to be type string in order to be parsed by Style "Text")
const label = sketch.get("label") || `${i + 1}`;
sketch.set("label", label);
});

if (sketches.length > 0) {
Expand Down

0 comments on commit 978cbc4

Please sign in to comment.