From e40975d563bbfd5be5b85761e9e2d65f428e1e8c Mon Sep 17 00:00:00 2001 From: dekun Date: Tue, 2 Jun 2026 12:22:54 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A1=8C=E6=83=85=E5=8C=BA=EF=BC=9A=E7=8E=B0?= =?UTF-8?q?=E4=BB=B7=E6=A0=87=E7=AD=BE=E5=9B=BA=E5=AE=9A=E4=BA=8E=E4=BB=B7?= =?UTF-8?q?=E6=A0=BC=E8=BD=B4=EF=BC=8CK=E7=BA=BF=E5=8F=B3=E4=BE=A7?= =?UTF-8?q?=E4=BF=9D=E7=95=9910=E6=A0=B9=E7=95=99=E7=99=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Cursor --- manual_trading_hub/static/app.css | 5 +-- manual_trading_hub/static/chart.js | 54 ++-------------------------- manual_trading_hub/static/index.html | 4 +-- 3 files changed, 8 insertions(+), 55 deletions(-) diff --git a/manual_trading_hub/static/app.css b/manual_trading_hub/static/app.css index 318789d..1773796 100644 --- a/manual_trading_hub/static/app.css +++ b/manual_trading_hub/static/app.css @@ -2062,16 +2062,17 @@ body.login-page { .market-price-tag { position: absolute; + right: 0; z-index: 5; pointer-events: none; padding: 4px 8px; - border-radius: 4px; + border-radius: 4px 0 0 4px; font-family: var(--font); font-size: 0.72rem; font-weight: 600; line-height: 1.25; text-align: center; - transform: translate(-50%, -50%); + transform: translateY(-50%); min-width: 72px; box-shadow: 0 1px 6px rgba(0, 0, 0, 0.35); } diff --git a/manual_trading_hub/static/chart.js b/manual_trading_hub/static/chart.js index 5b6e145..54f9e08 100644 --- a/manual_trading_hub/static/chart.js +++ b/manual_trading_hub/static/chart.js @@ -196,52 +196,6 @@ if (elBarCountdown) elBarCountdown.textContent = "距收盘 " + cd; } - function getBarSpacing(ts) { - if (!ts) return 6; - try { - if (typeof ts.barSpacing === "function") { - const v = ts.barSpacing(); - if (Number.isFinite(v) && v > 0) return v; - } - } catch (e) {} - try { - if (typeof ts.options === "function") { - const opts = ts.options(); - const v = opts && opts.barSpacing; - if (Number.isFinite(v) && v > 0) return v; - } - } catch (e) {} - try { - const x0 = ts.logicalToCoordinate(0); - const x1 = ts.logicalToCoordinate(1); - if (x0 != null && x1 != null) { - const d = Math.abs(x1 - x0); - if (Number.isFinite(d) && d > 0) return d; - } - } catch (e) {} - return 6; - } - - function plotAreaWidth() { - if (!chart) return chartHost.clientWidth || 0; - const ts = chart.timeScale(); - try { - if (typeof ts.width === "function") { - const w = ts.width(); - if (Number.isFinite(w) && w > 0) return w; - } - } catch (e) {} - return chartHost.clientWidth || 0; - } - - /** 固定在右侧 10 根 K 线留白区中央,不随 K 线横向滚动 */ - function priceTagX() { - const spacing = getBarSpacing(chart && chart.timeScale()); - const plotW = plotAreaWidth(); - if (plotW <= 0 || spacing <= 0) return null; - return plotW - (RIGHT_OFFSET_BARS * spacing) / 2; - } - function updatePriceTag() { if (!elPriceTag || !candleSeries || !chart) return; try { @@ -258,10 +212,8 @@ } catch (e) { y = null; } - const x = priceTagX(); const hostH = chartHost.clientHeight || 0; - const hostW = chartHost.clientWidth || 0; - if (y == null || x == null || y < 8 || y > hostH - 8 || x < 8 || x > hostW - 8) { + if (y == null || y < 8 || y > hostH - 8) { elPriceTag.classList.add("hidden"); elPriceTag.setAttribute("aria-hidden", "true"); return; @@ -270,8 +222,8 @@ elPriceTag.classList.remove("hidden", "is-up", "is-down"); elPriceTag.classList.add(up ? "is-up" : "is-down"); elPriceTag.setAttribute("aria-hidden", "false"); - elPriceTag.style.left = x + "px"; - elPriceTag.style.right = "auto"; + elPriceTag.style.left = "auto"; + elPriceTag.style.right = "0"; elPriceTag.style.top = y + "px"; if (elPriceTagValue) elPriceTagValue.textContent = fmtPrice(bar.close); } catch (e) { diff --git a/manual_trading_hub/static/index.html b/manual_trading_hub/static/index.html index 9083edb..788ed50 100644 --- a/manual_trading_hub/static/index.html +++ b/manual_trading_hub/static/index.html @@ -193,7 +193,7 @@
- - + +