Skip to content

Commit

Permalink
add polygon labels
Browse files Browse the repository at this point in the history
  • Loading branch information
mysticdrew committed Jun 20, 2024
1 parent 21e8b29 commit dc23d1d
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 12 deletions.
7 changes: 5 additions & 2 deletions src/main/js/journeymap.js
Original file line number Diff line number Diff line change
Expand Up @@ -627,7 +627,8 @@ class Journeymap {

coords = [[coords], holes]
}

let firstPoint = Object.values(polygon.points)
let className = "polygon-" + (translateCoords(firstPoint[0].x, firstPoint[0].z) + "_" + polygon.label).replaceAll(",", "_").replaceAll(":", "_").replaceAll(" ", "_").replaceAll("\n", "").toLowerCase()
polygons.push({
latLngs: coords,

Expand All @@ -637,7 +638,9 @@ class Journeymap {

fillColor: polygon.fillColor,
fillOpacity: polygon.fillOpacity,

label: polygon.label,
fontColor: polygon.fontColor,
className: className,
texturePositionX: polygon.texturePositionX,
texturePositionY: polygon.texturePositionY,
textureScaleX: polygon.textureScaleX,
Expand Down
32 changes: 22 additions & 10 deletions src/main/resources/assets/journeymap/web/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,19 +21,26 @@
<div id="main">
<v-style v-if="visibleWaypoints">
<template v-for="(waypoint) in waypoints">
.leaflet-tooltip.{{waypoint.className}} {
color: {{waypoint.tooltipColor}};
border-color: {{waypoint.tooltipColor}};
}
.leaflet-tooltip.{{ waypoint.className }} {
color: {{ waypoint.tooltipColor }};
border-color: {{ waypoint.tooltipColor }};
}
</template>
</v-style>
<v-style v-if="visiblePolygons">
<template v-for="(polygon) in polygons">
.leaflet-tooltip.{{ polygon.className }} {
color: {{ polygon.fontColor }};
border-color: {{ polygon.strokeColor }};
}
</template>
</v-style>

<v-style v-if="visibleAnimals || visibleMobs || visibleVillagers">
<template v-for="(marker) in markers">
<template v-if="marker.color !== undefined">
.leaflet-tooltip.{{ marker.key.replaceAll("/", "_") }} {
border-color: {{ marker.color }};
}
.leaflet-tooltip.{{ marker.key.replaceAll("/", "_") }} {
border-color: {{ marker.color }};
}
</template>
</template>
</v-style>
Expand Down Expand Up @@ -182,7 +189,8 @@
v-if="visibleWaypoints"
v-for="(waypoint) in waypoints"
>
<l-tooltip :options="{permanent: true, direction: 'center', offset: [0, 43], className: waypoint.className}">
<l-tooltip
:options="{permanent: true, direction: 'center', offset: [0, 43], className: waypoint.className}">
{{ waypoint.name }}
</l-tooltip>
</l-marker>
Expand Down Expand Up @@ -215,7 +223,11 @@

v-if="visiblePolygons"
v-for="(polygon) in polygons"
></l-polygon>
>
<l-tooltip :options="{permanent: true, direction: 'center', offset: [0, 32], className: polygon.className}">
{{ polygon.label }}
</l-tooltip>
</l-polygon>
</l-map>

<b-collapse :open.sync="settingsVisible"
Expand Down

0 comments on commit dc23d1d

Please sign in to comment.