refactored logic for calculating the quadtree when zooming and panning the map