acttrader-charts 1.3.0-beta.21 → 1.3.0-beta.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +22 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +22 -5
- package/dist/index.js.map +1 -1
- package/dist/webview/chart.html +5 -5
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -21334,13 +21334,15 @@ var OrderLineTimeDragHandler = class _OrderLineTimeDragHandler {
|
|
|
21334
21334
|
// src/core/priceReveal.ts
|
|
21335
21335
|
var MIN_FACTOR = 0.1;
|
|
21336
21336
|
var MAX_FACTOR = 10;
|
|
21337
|
-
function revealPriceRange(displayed, prices, plotHeightPx, padPx = 24) {
|
|
21338
|
-
const pts = prices.filter((p) => Number.isFinite(p));
|
|
21337
|
+
function revealPriceRange(displayed, prices, plotHeightPx, padPx = 24, maxSpan) {
|
|
21338
|
+
const pts = prices.filter((p) => Number.isFinite(p) && p > 0);
|
|
21339
21339
|
const span = displayed.max - displayed.min;
|
|
21340
21340
|
if (pts.length === 0 || !(span > 0) || !(plotHeightPx > 0)) return null;
|
|
21341
21341
|
const lo = Math.min(...pts);
|
|
21342
21342
|
const hi = Math.max(...pts);
|
|
21343
|
-
|
|
21343
|
+
const needLo = lo < displayed.min;
|
|
21344
|
+
const needHi = hi > displayed.max;
|
|
21345
|
+
if (!needLo && !needHi) return null;
|
|
21344
21346
|
let min = displayed.min;
|
|
21345
21347
|
let max = displayed.max;
|
|
21346
21348
|
for (let pass = 0; pass < 2; pass++) {
|
|
@@ -21348,6 +21350,20 @@ function revealPriceRange(displayed, prices, plotHeightPx, padPx = 24) {
|
|
|
21348
21350
|
min = Math.min(displayed.min, lo - pad);
|
|
21349
21351
|
max = Math.max(displayed.max, hi + pad);
|
|
21350
21352
|
}
|
|
21353
|
+
if (maxSpan !== void 0 && max - min > maxSpan) {
|
|
21354
|
+
if (!(maxSpan > span)) return null;
|
|
21355
|
+
if (needLo && !needHi) {
|
|
21356
|
+
max = displayed.max;
|
|
21357
|
+
min = max - maxSpan;
|
|
21358
|
+
} else if (needHi && !needLo) {
|
|
21359
|
+
min = displayed.min;
|
|
21360
|
+
max = min + maxSpan;
|
|
21361
|
+
} else {
|
|
21362
|
+
const mid = (displayed.min + displayed.max) / 2;
|
|
21363
|
+
min = mid - maxSpan / 2;
|
|
21364
|
+
max = mid + maxSpan / 2;
|
|
21365
|
+
}
|
|
21366
|
+
}
|
|
21351
21367
|
return { min, max };
|
|
21352
21368
|
}
|
|
21353
21369
|
function scaleAndPanFor(base, target) {
|
|
@@ -24752,7 +24768,7 @@ var _ChartEngine = class _ChartEngine {
|
|
|
24752
24768
|
this.wrapper.appendChild(this.bottomBar.el);
|
|
24753
24769
|
}
|
|
24754
24770
|
container.appendChild(this.wrapper);
|
|
24755
|
-
if (this.themeOverrides) {
|
|
24771
|
+
if (this.themeOverrides || Object.keys(this.settingsCanvasColors).length > 0) {
|
|
24756
24772
|
this.theme = this.buildTheme(this.themeName);
|
|
24757
24773
|
this.chromeTheme = this.buildChromeTheme(this.themeName);
|
|
24758
24774
|
this.applyThemeToComponents();
|
|
@@ -29813,7 +29829,8 @@ var _ChartEngine = class _ChartEngine {
|
|
|
29813
29829
|
if (this.dataStore.length === 0 || this._lastInCompareMode) return;
|
|
29814
29830
|
const { priceH } = this.getChartLayout();
|
|
29815
29831
|
const displayed = this._displayedPriceRange ?? this.getScaledPriceRange(this.viewport);
|
|
29816
|
-
const
|
|
29832
|
+
const base = this._lockedAutoFitBase ?? displayed;
|
|
29833
|
+
const target = revealPriceRange(displayed, prices, priceH, 24, (base.max - base.min) * MAX_FACTOR);
|
|
29817
29834
|
if (!target) return;
|
|
29818
29835
|
if (this.scrollAnimId !== null) {
|
|
29819
29836
|
cancelAnimationFrame(this.scrollAnimId);
|