rescale heatmap depending on map zoom
Converted some bits to typescript