modules/ui/general.js
// show viewbox tooltip if main tooltip is blank
show viewbox tooltip if main tooltip is blank
show viewbox tooltip if main tooltip is blank
function showMapTooltip(point, e, i, g) {
  tip(""); 
  const tag = e.target.tagName;
  const path = e.composedPath ? e.composedPath() : getComposedPath(e.target); 
  if (!path[path.length - 8]) return;
  const group = path[path.length - 7].id;
  const subgroup = path[path.length - 8].id;
  const land = pack.cells.h[i] >= 20;
  if (group === "rivers") {tip(getRiverName(e.target.id) + "Click to edit"); return;}
  if (group === "routes") {tip("Click to edit the Route"); return;}
  if (group === "terrain") {tip("Click to edit the Relief Icon"); return;}
  if (subgroup === "burgLabels" || subgroup === "burgIcons") {tip("Click to open Burg Editor"); return;}
  if (group === "labels") {tip("Click to edit the Label"); return;}
  if (group === "markers") {tip("Click to edit the Marker"); return;}
  if (group === "ruler") {
    if (tag === "rect") {tip("Drag to split the ruler into 2 parts"); return;}
    if (tag === "circle") {tip("Drag to adjust the measurer"); return;}
    if (tag === "path" || tag === "line") {tip("Drag to move the measurer"); return;}
    if (tag === "text") {tip("Click to remove the measurer"); return;}
  }
  if (subgroup === "burgIcons") {tip("Click to edit the Burg"); return;}
  if (subgroup === "burgLabels") {tip("Click to edit the Burg"); return;}
  if (group === "lakes" && !land) {tip(`${capitalize(subgroup)} lake. Click to edit`); return;}
  if (group === "coastline") {tip("Click to edit the coastline"); return;}
  if (group === "zones") {tip(path[path.length-8].dataset.description); return;}
  if (layerIsOn("togglePrec") && land) tip("Annual Precipitation: "+ getFriendlyPrecipitation(i)); else
  if (layerIsOn("togglePopulation")) tip(getPopulationTip(i)); else
  if (layerIsOn("toggleTemp")) tip("Temperature: " + convertTemperature(grid.cells.temp[g])); else
  if (layerIsOn("toggleBiomes") && pack.cells.biome[i]) tip("Biome: " + biomesData.name[pack.cells.biome[i]]); else
  if (layerIsOn("toggleReligions") && pack.cells.religion[i]) {
    const religion = pack.religions[pack.cells.religion[i]];
    const type = religion.type === "Cult" || religion.type == "Heresy" ? religion.type : religion.type + " religion";
    tip(type + ": " + religion.name);
  } else
  if (pack.cells.state[i] && (layerIsOn("toggleProvinces") || layerIsOn("toggleStates"))) {
    const state = pack.states[pack.cells.state[i]].fullName;
    const province = pack.cells.province[i];
    const prov = province ? pack.provinces[province].fullName + ", " : "";
    tip(prov + state);
  } else
  if (layerIsOn("toggleCultures") && pack.cells.culture[i]) tip("Culture: " + pack.cultures[pack.cells.culture[i]].name); else
  if (layerIsOn("toggleHeight")) tip("Height: " + getFriendlyHeight(point));
}
function showMapTooltip ( point , e , i , g ) { tip ( "" ) ; const tag = e . target . tagName ; const path = e . composedPath ? e . composedPath ( ) : getComposedPath ( e . target ) ; if ( ! path [ path . length - 8 ] ) return ; const group = path [ path . length - 7 ] . id ; const subgroup = path [ path . length - 8 ] . id ; const land = pack . cells . h [ i ] >= 20 ; if ( group === "rivers" ) { tip ( getRiverName ( e . target . id ) + "Click to edit" ) ; return ; } if ( group === "routes" ) { tip ( "Click to edit the Route" ) ; return ; } if ( group === "terrain" ) { tip ( "Click to edit the Relief Icon" ) ; return ; } if ( subgroup === "burgLabels" || subgroup === "burgIcons" ) { tip ( "Click to open Burg Editor" ) ; return ; } if ( group === "labels" ) { tip ( "Click to edit the Label" ) ; return ; } if ( group === "markers" ) { tip ( "Click to edit the Marker" ) ; return ; } if ( group === "ruler" ) { if ( tag === "rect" ) { tip ( "Drag to split the ruler into 2 parts" ) ; return ; } if ( tag === "circle" ) { tip ( "Drag to adjust the measurer" ) ; return ; } if ( tag === "path" || tag === "line" ) { tip ( "Drag to move the measurer" ) ; return ; } if ( tag === "text" ) { tip ( "Click to remove the measurer" ) ; return ; } } if ( subgroup === "burgIcons" ) { tip ( "Click to edit the Burg" ) ; return ; } if ( subgroup === "burgLabels" ) { tip ( "Click to edit the Burg" ) ; return ; } if ( group === "lakes" && ! land ) { tip ( ` ${ capitalize ( subgroup ) } ` ) ; return ; } if ( group === "coastline" ) { tip ( "Click to edit the coastline" ) ; return ; } if ( group === "zones" ) { tip ( path [ path . length - 8 ] . dataset . description ) ; return ; } if ( layerIsOn ( "togglePrec" ) && land ) tip ( "Annual Precipitation: " + getFriendlyPrecipitation ( i ) ) ; else if ( layerIsOn ( "togglePopulation" ) ) tip ( getPopulationTip ( i ) ) ; else if ( layerIsOn ( "toggleTemp" ) ) tip ( "Temperature: " + convertTemperature ( grid . cells . temp [ g ] ) ) ; else if ( layerIsOn ( "toggleBiomes" ) && pack . cells . biome [ i ] ) tip ( "Biome: " + biomesData . name [ pack . cells . biome [ i ] ] ) ; else if ( layerIsOn ( "toggleReligions" ) && pack . cells . religion [ i ] ) { const religion = pack . religions [ pack . cells . religion [ i ] ] ; const type = religion . type === "Cult" || religion . type == "Heresy" ? religion . type : religion . type + " religion" ; tip ( type + ": " + religion . name ) ; } else if ( pack . cells . state [ i ] && ( layerIsOn ( "toggleProvinces" ) || layerIsOn ( "toggleStates" ) ) ) { const state = pack . states [ pack . cells . state [ i ] ] . fullName ; const province = pack . cells . province [ i ] ; const prov = province ? pack . provinces [ province ] . fullName + ", " : "" ; tip ( prov + state ) ; } else if ( layerIsOn ( "toggleCultures" ) && pack . cells . culture [ i ] ) tip ( "Culture: " + pack . cultures [ pack . cells . culture [ i ] ] . name ) ; else if ( layerIsOn ( "toggleHeight" ) ) tip ( "Height: " + getFriendlyHeight ( point ) ) ; }
show viewbox tooltip if main tooltip is blank
show viewbox tooltip if main tooltip is blank
// clear tip // apply polyfill // specific elements // covering elements