Updated positioning of text

master
Aadhavan Srinivasan 1 week ago
parent 80529e5882
commit 4804497b3c

@ -213,9 +213,14 @@ function stateOrDistrictOrLanguage(d) {
// const mapWidth = document.getElementById("indiaMap").getAttribute("width") // const mapWidth = document.getElementById("indiaMap").getAttribute("width")
// const mapHeight = document.getElementById("indiaMap").getAttribute("height") // const mapHeight = document.getElementById("indiaMap").getAttribute("height")
const mapWidth = /*window.innerWidth - */document.querySelector("#svgContainer").offsetWidth * 0.85; let mapWidth = /*window.innerWidth - */document.querySelector("#svgContainer").offsetWidth * 0.85;
// const mapHeight = document.querySelector("#svgContainer").offsetHeight; // const mapHeight = document.querySelector("#svgContainer").offsetHeight;
const mapHeight = (window.innerHeight - document.querySelector("#svgContainer").getBoundingClientRect().top); let mapHeight = (window.innerHeight - document.querySelector("#svgContainer").getBoundingClientRect().top);
if (window.innerWidth <= 768) {
mapWidth *= 1.5;
mapHeight *= 1.5;
}
const svg = d3.select("#svgContainer") const svg = d3.select("#svgContainer")
.append('svg') .append('svg')
@ -288,6 +293,9 @@ function drawMap(world) {
if (d.properties.lang_name == "Tamil") { if (d.properties.lang_name == "Tamil") {
rtv += 20; rtv += 20;
} }
if (d.properties.lang_name == "Kannada" && window.innerWidth <= 768) {
rtv += 15;
}
if (d.properties.lang_name == "Maithali") { if (d.properties.lang_name == "Maithali") {
rtv += 10; rtv += 10;
} }
@ -304,7 +312,9 @@ function drawMap(world) {
if (stateOrDistrictOrLanguage(d) == "language") { if (stateOrDistrictOrLanguage(d) == "language") {
rtv = projection(d3.geoCentroid(d))[1] rtv = projection(d3.geoCentroid(d))[1]
if (d.properties.lang_name == "Kannada") { if (d.properties.lang_name == "Kannada") {
rtv += 15; if (window.innerWidth > 768) {
rtv += 10;
}
} }
if (d.properties.lang_name == "Tamil") { if (d.properties.lang_name == "Tamil") {
rtv -= 20; rtv -= 20;

Loading…
Cancel
Save