acttrader-charts 1.3.0-beta.7 → 1.3.0-beta.9
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 +36 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +14 -0
- package/dist/index.d.ts +14 -0
- package/dist/index.js +36 -4
- package/dist/index.js.map +1 -1
- package/dist/webview/chart.html +2 -2
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -2651,8 +2651,8 @@ function drawLevel(ctx, level, layout, chartW, colors, theme, precision, hovered
|
|
|
2651
2651
|
ctx.save();
|
|
2652
2652
|
ctx.font = FONT_BRACKET;
|
|
2653
2653
|
const closeSlot = hideConfirmCancel ? 0 : closeR * 2 + BRACKET_BOX_PAD_X / 2;
|
|
2654
|
-
const slBW = BRACKET_BOX_PAD_X + ctx.measureText(bracketBoxLabel("stopLoss", slRenderPrice, precision, level, bracketLabel, draggingLabel === slDragKey)).width + BRACKET_BOX_PAD_X + closeSlot;
|
|
2655
|
-
const tpBW = BRACKET_BOX_PAD_X + ctx.measureText(bracketBoxLabel("takeProfit", tpRenderPrice, precision, level, bracketLabel, draggingLabel === tpDragKey)).width + BRACKET_BOX_PAD_X + closeSlot;
|
|
2654
|
+
const slBW = BRACKET_BOX_PAD_X + ctx.measureText(bracketBoxLabel("stopLoss", slRenderPrice, precision, level, bracketLabel, draggingLabel === slDragKey && !draftBracketPnl?.sl)).width + BRACKET_BOX_PAD_X + closeSlot;
|
|
2655
|
+
const tpBW = BRACKET_BOX_PAD_X + ctx.measureText(bracketBoxLabel("takeProfit", tpRenderPrice, precision, level, bracketLabel, draggingLabel === tpDragKey && !draftBracketPnl?.tp)).width + BRACKET_BOX_PAD_X + closeSlot;
|
|
2656
2656
|
ctx.restore();
|
|
2657
2657
|
const slBLineX = bracketLineXMap.get(slDragKey) ?? chartW * BRACKET_BASE_RATIO;
|
|
2658
2658
|
const tpBLineX = bracketLineXMap.get(tpDragKey) ?? chartW * BRACKET_BASE_RATIO;
|
|
@@ -3092,7 +3092,8 @@ function drawBracketLine(ctx, level, bracketType, bracketPrice, scale, priceRang
|
|
|
3092
3092
|
ctx.lineTo(chartW, y);
|
|
3093
3093
|
ctx.stroke();
|
|
3094
3094
|
ctx.globalAlpha = 1;
|
|
3095
|
-
const
|
|
3095
|
+
const showComputedPnl = isDraggingThis && !pnlText;
|
|
3096
|
+
const boxLabel = bracketBoxLabel(bracketType, price, precision, level, bracketLabel, showComputedPnl);
|
|
3096
3097
|
ctx.font = FONT_BRACKET;
|
|
3097
3098
|
const textW = ctx.measureText(boxLabel).width;
|
|
3098
3099
|
const pnlW = pnlText ? ctx.measureText(pnlText).width + BRACKET_BOX_PAD_X : 0;
|
|
@@ -25951,6 +25952,25 @@ var _ChartEngine = class _ChartEngine {
|
|
|
25951
25952
|
if (this.draftOrderLabel) this.setLevelQty(this.draftOrderLabel, qty);
|
|
25952
25953
|
return this;
|
|
25953
25954
|
}
|
|
25955
|
+
/**
|
|
25956
|
+
* Update the quantity (lots) shown on an EXISTING level's pill — the
|
|
25957
|
+
* host-panel counterpart of the chart's own qty-pill editing, mirroring
|
|
25958
|
+
* `updateLevelBracket` / `updateLevelMainPrice` for the quantity field.
|
|
25959
|
+
*
|
|
25960
|
+
* Exists because a modify panel that edits lots had no way to reflect the
|
|
25961
|
+
* change on the chart: `setLevelQty` was private and only reachable for
|
|
25962
|
+
* drafts, so the pill kept the server's old size until the broker echoed
|
|
25963
|
+
* the modify (reported: panel showed 0.13 while the chart pill stayed
|
|
25964
|
+
* 0.07). Goes through the same staging as chart-side qty edits, so the
|
|
25965
|
+
* value survives `setLevels` refreshes and is included in `tradeLevelEdit`
|
|
25966
|
+
* / reverted by `cancelCurrentEdit` exactly like a pill edit.
|
|
25967
|
+
*/
|
|
25968
|
+
updateLevelQty(label, qty) {
|
|
25969
|
+
if (!label || label === this.draftOrderLabel) return this;
|
|
25970
|
+
if (!Number.isFinite(qty) || qty <= 0) return this;
|
|
25971
|
+
this.setLevelQty(label, qty);
|
|
25972
|
+
return this;
|
|
25973
|
+
}
|
|
25954
25974
|
setLevelQty(label, qty) {
|
|
25955
25975
|
const idx = this.levels.findIndex((l) => l.label === label);
|
|
25956
25976
|
if (idx === -1) return;
|
|
@@ -27649,7 +27669,19 @@ var _ChartEngine = class _ChartEngine {
|
|
|
27649
27669
|
this._cancelEditAndDeselect(label);
|
|
27650
27670
|
return;
|
|
27651
27671
|
}
|
|
27652
|
-
const toRevert = label ? this.pendingLevelDrags.has(label)
|
|
27672
|
+
const toRevert = label ? this.pendingLevelDrags.has(label) || this.pendingQtyChanges.has(label) ? (
|
|
27673
|
+
/* A qty-only edit stages into pendingQtyChanges with NO drag
|
|
27674
|
+
entry (the panel's updateLevelQty path, and a flyout edit
|
|
27675
|
+
without touching prices). Building the revert list from
|
|
27676
|
+
drags alone skipped the loop entirely, so cancel left the
|
|
27677
|
+
staged qty on the pill forever — and the setLevels refresh
|
|
27678
|
+
preservation then kept re-applying it. */
|
|
27679
|
+
[[label, this.pendingLevelDrags.get(label) ?? []]]
|
|
27680
|
+
) : [] : [
|
|
27681
|
+
...this.pendingLevelDrags.entries(),
|
|
27682
|
+
// qty-only labels missing from the drags map (see above)
|
|
27683
|
+
...[...this.pendingQtyChanges.keys()].filter((k) => !this.pendingLevelDrags.has(k)).map((k) => [k, []])
|
|
27684
|
+
];
|
|
27653
27685
|
for (const [lbl] of toRevert) {
|
|
27654
27686
|
this.undoIsNewBracketMutations(lbl);
|
|
27655
27687
|
this.pendingLevelDrags.delete(lbl);
|