Skip to content

Commit dc23d1d

Browse files
committed
add polygon labels
1 parent 21e8b29 commit dc23d1d

File tree

2 files changed

+27
-12
lines changed

2 files changed

+27
-12
lines changed

src/main/js/journeymap.js

+5-2
Original file line numberDiff line numberDiff line change
@@ -627,7 +627,8 @@ class Journeymap {
627627

628628
coords = [[coords], holes]
629629
}
630-
630+
let firstPoint = Object.values(polygon.points)
631+
let className = "polygon-" + (translateCoords(firstPoint[0].x, firstPoint[0].z) + "_" + polygon.label).replaceAll(",", "_").replaceAll(":", "_").replaceAll(" ", "_").replaceAll("\n", "").toLowerCase()
631632
polygons.push({
632633
latLngs: coords,
633634

@@ -637,7 +638,9 @@ class Journeymap {
637638

638639
fillColor: polygon.fillColor,
639640
fillOpacity: polygon.fillOpacity,
640-
641+
label: polygon.label,
642+
fontColor: polygon.fontColor,
643+
className: className,
641644
texturePositionX: polygon.texturePositionX,
642645
texturePositionY: polygon.texturePositionY,
643646
textureScaleX: polygon.textureScaleX,

src/main/resources/assets/journeymap/web/index.html

+22-10
Original file line numberDiff line numberDiff line change
@@ -21,19 +21,26 @@
2121
<div id="main">
2222
<v-style v-if="visibleWaypoints">
2323
<template v-for="(waypoint) in waypoints">
24-
.leaflet-tooltip.{{waypoint.className}} {
25-
color: {{waypoint.tooltipColor}};
26-
border-color: {{waypoint.tooltipColor}};
27-
}
24+
.leaflet-tooltip.{{ waypoint.className }} {
25+
color: {{ waypoint.tooltipColor }};
26+
border-color: {{ waypoint.tooltipColor }};
27+
}
28+
</template>
29+
</v-style>
30+
<v-style v-if="visiblePolygons">
31+
<template v-for="(polygon) in polygons">
32+
.leaflet-tooltip.{{ polygon.className }} {
33+
color: {{ polygon.fontColor }};
34+
border-color: {{ polygon.strokeColor }};
35+
}
2836
</template>
2937
</v-style>
30-
3138
<v-style v-if="visibleAnimals || visibleMobs || visibleVillagers">
3239
<template v-for="(marker) in markers">
3340
<template v-if="marker.color !== undefined">
34-
.leaflet-tooltip.{{ marker.key.replaceAll("/", "_") }} {
35-
border-color: {{ marker.color }};
36-
}
41+
.leaflet-tooltip.{{ marker.key.replaceAll("/", "_") }} {
42+
border-color: {{ marker.color }};
43+
}
3744
</template>
3845
</template>
3946
</v-style>
@@ -182,7 +189,8 @@
182189
v-if="visibleWaypoints"
183190
v-for="(waypoint) in waypoints"
184191
>
185-
<l-tooltip :options="{permanent: true, direction: 'center', offset: [0, 43], className: waypoint.className}">
192+
<l-tooltip
193+
:options="{permanent: true, direction: 'center', offset: [0, 43], className: waypoint.className}">
186194
{{ waypoint.name }}
187195
</l-tooltip>
188196
</l-marker>
@@ -215,7 +223,11 @@
215223

216224
v-if="visiblePolygons"
217225
v-for="(polygon) in polygons"
218-
></l-polygon>
226+
>
227+
<l-tooltip :options="{permanent: true, direction: 'center', offset: [0, 32], className: polygon.className}">
228+
{{ polygon.label }}
229+
</l-tooltip>
230+
</l-polygon>
219231
</l-map>
220232

221233
<b-collapse :open.sync="settingsVisible"

0 commit comments

Comments
 (0)