From aef42950a6b9f670086ae72c6d5453e0c06b106e Mon Sep 17 00:00:00 2001 From: vodyanoysh Date: Wed, 1 Apr 2026 00:18:39 +0700 Subject: [PATCH] =?UTF-8?q?=D0=A1=D0=B2=D0=B5=D1=87=D0=B5=D0=BD=D0=B8?= =?UTF-8?q?=D0=B5=20=D0=BE=D1=82=20=D1=86=D0=B5=D0=BD=D1=82=D1=80=D0=B0=20?= =?UTF-8?q?=D0=BA=D0=BE=D0=BD=D1=82=D0=B5=D0=BD=D1=82=D0=B0=20=D0=BF=D0=B8?= =?UTF-8?q?=D1=81=D1=8C=D0=BC=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Добавлены @property --glow-x/y. После загрузки iframe вычисляется его центр в % от viewport и записывается в переменные. ResizeObserver обновляет позицию при ресайзе панели. Co-Authored-By: Claude Sonnet 4.6 --- src/renderer/src/assets/styles/base.css | 12 +++++++----- .../src/components/preview/MessageBody.vue | 19 ++++++++++++++++++- 2 files changed, 25 insertions(+), 6 deletions(-) diff --git a/src/renderer/src/assets/styles/base.css b/src/renderer/src/assets/styles/base.css index f77b1d8..533c403 100644 --- a/src/renderer/src/assets/styles/base.css +++ b/src/renderer/src/assets/styles/base.css @@ -1,8 +1,10 @@ /* Регистрируем glow-компоненты как анимируемые свойства */ -@property --glow-r { syntax: ''; initial-value: 0; inherits: true; } -@property --glow-g { syntax: ''; initial-value: 0; inherits: true; } -@property --glow-b { syntax: ''; initial-value: 0; inherits: true; } -@property --glow-a { syntax: ''; initial-value: 0; inherits: true; } +@property --glow-r { syntax: ''; initial-value: 0; inherits: true; } +@property --glow-g { syntax: ''; initial-value: 0; inherits: true; } +@property --glow-b { syntax: ''; initial-value: 0; inherits: true; } +@property --glow-a { syntax: ''; initial-value: 0; inherits: true; } +@property --glow-x { syntax: ''; initial-value: 75; inherits: true; } +@property --glow-y { syntax: ''; initial-value: 50; inherits: true; } *, *::before, @@ -27,7 +29,7 @@ body { /* Rich gradient base — accent-glow и content-glow выставляются через JS */ background: radial-gradient(ellipse 60% 50% at 15% 15%, var(--accent-glow, rgba(168,230,0,0.08)) 0%, transparent 70%), - radial-gradient(ellipse 95% 85% at 98% 50%, rgba(var(--glow-r), var(--glow-g), var(--glow-b), var(--glow-a)) 0%, transparent 60%), + radial-gradient(ellipse 95% 85% at calc(var(--glow-x) * 1%) calc(var(--glow-y) * 1%), rgba(var(--glow-r), var(--glow-g), var(--glow-b), var(--glow-a)) 0%, transparent 100%), radial-gradient(ellipse 45% 55% at 88% 90%, rgba(0, 110, 220, 0.05) 0%, transparent 70%), radial-gradient(ellipse 60% 40% at 50% 50%, rgba(80, 0, 160, 0.04) 0%, transparent 100%), #09090e; diff --git a/src/renderer/src/components/preview/MessageBody.vue b/src/renderer/src/components/preview/MessageBody.vue index 948fca8..cfc607c 100644 --- a/src/renderer/src/components/preview/MessageBody.vue +++ b/src/renderer/src/components/preview/MessageBody.vue @@ -130,7 +130,21 @@ function clearContentGlow(): void { setContentGlow(0, 0, 0, 0) } +function updateGlowPosition(): void { + const el = iframeRef.value + if (!el) return + const rect = el.getBoundingClientRect() + const x = ((rect.left + rect.width / 2) / window.innerWidth) * 100 + const y = ((rect.top + rect.height / 2) / window.innerHeight) * 100 + document.documentElement.style.setProperty('--glow-x', x.toFixed(1)) + document.documentElement.style.setProperty('--glow-y', y.toFixed(1)) +} + +const resizeObserver = new ResizeObserver(updateGlowPosition) + function onIframeLoad(): void { + updateGlowPosition() + if (iframeRef.value) resizeObserver.observe(iframeRef.value) try { const doc = iframeRef.value?.contentDocument const view = iframeRef.value?.contentWindow @@ -161,7 +175,10 @@ function onIframeLoad(): void { // Сбрасываем свечение при смене письма watch(() => props.body, () => clearContentGlow()) -onUnmounted(() => clearContentGlow()) +onUnmounted(() => { + clearContentGlow() + resizeObserver.disconnect() +})