framework icon indicating copy to clipboard operation
framework copied to clipboard

Html image map not rendering properly

Open DarkKnight1992 opened this issue 9 years ago • 27 comments

Hi, In our application we are using Html image maps, for rendering world map but since totaljs is handling all the css, js, html its messing up the coordinates

<area shape="circle" class="maphilighted masterTooltip" title="Faroe Islands" coords="NaN,NaN,NaN">

I have tried disabling css, js, html compression and handling but its not working properly. Our config file looks like this but total is still handling all the static files.

directory-public : ../../public directory-views : ../../public allow-compile-css : false allow-compile-html : false allow-compile-js : false static-url : ../../public static-url-css : ../../public static-url-download : ../../public static-url-font : ../../public static-url-image : ../../public static-url-js : ../../public static-url-video : ../../public

Any help we will really appreciated.

DarkKnight1992 avatar Oct 02 '17 20:10 DarkKnight1992

Hi @DarkKnight1992, can you show me your implementation of area in view?

petersirka avatar Oct 02 '17 20:10 petersirka

i would love to but what do you need exactly ?

DarkKnight1992 avatar Oct 02 '17 20:10 DarkKnight1992

this is one map area all the coords are converted to NaN

DarkKnight1992 avatar Oct 02 '17 20:10 DarkKnight1992

I need to see code before rendering. Otherwise: can you create a simple example?

petersirka avatar Oct 02 '17 20:10 petersirka

