fix(web): 开关缠论元素保留视窗;分周期 Trend 涨跌配色
本地重绘统一冻结视窗;次/次次周期 Trend 上涨下跌使用独立颜色。 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -107,6 +107,30 @@ function snapshotPendingChartViewport() {
|
||||
}
|
||||
}
|
||||
|
||||
/** 本地重绘(开关缠论元素 / K 线类型等):先冻结视窗再 init */
|
||||
function reinitTradingViewPreservingViewport() {
|
||||
snapshotPendingChartViewport();
|
||||
initTradingView($('#symbol').val(), $('#timeframe').val());
|
||||
}
|
||||
|
||||
/** 全量 init 前确保 _pendingRestoreView 与 bar 数齐全(refreshChart 等路径) */
|
||||
function ensurePendingChartViewportBeforeInit() {
|
||||
if (window._preserveViewOnRefresh) {
|
||||
window._pendingRestoreView = window._preserveViewOnRefresh;
|
||||
if (!window._preserveViewBarCount) {
|
||||
window._preserveViewBarCount = getActiveKlineBarCount();
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (!window._pendingRestoreView && tvWidget && tvWidget.mainChart) {
|
||||
snapshotPendingChartViewport();
|
||||
return;
|
||||
}
|
||||
if (window._pendingRestoreView && !window._preserveViewBarCount) {
|
||||
window._preserveViewBarCount = getActiveKlineBarCount();
|
||||
}
|
||||
}
|
||||
|
||||
function freezeChartViewportBeforeRequest() {
|
||||
try {
|
||||
if (tvWidget && tvWidget.mainChart) {
|
||||
|
||||
Reference in New Issue
Block a user