Skip to content

Commit e376ed6

Browse files
committed
feat: add multi line support
1 parent 9ddc6cb commit e376ed6

File tree

11 files changed

+193
-715
lines changed

11 files changed

+193
-715
lines changed

demos/simple/demo.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,14 @@ function main() {
126126
}
127127
trackManager.addPOI(poiOverlay, onAddListener)
128128
});
129+
130+
document.querySelector('#createNewPart').addEventListener('click', () => {
131+
trackManager.createNewPart();
132+
});
133+
document.querySelector('#changeActivePart').addEventListener('click', () => {
134+
const nextPart = (trackManager.activePart() + 1) % trackManager.partsCount();
135+
trackManager.workOnPart(nextPart);
136+
});
129137
}
130138

131139
main();

demos/simple/simple.html

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,12 @@
5656
<button id="poiCancel">Cancel</button>
5757
<button id="poiSave">Save</button>
5858
</div>
59-
</div>
59+
<br />
60+
<br />
61+
<a href="#" id="createNewPart">Add a new line string</a>
62+
<br />
63+
<a href="#" id="changeActivePart">Change active line string</a>
64+
</div>
6065
<div id="map"></div>
6166
</main>
6267
</body>

demos/simple/style.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ export const sketchControlPoint = {
1212
export const trackLine = {
1313
"stroke-width": 6,
1414
"stroke-color": "purple",
15+
"text-value": ["concat", "", ["get", "part"]],
16+
"text-fill-color": "#fff",
1517
};
1618

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

3335
export const numberedControlPoint = {
3436
...controlPoint,
3537
"circle-fill-color": "#ffffffdd",
3638
"text-color": "blue",
3739
// use 'concat' to convert number to string
38-
"text-value": ["concat", ["get", "index"], ""],
40+
"text-value": ["concat", "", ["get", "part"]],
3941
};
4042

4143
export const snappedTrue = {

0 commit comments

Comments
 (0)