acttrader-charts 1.4.0-beta.1 → 1.4.0-beta.2
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 +38 -9
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +38 -9
- package/dist/index.js.map +1 -1
- package/dist/webview/chart.html +27 -27
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -2371,6 +2371,23 @@ function detectClusters(measured, thresholdPx, excludeLabels = /* @__PURE__ */ n
|
|
|
2371
2371
|
return { id, members, centerY, centerPrice };
|
|
2372
2372
|
});
|
|
2373
2373
|
}
|
|
2374
|
+
function carryOverExpandedClusters(expanded, clusters) {
|
|
2375
|
+
const current = new Set(clusters.map((c) => c.id));
|
|
2376
|
+
let added = false;
|
|
2377
|
+
for (const id of [...expanded]) {
|
|
2378
|
+
if (current.has(id)) continue;
|
|
2379
|
+
expanded.delete(id);
|
|
2380
|
+
const oldMembers = new Set(id.slice("cluster:".length).split("|"));
|
|
2381
|
+
for (const c of clusters) {
|
|
2382
|
+
if (expanded.has(c.id)) continue;
|
|
2383
|
+
if (c.members.some((m) => oldMembers.has(m.level.label))) {
|
|
2384
|
+
expanded.add(c.id);
|
|
2385
|
+
added = true;
|
|
2386
|
+
}
|
|
2387
|
+
}
|
|
2388
|
+
}
|
|
2389
|
+
return added;
|
|
2390
|
+
}
|
|
2374
2391
|
function computeFanOutLayout(cluster, boxH, gapPx = 4) {
|
|
2375
2392
|
const n = cluster.members.length;
|
|
2376
2393
|
const totalH = n * boxH + (n - 1) * gapPx;
|
|
@@ -29277,8 +29294,11 @@ function roundRectPath(ctx, x, y, w, h, r) {
|
|
|
29277
29294
|
ctx.closePath();
|
|
29278
29295
|
}
|
|
29279
29296
|
function drawTradeListPanel(ctx, summary, anchor, bounds, theme, precision, timezone) {
|
|
29280
|
-
const
|
|
29297
|
+
const isLight = isLightColor(theme.background);
|
|
29298
|
+
const mono = isLight ? "#000000" : "#ffffff";
|
|
29281
29299
|
const colors = theme.tradeLevels;
|
|
29300
|
+
const bg = isLight ? "rgba(255, 255, 255, 0.98)" : "rgba(22, 26, 37, 0.96)";
|
|
29301
|
+
const border = isLight ? "rgba(0, 0, 0, 0.16)" : "rgba(255, 255, 255, 0.18)";
|
|
29282
29302
|
const accent = summary.side === "buy" ? colors.buySide : summary.side === "sell" ? colors.sellSide : colors.positionLine;
|
|
29283
29303
|
const subtitle = summary.totalLots !== void 0 ? `${formatLots(summary.totalLots)} @ ${summary.avgPrice.toFixed(precision)} avg price` : `${summary.avgPrice.toFixed(precision)} avg price`;
|
|
29284
29304
|
const shown = summary.rows.slice(0, MAX_ROWS);
|
|
@@ -29311,20 +29331,24 @@ function drawTradeListPanel(ctx, summary, anchor, bounds, theme, precision, time
|
|
|
29311
29331
|
if (x < 4) x = 4;
|
|
29312
29332
|
let y = anchor.y + anchor.h / 2 - h / 2;
|
|
29313
29333
|
y = Math.max(4, Math.min(y, bounds.h - h - 4));
|
|
29334
|
+
ctx.save();
|
|
29335
|
+
ctx.shadowColor = isLight ? "rgba(0, 0, 0, 0.18)" : "rgba(0, 0, 0, 0.45)";
|
|
29336
|
+
ctx.shadowBlur = 14;
|
|
29337
|
+
ctx.shadowOffsetY = 4;
|
|
29314
29338
|
roundRectPath(ctx, x, y, w, h, RADIUS4);
|
|
29315
|
-
ctx.fillStyle =
|
|
29339
|
+
ctx.fillStyle = bg;
|
|
29316
29340
|
ctx.fill();
|
|
29341
|
+
ctx.restore();
|
|
29317
29342
|
ctx.save();
|
|
29343
|
+
roundRectPath(ctx, x, y, w, h, RADIUS4);
|
|
29318
29344
|
ctx.clip();
|
|
29319
29345
|
ctx.fillStyle = accent;
|
|
29320
29346
|
ctx.fillRect(x, y, ACCENT_W, h);
|
|
29321
29347
|
ctx.restore();
|
|
29322
29348
|
roundRectPath(ctx, x + 0.5, y + 0.5, w - 1, h - 1, RADIUS4);
|
|
29323
|
-
ctx.strokeStyle =
|
|
29324
|
-
ctx.globalAlpha = 0.18;
|
|
29349
|
+
ctx.strokeStyle = border;
|
|
29325
29350
|
ctx.lineWidth = 1;
|
|
29326
29351
|
ctx.stroke();
|
|
29327
|
-
ctx.globalAlpha = 1;
|
|
29328
29352
|
const left = x + ACCENT_W + PAD3;
|
|
29329
29353
|
const right = x + w - PAD3;
|
|
29330
29354
|
let cy = y + PAD3;
|
|
@@ -37267,6 +37291,8 @@ var _ChartEngine = class _ChartEngine {
|
|
|
37267
37291
|
this.tradeLevelConfirmAreas = [];
|
|
37268
37292
|
this.tradeAddBracketAreas = [];
|
|
37269
37293
|
this.clusterBadgeAreas = [];
|
|
37294
|
+
/** Re-entry guard for the one extra paint a carried-over fan-out needs. */
|
|
37295
|
+
this._clusterCarryPass = false;
|
|
37270
37296
|
/** Merged price-axis tags from the last trade-layer pass (`levelClusteringEnabled`). */
|
|
37271
37297
|
this.axisTagClusterAreas = [];
|
|
37272
37298
|
/** Cluster (merged axis tag or on-chart badge) under the mouse — its trade list is drawn. */
|
|
@@ -44288,11 +44314,14 @@ var _ChartEngine = class _ChartEngine {
|
|
|
44288
44314
|
this.clusterBadgeAreas = result.clusterBadgeAreas;
|
|
44289
44315
|
this.lastClusters = result.clusters;
|
|
44290
44316
|
this._draftQtyPillArea = result.draftQtyPillArea;
|
|
44291
|
-
if (this.expandedClusters.size > 0) {
|
|
44292
|
-
|
|
44293
|
-
|
|
44294
|
-
|
|
44317
|
+
if (this.expandedClusters.size > 0 && carryOverExpandedClusters(this.expandedClusters, result.clusters) && !this._clusterCarryPass) {
|
|
44318
|
+
this._clusterCarryPass = true;
|
|
44319
|
+
try {
|
|
44320
|
+
this.renderTradeLayer();
|
|
44321
|
+
} finally {
|
|
44322
|
+
this._clusterCarryPass = false;
|
|
44295
44323
|
}
|
|
44324
|
+
return;
|
|
44296
44325
|
}
|
|
44297
44326
|
if (this.pnlPillExpanded && !this._pnlPillExpandPass) {
|
|
44298
44327
|
const missing = result.clusters.filter(
|