<map name="Map" id="Map" map-tool-tip> <area shape="poly" id="canada" class="maphilighted masterTooltip" title="{{::Countries.Canada}}" coords="935,343,938,360,954,361,965,357,985,346,985,347,991,349,991,350,993,350,993,351,995,351,995,352,997,352,997,353,999,353,999,354,1001,354,1002,356,1004,356,1004,357,1007,357,1009,360,1015,362,1016,364,1022,366,1022,367,1024,367,1024,368,1030,370,1030,371,1033,371,1033,372,1035,372,1035,373,1041,374,1041,375,1044,375,1044,376,1047,376,1047,377,1054,378,1054,379,1058,379,1058,380,1064,380,1064,381,1067,381,1067,382,1074,383,1074,384,1084,386,1084,387,1087,387,1087,388,1090,388,1090,389,1093,389,1093,390,1097,391,1097,392,1101,392,1103,395,1105,395,1106,397,1108,397,1108,398,1112,400,1104,425,1112,431,1130,436,1153,437,1177,438,1177,437,1183,437,1183,436,1189,435,1189,434,1191,434,1191,433,1201,432,1207,439,1208,439,1209,442,1212,444,1212,446,1215,448,1216,451,1218,451,1218,453,1221,455,1221,457,1225,460,1225,462,1230,466,1230,468,1232,469,1235,473,1237,473,1238,475,1243,475,1246,471,1247,471,1247,469,1249,468,1249,465,1250,465,1250,459,1255,431,1255,428,1265,417,1279,409,1283,411,1284,413,1286,413,1286,414,1288,414,1288,415,1290,415,1290,416,1292,416,1292,417,1294,417,1294,418,1296,418,1296,419,1302,421,1302,422,1305,422,1305,423,1307,423,1308,425,1317,427,1317,428,1320,428,1320,429,1323,429,1323,430,1326,430,1326,431,1329,431,1329,432,1337,433,1337,434,1358,435,1358,436,1376,436,1401,437,1404,433,1405,433,1405,431,1408,429,1423,414,1433,415,1434,418,1435,418,1435,420,1436,420,1437,425,1438,425,1438,431,1439,431,1440,437,1441,437,1441,439,1442,439,1442,442,1443,442,1443,445,1448,453,1455,453,1457,450,1458,450,1459,445,1460,445,1460,442,1461,442,1461,439,1462,439,1463,432,1475,421,1484,411,1489,407,1494,399,1491,376,1491,373,1490,373,1490,371,1489,371,1486,362,1485,362,1485,360,1483,359,1483,357,1481,356,1478,346,1497,345,1507,349,1507,351,1518,362,1518,364,1519,364,1519,366,1520,366,1520,368,1521,368,1521,370,1523,371,1525,377,1527,378,1528,382,1530,383,1530,385,1531,385,1531,387,1532,387,1532,390,1534,391,1536,397,1537,397,1538,400,1540,401,1541,404,1546,404,1553,396,1555,395,1555,393,1560,389,1560,387,1567,381,1567,380,1570,380,1572,381,1574,385,1576,386,1576,388,1578,389,1579,394,1580,394,1580,396,1581,396,1581,408,1593,454,1593,455,1603,453,1616,441,1618,440,1618,438,1620,437,1622,431,1623,431,1623,429,1624,429,1626,423,1627,423,1627,420,1628,420,1628,418,1629,418,1630,412,1631,412,1631,410,1632,410,1632,407,1633,407,1633,405,1634,405,1636,399,1637,399,1637,397,1638,397,1638,395,1639,395,1641,389,1642,389,1642,386,1643,386,1643,384,1644,384,1644,380,1645,380,1644,349,1654,348,1654,349,1659,349,1659,350,1661,350,1661,351,1664,351,1664,352,1667,352,1667,353,1671,354,1671,355,1673,355,1675,358,1677,358,1677,359,1679,360,1679,362,1683,365,1683,367,1685,368,1685,370,1686,370,1686,372,1687,372,1687,374,1688,374,1688,376,1689,376,1689,378,1690,378,1690,380,1692,381,1691,428,1697,452,1696,466,1693,468,1693,470,1688,474,1688,475,1686,475,1684,478,1682,478,1681,480,1675,482,1674,484,1670,485,1669,487,1665,488,1664,490,1660,491,1652,495,1644,491,1643,489,1641,489,1640,487,1627,485,1627,486,1620,486,1620,487,1615,487,1615,488,1613,488,1613,489,1610,490,1610,514,1609,514,1607,520,1606,520,1605,524,1603,525,1602,529,1601,529,1600,532,1598,533,1598,535,1596,536,1595,540,1594,540,1595,549,1593,568,1592,568,1592,571,1591,571,1590,575,1586,578,1585,580,1583,580,1582,582,1580,582,1580,583,1577,583,1577,584,1575,584,1575,585,1572,585,1572,586,1559,588,1559,589,1557,589,1556,591,1554,591,1551,595,1549,596,1549,598,1546,600,1546,601,1536,601,1536,600,1524,605,1523,605,1523,608,1525,612,1528,614,1528,616,1531,618,1533,627,1526,631,1523,631,1523,632,1517,634,1517,635,1515,635,1511,640,1509,641,1508,645,1507,645,1506,648,1504,649,1504,651,1484,669,1484,671,1481,673,1480,677,1479,677,1477,683,1476,683,1476,686,1475,686,1474,694,1473,694,1472,710,1471,710,1471,717,1470,717,1470,725,1469,725,1469,734,1468,734,1468,743,1467,743,1467,755,1466,755,1465,779,1468,781,1468,782,1470,782,1470,783,1473,783,1473,784,1479,786,1479,787,1481,787,1481,788,1485,789,1486,791,1488,791,1488,792,1491,794,1492,794,1492,796,1493,796,1493,798,1494,798,1494,802,1495,802,1495,805,1496,805,1496,808,1497,808,1497,814,1498,814,1498,817,1499,817,1499,820,1500,820,1500,823,1501,823,1501,826,1502,826,1502,828,1503,828,1503,830,1507,836,1511,837,1511,838,1527,838,1537,837,1537,838,1539,838,1540,840,1542,840,1543,842,1547,843,1547,844,1550,845,1551,847,1555,848,1557,851,1559,851,1559,852,1561,852,1561,853,1563,853,1563,854,1565,854,1565,855,1567,855,1567,856,1569,856,1569,857,1571,857,1571,858,1575,859,1576,861,1580,862,1581,864,1583,864,1583,865,1585,865,1585,866,1587,866,1587,867,1589,867,1590,869,1592,869,1593,871,1595,871,1597,874,1599,874,1600,876,1604,877,1605,879,1607,879,1608,881,1610,881,1610,882,1614,883,1614,884,1620,885,1620,886,1624,886,1624,887,1627,887,1627,888,1630,888,1630,889,1640,890,1673,901,1678,901,1678,902,1681,902,1681,903,1683,903,1685,906,1686,906,1686,943,1687,943,1688,948,1689,948,1689,951,1690,951,1690,953,1691,953,1691,956,1692,956,1692,958,1693,958,1693,960,1694,960,1694,962,1695,962,1697,968,1698,968,1698,972,1699,972,1701,978,1702,978,1704,984,1706,985,1706,987,1708,988,1708,990,1710,991,1710,993,1717,999,1739,1010,1742,1008,1746,1003,1748,1002,1748,1000,1752,997,1752,995,1755,993,1755,991,1757,990,1757,988,1759,987,1759,985,1760,985,1762,979,1763,979,1760,955,1760,951,1759,951,1759,947,1758,947,1758,944,1757,944,1757,940,1750,910,1753,906,1764,896,1764,894,1774,885,1774,883,1777,881,1777,879,1779,878,1779,876,1781,875,1782,871,1784,870,1784,868,1785,868,1785,866,1786,866,1786,863,1787,863,1787,860,1788,860,1789,850,1792,815,1786,806,1784,805,1783,801,1781,800,1781,798,1779,797,1778,793,1776,792,1775,788,1773,787,1773,785,1772,785,1771,781,1770,781,1769,774,1768,774,1768,770,1767,770,1767,764,1766,752,1767,752,1769,746,1770,746,1770,744,1771,744,1771,741,1772,741,1772,739,1773,739,1773,736,1774,736,1774,733,1775,733,1775,727,1776,727,1776,721,1775,721,1775,709,1774,709,1774,701,1773,701,1773,689,1772,689,1773,661,1774,661,1778,655,1810,658,1826,659,1826,660,1835,660,1835,661,1843,661,1843,662,1851,662,1851,663,1856,664,1878,694,1880,694,1883,698,1885,698,1886,700,1890,701,1891,703,1895,704,1896,706,1898,706,1900,709,1909,714,1909,764,1910,764,1910,766,1915,772,1917,772,1919,775,1921,775,1924,779,1926,779,1927,781,1929,781,1931,784,1933,784,1934,786,1940,791,1940,793,1950,802,1971,795,1975,794,1978,790,1980,790,1982,787,1984,787,1987,783,1988,783,1988,781,1991,779,1991,777,1992,777,1993,773,1994,773,1995,767,1996,767,1996,764,1997,764,1997,761,1998,761,1998,757,1999,757,2001,746,2006,746,2010,754,2010,756,2011,756,2011,759,2013,760,2015,766,2016,766,2016,768,2017,768,2017,772,2018,772,2020,778,2021,778,2021,781,2022,781,2022,783,2024,784,2025,788,2027,789,2027,791,2029,792,2029,794,2033,797,2033,799,2047,812,2047,814,2052,818,2055,855,2056,855,2057,859,2063,864,2064,866,2066,866,2069,870,2071,870,2073,873,2076,874,2077,876,2081,877,2083,880,2085,880,2089,885,2091,885,2092,887,2095,888,2095,889,2097,889,2098,891,2100,891,2101,893,2103,893,2105,896,2107,896,2108,898,2110,898,2112,901,2116,902,2116,903,2121,906,2122,912,2121,912,2119,919,2120,919,2127,925,2128,927,2132,928,2132,929,2135,930,2136,932,2138,932,2139,934,2141,934,2141,935,2143,935,2143,936,2145,936,2145,937,2147,937,2149,940,2150,940,2150,942,2152,943,2153,947,2154,947,2155,951,2156,951,2156,955,2157,955,2157,975,2154,977,2154,979,2151,980,2149,983,2147,983,2145,986,2143,986,2143,987,2141,987,2141,988,2139,988,2139,989,2137,989,2137,990,2135,990,2135,991,2131,992,2130,994,2126,995,2126,996,2123,997,2122,999,2120,999,2118,1002,2111,1009,2109,1009,2103,1014,2095,1023,2093,1023,2091,1026,2089,1026,2088,1028,2085,1028,2085,1029,2060,1029,2009,1029,1982,1030,1958,1030,1958,1031,1954,1032,1953,1034,1950,1035,1949,1038,1946,1040,1944,1046,1941,1048,1940,1052,1939,1052,1939,1054,1938,1054,1936,1060,1935,1060,1935,1063,1934,1063,1933,1067,1932,1067,1931,1071,1929,1072,1929,1074,1928,1074,1929,1080,1931,1080,1932,1082,1936,1082,1936,1081,1942,1080,1942,1079,1944,1079,1944,1078,1946,1078,1947,1076,1949,1076,1950,1074,1952,1074,1953,1072,1955,1072,1956,1070,1959,1070,1959,1069,2003,1069,2005,1075,1998,1081,1998,1082,1995,1083,1995,1085,1994,1085,1992,1088,1994,1099,1994,1105,1995,1105,1995,1108,1996,1108,1996,1110,1997,1110,1997,1113,1998,1113,2000,1119,2001,1119,2001,1121,2002,1121,2002,1123,2003,1123,2005,1129,2007,1130,2007,1132,2009,1133,2009,1135,2013,1138,2014,1141,2016,1141,2016,1144,1998,1147,1993,1147,1993,1148,1984,1149,1984,1150,1980,1150,1980,1151,1977,1151,1977,1152,1972,1152,1972,1153,1961,1153,1958,1149,1957,1149,1957,1147,1955,1146,1955,1144,1954,1144,1953,1138,1952,1138,1952,1136,1951,1136,1951,1133,1926,1108,1917,1114,1917,1116,1916,1116,1914,1122,1913,1122,1912,1128,1911,1128,1911,1133,1910,1133,1910,1135,1909,1135,1909,1138,1908,1138,1907,1142,1905,1142,1900,1148,1896,1153,1894,1153,1894,1154,1892,1154,1892,1155,1889,1155,1847,1163,1839,1163,1839,1164,1834,1164,1834,1165,1828,1165,1828,1166,1823,1166,1823,1167,1819,1167,1819,1168,1816,1168,1816,1169,1814,1169,1814,1170,1812,1170,1811,1172,1807,1173,1806,1175,1804,1175,1804,1176,1800,1177,1800,1178,1797,1178,1797,1179,1788,1180,1749,1191,1744,1191,1744,1192,1738,1194,1738,1195,1736,1195,1736,1196,1733,1198,1733,1199,1733,1200,1732,1200,1733,1202,1736,1206,1736,1207,1739,1208,1739,1211,1738,1212,1714,1217,1710,1217,1692,1223,1694,1217,1695,1217,1695,1215,1697,1214,1697,1212,1699,1211,1699,1209,1701,1208,1701,1206,1702,1206,1708,1175,1715,1175,1723,1177,1733,1174,1738,1162,1719,1142,1717,1142,1716,1140,1705,1136,1697,1136,1697,1135,1688,1135,1688,1134,1679,1134,1679,1133,1672,1133,1672,1132,1666,1131,1664,1129,1664,1127,1662,1126,1659,1117,1658,1117,1658,1115,1657,1115,1656,1109,1655,1109,1655,1106,1654,1106,1654,1103,1653,1103,1653,1100,1652,1100,1652,1098,1651,1098,1651,1095,1649,1094,1649,1092,1646,1090,1644,1087,1627,1087,1625,1083,1623,1082,1622,1078,1620,1077,1620,1075,1618,1074,1618,1072,1617,1072,1614,1068,1611,1068,1611,1067,1604,1066,1604,1065,1599,1065,1585,1063,1585,1064,1583,1064,1582,1066,1580,1066,1580,1067,1577,1068,1577,1070,1574,1071,1574,1072,1572,1072,1572,1073,1570,1073,1567,1077,1565,1077,1563,1080,1561,1080,1560,1082,1558,1082,1557,1084,1537,1084,1537,1083,1531,1083,1531,1082,1529,1082,1529,1081,1526,1081,1526,1080,1522,1079,1522,1078,1520,1078,1520,1077,1518,1077,1518,1076,1512,1074,1512,1073,1502,1071,1502,1070,1496,1069,1496,1068,1494,1068,1494,1067,1491,1067,1491,1066,1481,1064,1481,1063,1477,1062,1477,1061,1475,1061,1474,1059,1472,1059,1471,1057,1469,1057,1468,1055,1461,1053,1460,1056,1456,1058,1456,1059,1339,1059,1142,1059,1101,1060,1015,1060,994,1060,985,1059,980,1056,980,1055,978,1055,977,1053,976,1053,975,1051,973,1051,971,1048,969,1048,967,1045,965,1045,963,1042,961,1042,959,1039,956,1038,955,1036,953,1036,953,1035,950,1034,949,1032,947,1032,945,1029,943,1029,942,1027,939,1026,939,1025,937,1025,936,1023,934,1023,933,1021,931,1021,930,1019,927,1018,927,1017,923,1016,922,1014,920,1014,920,1013,918,1013,918,1012,915,1012,915,1011,913,1011,913,1010,904,1008,904,1007,898,1005,898,1004,894,1003,889,997,889,995,888,995,888,993,887,993,887,991,886,991,886,989,885,989,885,986,884,986,884,983,883,983,883,981,882,981,882,978,881,978,881,976,880,976,879,970,878,970,878,968,877,968,877,965,876,965,876,963,875,963,874,957,873,957,872,953,871,953,870,949,868,948,868,946,866,945,866,943,864,942,864,940,862,939,861,935,859,934,858,930,856,929,856,927,854,926,854,924,852,923,852,921,850,920,849,916,847,915,847,913,845,912,844,909,841,907,841,905,839,904,838,901,837,901,837,899,834,897,833,893,832,893,835,879,835,873,832,871,832,870,830,870,829,868,827,868,826,866,824,866,823,864,821,864,819,861,817,861,815,858,813,858,807,851,804,849,804,847,802,846,801,843,800,843,800,841,799,841,799,839,798,839,798,836,797,836,797,834,796,834,796,832,794,831,794,829,792,828,792,826,786,821,776,810,774,810,773,808,769,805,769,803,766,801,757,766,756,766,754,760,748,755,741,754,741,755,735,755,735,756,731,756,731,757,727,757,727,758,724,758,724,759,719,759,719,760,712,760,712,761,695,760,686,753,686,751,683,749,683,747,681,746,680,743,679,743,679,741,677,740,677,738,675,737,675,735,673,734,673,732,672,732,672,730,671,730,670,727,655,732,653,670,652,628,652,615,651,573,651,504,651,499,650,499,650,404,650,362,651,362,651,354,677,361,683,368,687,369,695,378,697,378,699,381,701,381,703,384,705,384,706,386,746,394,757,385,764,377,766,377,766,376,769,374,773,369,775,369,778,365,780,365,782,362,784,362,785,360,788,359,788,358,792,357,793,355,797,354,798,352,802,351,803,349,807,348,808,346,810,346,810,345,812,345,812,344,814,344,821,341,821,344,814,350,812,354,811,354,811,362,819,363,819,362,823,362,823,361,827,360,827,359,833,357,833,356,835,356,835,355,837,355,837,354,839,354,839,353,841,353,841,352,845,351,846,349,852,347,852,346,855,345,856,343,860,342,861,340,863,340,865,337,867,337,868,335,870,335,871,333,879,326,880,324,883,324,893,334,910,352,912,352,913,354,921,358,932,343" data-href="canada" data-maphilight='{"stroke":true,"fillColor":"00CDCB","fillOpacity":10, "strokeColor":"00CDCB","strokeOpacity":1, "strokeWidth":"2","shadow":false,"shadowBackground":"189dbb"}'> </map>

