mirror of
https://github.com/Azgaar/Fantasy-Map-Generator.git
synced 2025-12-22 20:11:24 +01:00
Replace jQuery with d3
This commit is contained in:
parent
c51f3c6a84
commit
d874f9a3c4
1 changed files with 8 additions and 9 deletions
|
|
@ -263,22 +263,21 @@ async function createMesh(width, height, segmentsX, segmentsY) {
|
||||||
iconMeshs = []
|
iconMeshs = []
|
||||||
|
|
||||||
if (options.labels3d) {
|
if (options.labels3d) {
|
||||||
const svg = $('svg#map')[0];
|
const cities = svg.select("#viewbox #labels #burgLabels #cities");
|
||||||
const cities = $('#viewbox #labels #burgLabels #cities', svg);
|
const towns = svg.select('#viewbox #labels #burgLabels #towns');
|
||||||
const towns = $('#viewbox #labels #burgLabels #towns', svg);
|
const cities_icons = svg.select('#viewbox #icons #burgIcons #cities');
|
||||||
const cities_icons = $('#viewbox #icons #burgIcons #cities', svg);
|
const towns_icons = svg.select('#viewbox #icons #burgIcons #towns');
|
||||||
const towns_icons = $('#viewbox #icons #burgIcons #towns', svg);
|
|
||||||
|
|
||||||
for (const burg of pack.burgs) {
|
for (const burg of pack.burgs) {
|
||||||
const x = burg.x - svg.width.baseVal.value/2;
|
const x = burg.x - svg.attr("width")/2;
|
||||||
const y = getMeshHeight(findGridCell(burg.x, burg.y)); // work better than getMeshHeight(burg.cell) but I don't know why
|
const y = getMeshHeight(findGridCell(burg.x, burg.y)); // work better than getMeshHeight(burg.cell) but I don't know why
|
||||||
const z = burg.y - svg.height.baseVal.value/2;
|
const z = burg.y - svg.attr("height")/2;
|
||||||
|
|
||||||
if(layerIsOn("toggleLabels")) {
|
if(layerIsOn("toggleLabels")) {
|
||||||
if (burg.capital) {
|
if (burg.capital) {
|
||||||
var text_mesh = createTextMesh(burg.name, cities.css('font-family'), 25, cities.css('fill')); // cities.data('size')
|
var text_mesh = createTextMesh(burg.name, cities.attr('font-family'), 25, cities.attr('fill')); // cities.data('size')
|
||||||
} else {
|
} else {
|
||||||
var text_mesh = createTextMesh(burg.name, towns.css('font-family'), 7, towns.css('fill')); // towns.data('size')
|
var text_mesh = createTextMesh(burg.name, towns.attr('font-family'), 7, towns.attr('fill')); // towns.data('size')
|
||||||
}
|
}
|
||||||
|
|
||||||
if (burg.capital) {
|
if (burg.capital) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue