fix: Show Text tab immediately for all line types
This commit is contained in:
28
index.html
28
index.html
@ -138,21 +138,21 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Trendline Settings Panel -->
|
<!-- Trendline Settings Panel -->
|
||||||
<div id="trendlineSettingsPanel" class="hidden absolute top-14 left-1/2 -translate-x-1/2 bg-[#1a2333] border border-[#2d3a4f] rounded-lg shadow-2xl z-50 w-[280px] p-0 text-sm font-['Inter']">
|
<div id="trendlineSettingsPanel" class="hidden absolute top-14 left-1/2 -translate-x-1/2 bg-[#1a2333] border border-[#2d3a4f] rounded-lg shadow-2xl z-50 w-[280px] p-0 text-sm font-['Inter']">
|
||||||
<!-- Drag Handle -->
|
<!-- Drag Handle -->
|
||||||
<div id="tlPanelHeader" class="h-8 flex items-center justify-between px-3 border-b border-[#2d3a4f] cursor-move bg-[#1f2937] rounded-t-lg">
|
<div id="tlPanelHeader" class="h-8 flex items-center justify-between px-3 border-b border-[#2d3a4f] cursor-move bg-[#1f2937] rounded-t-lg">
|
||||||
<span class="text-[10px] uppercase tracking-wider font-bold text-gray-400">Settings</span>
|
<span class="text-[10px] uppercase tracking-wider font-bold text-gray-400">Settings</span>
|
||||||
<button class="text-gray-500 hover:text-white" onclick="window.toggleTLSettings(false)">
|
<button class="text-gray-500 hover:text-white" onclick="window.toggleTLSettings(false)">
|
||||||
<span class="material-symbols-outlined text-sm">close</span>
|
<span class="material-symbols-outlined text-sm">close</span>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="p-4">
|
<div class="p-4">
|
||||||
<!-- Tabs -->
|
<!-- Tabs -->
|
||||||
<div class="flex border-b border-[#2d3a4f] mb-4">
|
<div class="flex border-b border-[#2d3a4f] mb-4">
|
||||||
<button class="flex-1 py-2 text-center text-blue-500 border-b-2 border-blue-500 font-medium" id="tlTabStyle" onclick="window.switchTLTab('style')">Style</button>
|
<button class="flex-1 py-2 text-center text-blue-500 border-b-2 border-blue-500 font-medium" id="tlTabStyle" onclick="window.switchTLTab('style')">Style</button>
|
||||||
<button class="flex-1 py-2 text-center text-gray-400 hover:text-white" id="tlTabText" onclick="window.switchTLTab('text')" style="display: none;">Text</button>
|
<button class="flex-1 py-2 text-center text-gray-400 hover:text-white" id="tlTabText" onclick="window.switchTLTab('text')">Text</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Style Tab Content -->
|
<!-- Style Tab Content -->
|
||||||
<div id="tlContentStyle">
|
<div id="tlContentStyle">
|
||||||
|
|||||||
@ -1201,12 +1201,13 @@ export class DrawingManager {
|
|||||||
if (isLineWithText) {
|
if (isLineWithText) {
|
||||||
textTab.className = tab === 'text' ? 'flex-1 py-2 text-center text-blue-500 border-b-2 border-blue-500 font-medium' : 'flex-1 py-2 text-center text-gray-400 hover:text-white';
|
textTab.className = tab === 'text' ? 'flex-1 py-2 text-center text-blue-500 border-b-2 border-blue-500 font-medium' : 'flex-1 py-2 text-center text-gray-400 hover:text-white';
|
||||||
textTab.style.display = 'block';
|
textTab.style.display = 'block';
|
||||||
|
document.getElementById('tlContentText').className = tab === 'text' ? 'block' : 'hidden';
|
||||||
} else {
|
} else {
|
||||||
textTab.style.display = 'none';
|
textTab.style.display = 'none';
|
||||||
|
document.getElementById('tlContentText').className = 'hidden';
|
||||||
}
|
}
|
||||||
|
|
||||||
document.getElementById('tlContentStyle').className = tab === 'style' ? 'block' : 'hidden';
|
document.getElementById('tlContentStyle').className = tab === 'style' ? 'block' : 'hidden';
|
||||||
document.getElementById('tlContentText').className = tab === 'text' ? 'block' : 'hidden';
|
|
||||||
|
|
||||||
const textPicker = document.getElementById('tlTextColorPicker');
|
const textPicker = document.getElementById('tlTextColorPicker');
|
||||||
if (textPicker) textPicker.classList.add('hidden');
|
if (textPicker) textPicker.classList.add('hidden');
|
||||||
@ -1314,14 +1315,6 @@ export class DrawingManager {
|
|||||||
|
|
||||||
if (show) {
|
if (show) {
|
||||||
panel.classList.remove('hidden');
|
panel.classList.remove('hidden');
|
||||||
const isLineWithText = this.selectedDrawing && ['trend_line', 'ray', 'rectangle', 'horizontal_line', 'vertical_line'].includes(this.selectedDrawing.type);
|
|
||||||
if (!isLineWithText) {
|
|
||||||
this.activeTLTab = 'style';
|
|
||||||
document.getElementById('tlTabStyle').className = 'flex-1 py-2 text-center text-blue-500 border-b-2 border-blue-500 font-medium';
|
|
||||||
document.getElementById('tlTabText').className = 'flex-1 py-2 text-center text-gray-400 hover:text-white';
|
|
||||||
document.getElementById('tlContentStyle').className = 'block';
|
|
||||||
document.getElementById('tlContentText').className = 'hidden';
|
|
||||||
}
|
|
||||||
this.updateSettingsPanelUI();
|
this.updateSettingsPanelUI();
|
||||||
} else {
|
} else {
|
||||||
panel.classList.add('hidden');
|
panel.classList.add('hidden');
|
||||||
|
|||||||
Reference in New Issue
Block a user