mirror of
https://github.com/Azgaar/Fantasy-Map-Generator.git
synced 2025-12-17 09:41:24 +01:00
throttle work done on zoom and brush drag
This commit is contained in:
parent
e7b354e217
commit
985e3c43f9
2 changed files with 3 additions and 2 deletions
2
main.js
2
main.js
|
|
@ -2023,7 +2023,7 @@ const regenerateMap = debounce(function () {
|
||||||
restoreLayers();
|
restoreLayers();
|
||||||
if (ThreeD.options.isOn) ThreeD.redraw();
|
if (ThreeD.options.isOn) ThreeD.redraw();
|
||||||
if ($("#worldConfigurator").is(":visible")) editWorld();
|
if ($("#worldConfigurator").is(":visible")) editWorld();
|
||||||
}, 500);
|
}, 1000);
|
||||||
|
|
||||||
// clear the map
|
// clear the map
|
||||||
function undraw() {
|
function undraw() {
|
||||||
|
|
|
||||||
|
|
@ -573,6 +573,7 @@ function editHeightmap() {
|
||||||
document.getElementById("brushesSliders").style.display = "none";
|
document.getElementById("brushesSliders").style.display = "none";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const dragBrushThrottled = throttle(dragBrush, 100);
|
||||||
function toggleBrushMode(e) {
|
function toggleBrushMode(e) {
|
||||||
if (e.target.classList.contains("pressed")) {
|
if (e.target.classList.contains("pressed")) {
|
||||||
exitBrushMode();
|
exitBrushMode();
|
||||||
|
|
@ -581,7 +582,7 @@ function editHeightmap() {
|
||||||
exitBrushMode();
|
exitBrushMode();
|
||||||
document.getElementById("brushesSliders").style.display = "block";
|
document.getElementById("brushesSliders").style.display = "block";
|
||||||
e.target.classList.add("pressed");
|
e.target.classList.add("pressed");
|
||||||
viewbox.style("cursor", "crosshair").call(d3.drag().on("start", dragBrush));
|
viewbox.style("cursor", "crosshair").call(d3.drag().on("start", dragBrushThrottled));
|
||||||
}
|
}
|
||||||
|
|
||||||
function dragBrush() {
|
function dragBrush() {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue