Skip to content

Commit

Permalink
don't shift label on modify
Browse files Browse the repository at this point in the history
  • Loading branch information
jessicamcinchak committed Sep 2, 2024
1 parent 1d47d13 commit 9ea227d
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 @@ -554,7 +554,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 9ea227d

Please sign in to comment.