Better cities and towns labels in 3D view (#635)

* Better cities and towns labels in 3D view

* Small changes (let -> const)

* Lower city labels

* Change the way the label faces the camera

* Use font from svg instead of hardcoded

* Use color from svg

* Optionalize 3d labels

* Use pack.burgs instead of svg + Icon use style from svg

* Replace jQuery with d3

* Labels adapts to height scale

* Fix bug: options are not applied when changing layer

* Add states labels + Replace canvas by svg

* Fix: States labels adapts to height scale

* Requested fixes

* All fonts working properly + Big memory optimization + Minor fixes

* Fix rotating animation + More optimization

* use Raycaster for positioning the labels

* Use canvas to render burg labels + Some tweaks

Co-authored-by: Rayzeq <zachariedubrulle@gmail.com>
This commit is contained in:
Rayzeq 2021-07-17 14:52:17 +02:00 committed by GitHub
parent 53c20a48da
commit 4575edc92e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 247 additions and 13 deletions

View file

@ -138,7 +138,7 @@ async function saveTiles() {
}
// parse map svg to object url
async function getMapURL(type, subtype) {
async function getMapURL(type, {globe=false, noLabels=false, noWater=false}) {
const cloneEl = document.getElementById("map").cloneNode(true); // clone svg
cloneEl.id = "fantasyMap";
document.body.appendChild(cloneEl);
@ -150,8 +150,13 @@ async function getMapURL(type, subtype) {
const isFirefox = navigator.userAgent.toLowerCase().indexOf("firefox") > -1;
if (isFirefox && type === "mesh") clone.select("#oceanPattern").remove();
if (subtype === "globe") clone.select("#scaleBar").remove();
if (subtype === "noWater") {
if (globe) clone.select("#scaleBar").remove();
if (noLabels) {
clone.select("#labels #states").remove();
clone.select("#labels #burgLabels").remove();
clone.select("#icons #burgIcons").remove();
}
if (noWater) {
clone.select("#oceanBase").attr("opacity", 0);
clone.select("#oceanPattern").attr("opacity", 0);
}