Skip to content

Commit 38038e3

Browse files
staredclaude
andcommitted
Fix color scheme switching and click animation
- Add colors prop to EquationDisplay and DescriptionPanel - Watch colors prop instead of termOrder for reactivity - Change transition from 'all' to 'opacity' to prevent layout shifts 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 6d18a6d commit 38038e3

File tree

3 files changed

+10
-3
lines changed

3 files changed

+10
-3
lines changed

src/components/CentralPanel.vue

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
:term-order="termOrder"
99
:active-term="activeTerm"
1010
:get-term-color="getTermColor"
11+
:colors="colors"
1112
@hover="setHover"
1213
@click="handleTermClick"
1314
/>
@@ -17,6 +18,7 @@
1718
:term-order="termOrder"
1819
:active-term="activeTerm"
1920
:get-term-color="getTermColor"
21+
:colors="colors"
2022
@hover="setHover"
2123
@click="handleTermClick"
2224
/>

src/components/equation/DescriptionPanel.vue

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,14 @@
55
<script setup lang="ts">
66
import { ref, watch, nextTick, onMounted } from 'vue'
77
import { applyTermColors, setupTermListeners, getTermElements } from '../../utils/termDom'
8+
import type { ColorScheme } from '../../export'
89
910
const props = defineProps<{
1011
description: string
1112
termOrder: string[]
1213
activeTerm: string | null
1314
getTermColor: (term: string) => string
15+
colors: ColorScheme
1416
}>()
1517
1618
const emit = defineEmits<{
@@ -45,7 +47,7 @@ watch(() => props.description, async () => {
4547
}, { immediate: true })
4648
4749
// Re-apply colors when color scheme changes
48-
watch(() => props.termOrder, () => {
50+
watch(() => props.colors, () => {
4951
if (descriptionRef.value) applyTermColors(descriptionRef.value, props.getTermColor)
5052
})
5153

src/components/equation/EquationDisplay.vue

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,14 @@ import { ref, computed, watch, nextTick, onMounted, onUnmounted } from 'vue'
2323
import katex from 'katex'
2424
import { applyTermColors, setupTermListeners, enableTermPointerEvents } from '../../utils/termDom'
2525
26+
import type { ColorScheme } from '../../export'
27+
2628
const props = defineProps<{
2729
latex: string
2830
termOrder: string[]
2931
activeTerm: string | null
3032
getTermColor: (term: string) => string
33+
colors: ColorScheme
3134
}>()
3235
3336
const emit = defineEmits<{
@@ -135,7 +138,7 @@ function renderKatex() {
135138
136139
// Watches
137140
watch(() => props.latex, renderKatex, { immediate: true })
138-
watch(() => props.termOrder, () => {
141+
watch(() => props.colors, () => {
139142
if (katexRef.value) applyTermColors(katexRef.value, props.getTermColor)
140143
})
141144
watch(() => props.activeTerm, calculateHighlightRects, { immediate: true })
@@ -187,7 +190,7 @@ onUnmounted(() => resizeObserver?.disconnect())
187190
}
188191
189192
:deep([class*="term-"]) {
190-
transition: all 0.2s ease;
193+
transition: opacity 0.2s ease;
191194
border-radius: 4px;
192195
cursor: pointer;
193196
position: relative;

0 commit comments

Comments
 (0)