DarkKnight1992 avatar Oct 02 '17 20:10 DarkKnight1992

hope this helps

DarkKnight1992 avatar Oct 02 '17 20:10 DarkKnight1992

lemme know if this is enough, or you would need something else

DarkKnight1992 avatar Oct 02 '17 20:10 DarkKnight1992

BTW: I have tested <map in views and it has been rendered correctly.

petersirka avatar Oct 02 '17 20:10 petersirka

its happening maybe because we are using angular for front end instead total view engine ?

DarkKnight1992 avatar Oct 02 '17 20:10 DarkKnight1992

The problem can be in Angular.... Try to look into the source-code directly whether contains NaN. Open Network tab in Web Developer Tools and check the response.

petersirka avatar Oct 02 '17 20:10 petersirka

BTW: recover Total.js config to default because your paths are bad.

petersirka avatar Oct 02 '17 20:10 petersirka

the response is correct. What do you mean the paths are bad ?

DarkKnight1992 avatar Oct 02 '17 20:10 DarkKnight1992

Remove all bad records:

directory-public : ../../public --> BAD
directory-views : ../../public --> BAD
allow-compile-css : false
allow-compile-html : false
allow-compile-js : false
static-url : ../../public --> BAD
static-url-css : ../../public --> BAD
static-url-download : ../../public --> BAD
static-url-font : ../../public --> BAD
static-url-image : ../../public --> BAD
static-url-js : ../../public --> BAD
static-url-video : ../../public --> BAD

