mirror of
https://github.com/Azgaar/Fantasy-Map-Generator.git
synced 2025-12-17 09:41:24 +01:00
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:
parent
53c20a48da
commit
4575edc92e
4 changed files with 247 additions and 13 deletions
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue