State labels: new label placing algorithm (#977)

* feat: draw state labels start

* feat: update old .map files

* chore: update version hash

* fear: add change to the user's changelog
This commit is contained in:
Azgaar 2023-08-11 18:56:42 +04:00 committed by GitHub
parent 1bb90251cd
commit 87599d1530
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
15 changed files with 395 additions and 281 deletions

View file

@ -74,7 +74,7 @@ toolsContent.addEventListener("click", function (event) {
});
function processFeatureRegeneration(event, button) {
if (button === "regenerateStateLabels") BurgsAndStates.drawStateLabels();
if (button === "regenerateStateLabels") drawStateLabels();
else if (button === "regenerateReliefIcons") {
ReliefIcons();
if (!layerIsOn("toggleRelief")) toggleRelief();
@ -154,7 +154,7 @@ function regenerateStates() {
layerIsOn("toggleBorders") ? drawBorders() : toggleBorders();
if (layerIsOn("toggleProvinces")) drawProvinces();
BurgsAndStates.drawStateLabels();
drawStateLabels();
Military.generate();
if (layerIsOn("toggleEmblems")) drawEmblems();
@ -570,9 +570,8 @@ function addLabelOnClick() {
.attr("data-size", 18)
.attr("filter", null);
const example = group.append("text").attr("x", 0).attr("x", 0).text(name);
const example = group.append("text").attr("x", 0).attr("y", 0).text(name);
const width = example.node().getBBox().width;
const x = width / -2; // x offset;
example.remove();
group.classed("hidden", false);
@ -584,7 +583,7 @@ function addLabelOnClick() {
.attr("startOffset", "50%")
.attr("font-size", "100%")
.append("tspan")
.attr("x", x)
.attr("x", 0)
.text(name);
defs
@ -836,7 +835,7 @@ function addMarkerOnClick() {
const marker = Markers.add({...baseMarker, x, y, cell});
if (selectedConfig && selectedConfig.add) {
selectedConfig.add("marker"+marker.i, cell);
selectedConfig.add("marker" + marker.i, cell);
}
const markersElement = document.getElementById("markers");