lightweight-charts-drawing 0.2.3 → 0.2.4

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/CHANGELOG.md CHANGED
@@ -1,5 +1,18 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.2.4 (01/10/2026)
4
+
5
+ ### Added
6
+
7
+ - `Drawing.owner` / `NewDrawing.owner`: id of the study whose pane the drawing
8
+ lives in (absent = the main series pane). For hosts with several panes.
9
+ - `magnetSnap(dp, coords, mode, snapToIndicators, ohlc = true)`: `ohlc = false`
10
+ snaps only to the indicator values (a pane without the main series).
11
+
12
+ ### Changed
13
+
14
+ - Vertical line: factory `extendLine: true` (the line runs through every pane).
15
+
3
16
  ## 0.2.3 (01/10/2026)
4
17
 
5
18
  ### Changed
package/dist/index.d.ts CHANGED
@@ -442,8 +442,8 @@ export declare type DrawingStyle = {
442
442
  showImage?: boolean;
443
443
  plateColor?: string;
444
444
  signpostPosition?: number;
445
- /** TV vertical line "Extend" (extendLine, factory on): the line runs
446
- * through every pane of the chart (OpenTrader draws in the main pane). */
445
+ /** Vertical line "Extend" (extendLine, factory on): the line runs
446
+ * through every pane of the chart; off = its own pane only. */
447
447
  extendLine?: boolean;
448
448
  /** TV vertical line text orientation (factory vertical). */
449
449
  textOrientation?: "vertical" | "horizontal";
@@ -806,6 +806,7 @@ export declare type NewDrawing = (OnePoint | TwoPoint | ThreePoint | FourPoint |
806
806
  };
807
807
  closed?: boolean;
808
808
  fmt?: number;
809
+ owner?: string;
809
810
  };
810
811
 
811
812
  export declare type OHLC = {
@@ -1358,7 +1359,7 @@ declare type UnitVisibility = {
1358
1359
  to: number;
1359
1360
  };
1360
1361
 
1361
- export declare const VERSION = "0.2.3";
1362
+ export declare const VERSION = "0.2.4";
1362
1363
 
1363
1364
  declare type WithId<T> = T & {
1364
1365
  id: string;
@@ -1428,6 +1429,10 @@ declare type WithId<T> = T & {
1428
1429
  /** ObjectTree group tag — drawings sharing a tag render under one group
1429
1430
  * header in the panel (set/cleared by its Manage mode). */
1430
1431
  group?: string;
1432
+ /** Owner of the drawing's pane: the id of the study whose pane it was
1433
+ * drawn in (its price scale maps the points). Absent = the main series
1434
+ * pane. A drawing is drawn and clipped in its owner's pane. */
1435
+ owner?: string;
1431
1436
  };
1432
1437
 
1433
1438
  export { }
@@ -213,7 +213,7 @@ const j = "#808080", rt = "#f23645", nt = "#ff9800", it = "#4caf50", q = "#08998
213
213
  // 1-point
214
214
  "horizontal-line": { kind: "horizontal-line", pointCount: 1, preview: "none", isBbox: !1, hotkey: "Alt + H", defaults: { width: 2, textColor: "#2962ff", showPriceLabels: !0 } },
215
215
  "horizontal-ray": { kind: "horizontal-ray", pointCount: 1, preview: "none", isBbox: !1, hotkey: "Alt + J", defaults: { width: 2, showPriceLabels: !0 } },
216
- "vertical-line": { kind: "vertical-line", pointCount: 1, preview: "none", isBbox: !1, hotkey: "Alt + V", defaults: { width: 2, textColor: "#2962ff", showTime: !0 } },
216
+ "vertical-line": { kind: "vertical-line", pointCount: 1, preview: "none", isBbox: !1, hotkey: "Alt + V", defaults: { width: 2, textColor: "#2962ff", showTime: !0, extendLine: !0 } },
217
217
  "cross-line": { kind: "cross-line", pointCount: 1, preview: "none", isBbox: !1, hotkey: "Alt + C", defaults: { width: 2, textColor: "#ffffff", showPriceLabels: !0, showTime: !0 } },
218
218
  // TV factory (line-tool-arrow-marker): tv-blue-600 body + text, 16px bold.
219
219
  "arrow-marker": { kind: "arrow-marker", pointCount: 2, preview: "line", isBbox: !1, defaults: { color: "#1e53e5", width: 2, textColor: "#1e53e5", fontSize: 16, bold: !0 } },
@@ -4503,16 +4503,18 @@ function D(e, t) {
4503
4503
  const n = e.xToTime(t.x), o = e.yToPrice(t.y);
4504
4504
  return n == null || o == null ? null : { time: n, price: o };
4505
4505
  }
4506
- function ko(e, t, n, o) {
4507
- const i = t.barAt(e.time);
4508
- if (!i) return null;
4509
- const r = [i.open, i.high, i.low, i.close], l = t.priceToY(e.price);
4510
- let s = i.close, a = 1 / 0;
4511
- for (const c of r) {
4512
- const f = t.priceToY(c), h = l != null && f != null ? Math.abs(f - l) : Math.abs(e.price - c);
4513
- h < a && (a = h, s = c);
4506
+ function ko(e, t, n, o, i = !0) {
4507
+ const r = t.barAt(e.time);
4508
+ if (!r) return null;
4509
+ const l = i ? [r.open, r.high, r.low, r.close] : [];
4510
+ if (l.length === 0) return null;
4511
+ const s = t.priceToY(e.price);
4512
+ let a = l[0], c = 1 / 0;
4513
+ for (const f of l) {
4514
+ const h = t.priceToY(f), u = s != null && h != null ? Math.abs(h - s) : Math.abs(e.price - f);
4515
+ u < c && (c = u, a = f);
4514
4516
  }
4515
- return n === "weak" && l != null && a >= Kc ? null : { time: e.time, price: s };
4517
+ return n === "weak" && s != null && c >= Kc ? null : { time: e.time, price: a };
4516
4518
  }
4517
4519
  function U(e, t) {
4518
4520
  switch (e.kind) {
@@ -6317,7 +6319,7 @@ class za {
6317
6319
  });
6318
6320
  }
6319
6321
  }
6320
- const Va = "0.2.3";
6322
+ const Va = "0.2.4";
6321
6323
  export {
6322
6324
  pa as ANCHORABLE_KINDS,
6323
6325
  wn as DEFAULT_STYLE,