hide brush tools

This commit is contained in:
Shuanglei Tao
2025-06-07 18:05:39 +08:00
parent 60a77d1a52
commit 4a4a8a0e75
2 changed files with 7 additions and 2 deletions

View File

@@ -128,7 +128,7 @@
<button id="eraser-mode" title="橡皮擦" class="tool-button">🧽</button>
<button id="text-mode" title="添加文字" class="tool-button">T</button>
</div>
<div class="flex-group">
<div class="flex-group brush-tools">
<label for="brush-color">画笔:</label>
<select id="brush-color">
<option value="#000000">黑色</option>

View File

@@ -93,7 +93,12 @@ function updateToolUI() {
document.getElementById('brush-mode').classList.toggle('active', currentTool === 'brush');
document.getElementById('eraser-mode').classList.toggle('active', currentTool === 'eraser');
document.getElementById('text-mode').classList.toggle('active', currentTool === 'text');
// Show/hide brush tools
document.querySelectorAll('.brush-tools').forEach(el => {
el.style.display = ['brush', 'text'].includes(currentTool) ? 'flex' : 'none';
});
// Show/hide text tools
document.querySelectorAll('.text-tools').forEach(el => {
el.style.display = currentTool === 'text' ? 'flex' : 'none';