cpmadsen / hex_gen_js

0 stars 0 forks source link

Zoom Out - #31

Closed Zeugmarout closed 7 months ago

Zeugmarout commented 7 months ago

When zoom out hits the minimum zoom level (zoomed out as much as possible,) the hexes stutter and fail to render for a second.

Zeugmarout commented 7 months ago

Here are some suggestions to improve the performance of your zooming functionality:

Debouncing:

Implement debouncing on the mousewheel events to avoid rapid firing of the zoom function. This can help reduce the number of times the function is called and, in turn, improve performance. Example using lodash debounce: javascript Copy code const handleMouseWheel = _.debounce(function(event) { // Your existing zoom logic here }, 200); // Adjust the debounce delay as needed Throttling:

Throttle the mousewheel events to ensure that the zoom function is called at a steady rate, preventing rapid and potentially resource-intensive calls. Example using lodash throttle: javascript Copy code const handleMouseWheel = _.throttle(function(event) { // Your existing zoom logic here }, 200); // Adjust the throttle interval as needed

Zeugmarout commented 7 months ago

Resolved for now