Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions src/js/components/BlockToolsSidebar.js
Original file line number Diff line number Diff line change
Expand Up @@ -1034,13 +1034,20 @@ const BlockToolsSidebar = ({
selectedBlockID = envType.id;
};

const shouldPreserveActiveToolOnBlockChange = (activeToolName) => {
if (!activeToolName) return false;
return ["terrain", "replace", "walltool", "groundtool"].includes(
activeToolName.toLowerCase()
);
};

const handleBlockSelect = async (blockType) => {
// Keep Terrain tool active while changing blocks; deactivate others
// Keep block-driven paint/placement tools active while changing blocks.
try {
const manager = terrainBuilderRef?.current?.toolManagerRef?.current;
const activeToolInstance = manager?.getActiveTool?.();
const activeToolName = activeToolInstance?.name;
if (activeToolName && activeToolName !== "terrain") {
if (activeToolName && !shouldPreserveActiveToolOnBlockChange(activeToolName)) {
terrainBuilderRef?.current?.activateTool(null);
}
} catch (_) {
Expand Down