Skip to content

Commit

Permalink
feat: add multi line support
Browse files Browse the repository at this point in the history
  • Loading branch information
fredj committed Jun 12, 2024
1 parent 6156808 commit dfdd7fa
Show file tree
Hide file tree
Showing 10 changed files with 111 additions and 672 deletions.
8 changes: 8 additions & 0 deletions demos/simple/demo.js
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,14 @@ function main() {
}
trackManager.addPOI(poiOverlay, onAddListener)
});

document.querySelector('#createNewPart').addEventListener('click', () => {
trackManager.createNewPart();
});
document.querySelector('#changeActivePart').addEventListener('click', () => {
const nextPart = (trackManager.activePart() + 1) % trackManager.partsCount();
trackManager.workOnPart(nextPart);
});
}

main();
7 changes: 6 additions & 1 deletion demos/simple/simple.html
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,12 @@
<button id="poiCancel">Cancel</button>
<button id="poiSave">Save</button>
</div>
</div>
<br />
<br />
<a href="#" id="createNewPart">Add a new line string</a>
<br />
<a href="#" id="changeActivePart">Change active line string</a>
</div>
<div id="map"></div>
</main>
</body>
Expand Down
6 changes: 4 additions & 2 deletions demos/simple/style.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ export const sketchControlPoint = {
export const trackLine = {
"stroke-width": 6,
"stroke-color": "purple",
"text-value": ["concat", "", ["get", "part"]],
"text-fill-color": "#fff",
};

export const trackLineModifying = {
Expand All @@ -27,15 +29,15 @@ export const poiPoint = {
"text-font": "bold 11px Inter",
"text-fill-color": "#000",
// use 'concat' to convert number to string
"text-value": ["concat", ["get", "index"], ""],
"text-value": ["concat", "", ["get", "part"]],
};

export const numberedControlPoint = {
...controlPoint,
"circle-fill-color": "#ffffffdd",
"text-color": "blue",
// use 'concat' to convert number to string
"text-value": ["concat", ["get", "index"], ""],
"text-value": ["concat", "", ["get", "part"]],
};

export const snappedTrue = {
Expand Down
Loading

0 comments on commit dfdd7fa

Please sign in to comment.