acttrader-charts 1.1.0 → 1.1.1

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/README.md CHANGED
@@ -287,6 +287,7 @@ When `enableTrading` is on and live BID/ASK data is streaming, hovering / activa
287
287
  | `tradeDisplayFilter` | | `"all"` | Which TFC levels are visible: `"all"` · `"positions"` · `"orders"` · `"none"` |
288
288
  | `positionRenderStyle` | | auto | Force position render style: `"line"` or `"dot"` |
289
289
  | `hideLevelConfirmCancel` | | `false` | Hide on-canvas ✓/✗ confirm-cancel buttons for TFC level edits |
290
+ | `deselectActiveOnOutsideClick` | | `false` | When `true`, clicking/tapping anywhere outside a selected trade level dismisses it (reverting any pending edits, mirroring ✗ Cancel). Default `false` keeps the level active so incidental clicks — price-axis resize, taps outside the QTY input — don't drop an in-progress edit. The level can still be dismissed via ✓/✗, tapping the level again, or `setLevels()` removing it |
290
291
  | `showTradeLevelsAlways` | | `false` | Always render SL/TP bracket lines + price pills, even when the parent level is not hovered or selected. The close (×) button stays hover-only so the chart isn't cluttered. Toggleable from the Settings dialog (Trading tab). Persisted in `localStorage`. |
291
292
  | `tradeLevelButtonScale` | | `1` | Multiplier for trade-level Confirm/Cancel/Edit/Close button radii and gaps. Scales visuals **and** hit/drag areas together — raise it on touch devices for larger tap targets. Clamped to `[1, 3]`. Also settable at runtime via `chart.setTradeLevelButtonScale(scale)` |
292
293
  | `tfcEnabled` | | `true` | Enable the TFC toggle button in the top bar. When `false`, TFC is completely disabled — the toggle button is hidden and all trade levels, draft orders, and the floating trade button are suppressed |
@@ -879,6 +879,17 @@ interface ChartConfig {
879
879
  * Default: `false`.
880
880
  */
881
881
  hideLevelConfirmCancel?: boolean;
882
+ /**
883
+ * When `true`, clicking or tapping anywhere outside a selected/active trade
884
+ * level dismisses it (reverting any pending edits, mirroring ✗ Cancel).
885
+ * When `false` (default), the active level is preserved across outside
886
+ * clicks — only explicit ✓ / ✗ buttons, tapping the level itself, or
887
+ * `setLevels()` removing it will dismiss it. Recommended `false` so
888
+ * incidental clicks (e.g. price-axis resize, tapping outside the QTY input)
889
+ * don't drop the user's in-progress edit.
890
+ * Default: `false`.
891
+ */
892
+ deselectActiveOnOutsideClick?: boolean;
882
893
  /**
883
894
  * Always render SL/TP bracket lines + price pills, even when the parent
884
895
  * trade level is not hovered or selected. Close (×) buttons remain
@@ -879,6 +879,17 @@ interface ChartConfig {
879
879
  * Default: `false`.
880
880
  */
881
881
  hideLevelConfirmCancel?: boolean;
882
+ /**
883
+ * When `true`, clicking or tapping anywhere outside a selected/active trade
884
+ * level dismisses it (reverting any pending edits, mirroring ✗ Cancel).
885
+ * When `false` (default), the active level is preserved across outside
886
+ * clicks — only explicit ✓ / ✗ buttons, tapping the level itself, or
887
+ * `setLevels()` removing it will dismiss it. Recommended `false` so
888
+ * incidental clicks (e.g. price-axis resize, tapping outside the QTY input)
889
+ * don't drop the user's in-progress edit.
890
+ * Default: `false`.
891
+ */
892
+ deselectActiveOnOutsideClick?: boolean;
882
893
  /**
883
894
  * Always render SL/TP bracket lines + price pills, even when the parent
884
895
  * trade level is not hovered or selected. Close (×) buttons remain
package/dist/index.cjs CHANGED
@@ -18693,6 +18693,7 @@ var _ChartEngine = class _ChartEngine {
18693
18693
  this.showBidAskLines = false;
18694
18694
  this.showActLogo = false;
18695
18695
  this.hideLevelConfirmCancel = false;
18696
+ this.deselectActiveOnOutsideClick = false;
18696
18697
  this.tradeLevelButtonScale = 1;
18697
18698
  this.levelClusteringEnabled = true;
18698
18699
  this.clusterThresholdDistance = 20;
@@ -19662,7 +19663,7 @@ var _ChartEngine = class _ChartEngine {
19662
19663
  }
19663
19664
  return;
19664
19665
  } else if (this.selectedTradeLabel !== null) {
19665
- if (!this.hideLevelConfirmCancel) {
19666
+ if (!this.hideLevelConfirmCancel && this.deselectActiveOnOutsideClick) {
19666
19667
  const lbl = this.selectedTradeLabel;
19667
19668
  const pending = this.pendingLevelDrags.get(lbl);
19668
19669
  if (!pending || pending.length === 0) {
@@ -19952,6 +19953,7 @@ var _ChartEngine = class _ChartEngine {
19952
19953
  this.showBidAskLines = config.showBidAskLines ?? false;
19953
19954
  this.showActLogo = config.showActLogo ?? false;
19954
19955
  this.hideLevelConfirmCancel = config.hideLevelConfirmCancel ?? false;
19956
+ this.deselectActiveOnOutsideClick = config.deselectActiveOnOutsideClick ?? false;
19955
19957
  this.tradeLevelButtonScale = Math.min(Math.max(config.tradeLevelButtonScale ?? 1, 1), 3);
19956
19958
  this.levelClusteringEnabled = config.levelClusteringEnabled ?? true;
19957
19959
  this.clusterThresholdDistance = config.clusterThresholdDistance ?? 20;