directory-* + static-* can't contain this phrase ../ or ./

petersirka avatar Oct 02 '17 20:10 petersirka

So if the response is correct the problem will be on client-side scripting.

petersirka avatar Oct 02 '17 20:10 petersirka

so do you mean the pubic directory has to be relative to the controller and can't be anywhere else ? But that doesn't make much sense it doesn't give the freedom to structure the application well and use babel for es6 support either. Do you mean trying to structure the backend and frontend in the different directories is a bad way to stucture the application in total js ?

DarkKnight1992 avatar Oct 02 '17 20:10 DarkKnight1992

we are migrating the site from php to node js and everything was working fine up until now

DarkKnight1992 avatar Oct 02 '17 20:10 DarkKnight1992

You can use own structure, but you need to keep rules. All directories start from app root so you can't use ../ or ./ because you will be outside of app root. The problem is in different OS.

// Default
directory-public    : /public/
// means --> /some/path/yourapp/public/

// If you want to use another directory in APP ROOT then use:
directory-public    : /shared/
// means --> /some/path/yourapp/shared/

// If you want to use another directory outside of APP ROOT then use:
directory-public    : ~/absolute/path/on/your/server/
// means --> /absolute/path/on/your/server/
// I don't recommend it because this paths will use packages and modules

So my recommendation:

  • don't change directory structure on the server-side
  • customize client-side by your needs in public directory or in virtualized app directory

petersirka avatar Oct 02 '17 21:10 petersirka

that's make a lot of sense lemme try that

DarkKnight1992 avatar Oct 02 '17 21:10 DarkKnight1992

well there is another problem our backend is in src/server/debug.js and will compile to server/release.js after transpiling with babel and providing directory-public /public is considered to be at the root of debug or release is there a way to get the server root in the config file ?

DarkKnight1992 avatar Oct 02 '17 21:10 DarkKnight1992

root is according to the location of debug.js or release.js. In other words: root is process.cwd() --> current working directory.

root can't be defined in config file because Total.js reads config from app root. I need more info for thinking.

petersirka avatar Oct 02 '17 21:10 petersirka