@pipsend/charts 2.2.0 → 2.2.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/dist/pipsend-charts.development.mjs +128 -9
- package/dist/pipsend-charts.production.mjs +2 -2
- package/dist/pipsend-charts.standalone.development.js +128 -9
- package/dist/pipsend-charts.standalone.development.mjs +128 -9
- package/dist/pipsend-charts.standalone.production.js +2 -2
- package/dist/pipsend-charts.standalone.production.mjs +2 -2
- package/dist/typings.d.ts +20 -0
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* @license
|
|
3
|
-
* Pipsend Charts v2.2.
|
|
3
|
+
* Pipsend Charts v2.2.1
|
|
4
4
|
* Copyright (c) 2026 Pipsend
|
|
5
5
|
* Licensed under MIT License
|
|
6
6
|
* Built on TradingView Lightweight Charts™ (Apache 2.0)
|
|
@@ -20408,6 +20408,9 @@
|
|
|
20408
20408
|
get type() {
|
|
20409
20409
|
return this._type;
|
|
20410
20410
|
}
|
|
20411
|
+
isComplete() {
|
|
20412
|
+
return true;
|
|
20413
|
+
}
|
|
20411
20414
|
/**
|
|
20412
20415
|
* Lets a tool hand the base its own options object, once, in the constructor.
|
|
20413
20416
|
*
|
|
@@ -20735,6 +20738,7 @@
|
|
|
20735
20738
|
this._private__dragStartPoint2 = null;
|
|
20736
20739
|
// Interactive mode
|
|
20737
20740
|
this._private__isComplete = false;
|
|
20741
|
+
this._private__interactive = null;
|
|
20738
20742
|
this._private__previewPoint = null;
|
|
20739
20743
|
this._private__trendOptions = {
|
|
20740
20744
|
lineColor: '#2962ff',
|
|
@@ -20782,7 +20786,7 @@
|
|
|
20782
20786
|
this._private__isComplete = true;
|
|
20783
20787
|
}
|
|
20784
20788
|
});
|
|
20785
|
-
|
|
20789
|
+
this._private__interactive = manager;
|
|
20786
20790
|
manager._internal_startDrawing();
|
|
20787
20791
|
}
|
|
20788
20792
|
_private__createPrimitive() {
|
|
@@ -21112,7 +21116,14 @@
|
|
|
21112
21116
|
_update() {
|
|
21113
21117
|
this._private__requestUpdate();
|
|
21114
21118
|
}
|
|
21119
|
+
isComplete() {
|
|
21120
|
+
return this._private__isComplete;
|
|
21121
|
+
}
|
|
21115
21122
|
remove() {
|
|
21123
|
+
if (this._private__interactive) {
|
|
21124
|
+
this._private__interactive._internal_destroy();
|
|
21125
|
+
this._private__interactive = null;
|
|
21126
|
+
}
|
|
21116
21127
|
if (this._private__primitive) {
|
|
21117
21128
|
// Detach from series
|
|
21118
21129
|
this._series.detachPrimitive(this._private__primitive);
|
|
@@ -22019,6 +22030,9 @@
|
|
|
22019
22030
|
points() {
|
|
22020
22031
|
return this._private__points;
|
|
22021
22032
|
}
|
|
22033
|
+
isComplete() {
|
|
22034
|
+
return this._private__isComplete;
|
|
22035
|
+
}
|
|
22022
22036
|
remove() {
|
|
22023
22037
|
this._private__stopDrawing();
|
|
22024
22038
|
if (this._private__primitive) {
|
|
@@ -22489,6 +22503,9 @@
|
|
|
22489
22503
|
isHovered() {
|
|
22490
22504
|
return this._private__isHovered;
|
|
22491
22505
|
}
|
|
22506
|
+
isComplete() {
|
|
22507
|
+
return this._private__isComplete;
|
|
22508
|
+
}
|
|
22492
22509
|
remove() {
|
|
22493
22510
|
this._private__stopDrawing();
|
|
22494
22511
|
if (this._private__primitive) {
|
|
@@ -22953,6 +22970,9 @@
|
|
|
22953
22970
|
isHovered() {
|
|
22954
22971
|
return this._private__isHovered;
|
|
22955
22972
|
}
|
|
22973
|
+
isComplete() {
|
|
22974
|
+
return this._private__isComplete;
|
|
22975
|
+
}
|
|
22956
22976
|
remove() {
|
|
22957
22977
|
this._private__stopDrawing();
|
|
22958
22978
|
if (this._private__primitive) {
|
|
@@ -23883,6 +23903,9 @@
|
|
|
23883
23903
|
}
|
|
23884
23904
|
return false;
|
|
23885
23905
|
}
|
|
23906
|
+
isComplete() {
|
|
23907
|
+
return this._private__isComplete;
|
|
23908
|
+
}
|
|
23886
23909
|
remove() {
|
|
23887
23910
|
if (this._private__primitive) {
|
|
23888
23911
|
this._series.detachPrimitive(this._private__primitive);
|
|
@@ -24773,6 +24796,9 @@
|
|
|
24773
24796
|
_update() {
|
|
24774
24797
|
this._private__requestUpdate();
|
|
24775
24798
|
}
|
|
24799
|
+
isComplete() {
|
|
24800
|
+
return !this._private__isDrawing;
|
|
24801
|
+
}
|
|
24776
24802
|
remove() {
|
|
24777
24803
|
if (this._private__clickHandler) {
|
|
24778
24804
|
this._chart.unsubscribeClick(this._private__clickHandler);
|
|
@@ -25316,6 +25342,9 @@
|
|
|
25316
25342
|
_update() {
|
|
25317
25343
|
this._private__requestUpdate();
|
|
25318
25344
|
}
|
|
25345
|
+
isComplete() {
|
|
25346
|
+
return !this._private__isDrawing;
|
|
25347
|
+
}
|
|
25319
25348
|
remove() {
|
|
25320
25349
|
if (this._private__clickHandler) {
|
|
25321
25350
|
this._chart.unsubscribeClick(this._private__clickHandler);
|
|
@@ -25779,6 +25808,9 @@
|
|
|
25779
25808
|
_update() {
|
|
25780
25809
|
this._private__requestUpdate();
|
|
25781
25810
|
}
|
|
25811
|
+
isComplete() {
|
|
25812
|
+
return !this._private__isDrawing;
|
|
25813
|
+
}
|
|
25782
25814
|
remove() {
|
|
25783
25815
|
if (this._private__clickHandler) {
|
|
25784
25816
|
this._chart.unsubscribeClick(this._private__clickHandler);
|
|
@@ -26321,6 +26353,9 @@
|
|
|
26321
26353
|
_update() {
|
|
26322
26354
|
this._private__requestUpdate();
|
|
26323
26355
|
}
|
|
26356
|
+
isComplete() {
|
|
26357
|
+
return !this._private__isDrawing;
|
|
26358
|
+
}
|
|
26324
26359
|
remove() {
|
|
26325
26360
|
// Clean up click handler
|
|
26326
26361
|
if (this._private__clickHandler) {
|
|
@@ -26887,7 +26922,7 @@
|
|
|
26887
26922
|
}
|
|
26888
26923
|
_private__setupClickOutsideHandler() {
|
|
26889
26924
|
// Set up click handler to finish editing when clicking outside
|
|
26890
|
-
|
|
26925
|
+
const handler = (param) => {
|
|
26891
26926
|
if (!this._private__isEditing)
|
|
26892
26927
|
return;
|
|
26893
26928
|
// Get click coordinates
|
|
@@ -26903,7 +26938,9 @@
|
|
|
26903
26938
|
this.remove();
|
|
26904
26939
|
}
|
|
26905
26940
|
}
|
|
26906
|
-
}
|
|
26941
|
+
};
|
|
26942
|
+
this._private__clickOutsideHandler = handler;
|
|
26943
|
+
this._chart.subscribeClick(handler);
|
|
26907
26944
|
}
|
|
26908
26945
|
_private__createPrimitive() {
|
|
26909
26946
|
this._private__paneView = this._private__createPaneView();
|
|
@@ -29052,6 +29089,9 @@
|
|
|
29052
29089
|
this._private__selectionChanged = new Delegate();
|
|
29053
29090
|
this._private__isDragging = false;
|
|
29054
29091
|
this._private__draggedToolId = null;
|
|
29092
|
+
this._private__pendingToolIds = new Set();
|
|
29093
|
+
this._private__completionCheck = null;
|
|
29094
|
+
this._private__drawingCompleted = new Delegate();
|
|
29055
29095
|
this._private__chart = chart;
|
|
29056
29096
|
this._private__series = series;
|
|
29057
29097
|
this._private__options = {
|
|
@@ -29090,9 +29130,63 @@
|
|
|
29090
29130
|
addTool(tool, id) {
|
|
29091
29131
|
const toolId = id ?? tool.id;
|
|
29092
29132
|
this._private__tools.set(toolId, tool);
|
|
29133
|
+
if (!tool.isComplete()) {
|
|
29134
|
+
this._private__pendingToolIds.add(toolId);
|
|
29135
|
+
}
|
|
29093
29136
|
this.recordChange();
|
|
29094
29137
|
return toolId;
|
|
29095
29138
|
}
|
|
29139
|
+
hasPendingDrawing() {
|
|
29140
|
+
return this._private__pendingToolIds.size > 0;
|
|
29141
|
+
}
|
|
29142
|
+
/** Removes every tool still waiting for points; returns how many were dropped. */
|
|
29143
|
+
cancelPendingDrawings() {
|
|
29144
|
+
if (this._private__pendingToolIds.size === 0) {
|
|
29145
|
+
return 0;
|
|
29146
|
+
}
|
|
29147
|
+
let cancelled = 0;
|
|
29148
|
+
for (const id of Array.from(this._private__pendingToolIds)) {
|
|
29149
|
+
const tool = this._private__tools.get(id);
|
|
29150
|
+
if (tool) {
|
|
29151
|
+
if (this._private__selectedToolId === id) {
|
|
29152
|
+
this._private__applySelection(null);
|
|
29153
|
+
}
|
|
29154
|
+
tool.remove();
|
|
29155
|
+
this._private__tools.delete(id);
|
|
29156
|
+
cancelled++;
|
|
29157
|
+
}
|
|
29158
|
+
}
|
|
29159
|
+
this._private__pendingToolIds.clear();
|
|
29160
|
+
if (cancelled > 0) {
|
|
29161
|
+
this.recordChange();
|
|
29162
|
+
}
|
|
29163
|
+
return cancelled;
|
|
29164
|
+
}
|
|
29165
|
+
subscribeDrawingCompleted(handler) {
|
|
29166
|
+
this._private__drawingCompleted._internal_subscribe(handler);
|
|
29167
|
+
}
|
|
29168
|
+
unsubscribeDrawingCompleted(handler) {
|
|
29169
|
+
this._private__drawingCompleted._internal_unsubscribe(handler);
|
|
29170
|
+
}
|
|
29171
|
+
_private__scheduleCompletionCheck() {
|
|
29172
|
+
if (this._private__pendingToolIds.size === 0 || this._private__completionCheck !== null) {
|
|
29173
|
+
return;
|
|
29174
|
+
}
|
|
29175
|
+
this._private__completionCheck = setTimeout(() => {
|
|
29176
|
+
this._private__completionCheck = null;
|
|
29177
|
+
for (const id of Array.from(this._private__pendingToolIds)) {
|
|
29178
|
+
const tool = this._private__tools.get(id);
|
|
29179
|
+
if (!tool) {
|
|
29180
|
+
this._private__pendingToolIds.delete(id);
|
|
29181
|
+
continue;
|
|
29182
|
+
}
|
|
29183
|
+
if (tool.isComplete()) {
|
|
29184
|
+
this._private__pendingToolIds.delete(id);
|
|
29185
|
+
this._private__drawingCompleted._internal_fire(id);
|
|
29186
|
+
}
|
|
29187
|
+
}
|
|
29188
|
+
}, 0);
|
|
29189
|
+
}
|
|
29096
29190
|
/**
|
|
29097
29191
|
* Remove a tool by ID
|
|
29098
29192
|
*/
|
|
@@ -29104,6 +29198,7 @@
|
|
|
29104
29198
|
}
|
|
29105
29199
|
tool.remove();
|
|
29106
29200
|
this._private__tools.delete(id);
|
|
29201
|
+
this._private__pendingToolIds.delete(id);
|
|
29107
29202
|
this.recordChange();
|
|
29108
29203
|
return true;
|
|
29109
29204
|
}
|
|
@@ -29303,6 +29398,7 @@
|
|
|
29303
29398
|
this._private__applySelection(null);
|
|
29304
29399
|
this._private__tools.forEach((tool) => tool.remove());
|
|
29305
29400
|
this._private__tools.clear();
|
|
29401
|
+
this._private__pendingToolIds.clear();
|
|
29306
29402
|
this.recordChange();
|
|
29307
29403
|
}
|
|
29308
29404
|
/**
|
|
@@ -29523,6 +29619,11 @@
|
|
|
29523
29619
|
* Destroy the manager and cleanup
|
|
29524
29620
|
*/
|
|
29525
29621
|
destroy() {
|
|
29622
|
+
if (this._private__completionCheck !== null) {
|
|
29623
|
+
clearTimeout(this._private__completionCheck);
|
|
29624
|
+
this._private__completionCheck = null;
|
|
29625
|
+
}
|
|
29626
|
+
this._private__drawingCompleted._internal_destroy();
|
|
29526
29627
|
this.clearAll();
|
|
29527
29628
|
this._private__detachEventHandlers();
|
|
29528
29629
|
}
|
|
@@ -29542,8 +29643,8 @@
|
|
|
29542
29643
|
const chartElement = this._private__chart.chartElement();
|
|
29543
29644
|
if (chartElement) {
|
|
29544
29645
|
this._private__pointerDownHandler = (event) => this._private__handlePointerDown(event);
|
|
29545
|
-
this._private__pointerUpHandler = (event) => this._private__handlePointerUp();
|
|
29546
|
-
this._private__pointerCancelHandler = (event) => this._private__handlePointerUp();
|
|
29646
|
+
this._private__pointerUpHandler = (event) => this._private__handlePointerUp(event);
|
|
29647
|
+
this._private__pointerCancelHandler = (event) => this._private__handlePointerUp(event);
|
|
29547
29648
|
chartElement.addEventListener('pointerdown', this._private__pointerDownHandler);
|
|
29548
29649
|
chartElement.addEventListener('pointerup', this._private__pointerUpHandler);
|
|
29549
29650
|
chartElement.addEventListener('pointercancel', this._private__pointerCancelHandler);
|
|
@@ -29586,6 +29687,7 @@
|
|
|
29586
29687
|
}
|
|
29587
29688
|
}
|
|
29588
29689
|
_private__handleClick(param) {
|
|
29690
|
+
this._private__scheduleCompletionCheck();
|
|
29589
29691
|
if (!param.point) {
|
|
29590
29692
|
return;
|
|
29591
29693
|
}
|
|
@@ -29665,6 +29767,9 @@
|
|
|
29665
29767
|
return null;
|
|
29666
29768
|
}
|
|
29667
29769
|
_private__handlePointerDown(event) {
|
|
29770
|
+
if (this._private__isDragging) {
|
|
29771
|
+
return;
|
|
29772
|
+
}
|
|
29668
29773
|
// Cleared for every press, then raised only if this one grabs a drawing
|
|
29669
29774
|
setInputClaim(this._private__chart, false);
|
|
29670
29775
|
const chartElement = this._private__chart.chartElement();
|
|
@@ -29707,10 +29812,13 @@
|
|
|
29707
29812
|
// mouse events, and those are what drive the crosshair the drag reads.
|
|
29708
29813
|
this._private__disableChartInteractions();
|
|
29709
29814
|
}
|
|
29710
|
-
_private__handlePointerUp() {
|
|
29815
|
+
_private__handlePointerUp(event) {
|
|
29711
29816
|
if (!this._private__isDragging || this._private__draggedToolId === null) {
|
|
29712
29817
|
return;
|
|
29713
29818
|
}
|
|
29819
|
+
if (event && this._private__pointerId !== null && event.pointerId !== this._private__pointerId) {
|
|
29820
|
+
return;
|
|
29821
|
+
}
|
|
29714
29822
|
const tool = this._private__tools.get(this._private__draggedToolId);
|
|
29715
29823
|
if (tool) {
|
|
29716
29824
|
tool.stopDrag();
|
|
@@ -29768,6 +29876,9 @@
|
|
|
29768
29876
|
this._private__pointerId = null;
|
|
29769
29877
|
}
|
|
29770
29878
|
_private__disableChartInteractions() {
|
|
29879
|
+
if (this._private__interactionsBeforeDrag !== null) {
|
|
29880
|
+
return;
|
|
29881
|
+
}
|
|
29771
29882
|
const options = this._private__chart.options();
|
|
29772
29883
|
this._private__interactionsBeforeDrag = {
|
|
29773
29884
|
_internal_handleScroll: options.handleScroll,
|
|
@@ -29792,6 +29903,14 @@
|
|
|
29792
29903
|
});
|
|
29793
29904
|
}
|
|
29794
29905
|
_private__handleKeyboard(event) {
|
|
29906
|
+
const target = event.target;
|
|
29907
|
+
const typing = !!target && (target.tagName === 'INPUT' || target.tagName === 'TEXTAREA' || target.isContentEditable);
|
|
29908
|
+
if (typing) {
|
|
29909
|
+
return;
|
|
29910
|
+
}
|
|
29911
|
+
if (event.key === 'Enter') {
|
|
29912
|
+
this._private__scheduleCompletionCheck();
|
|
29913
|
+
}
|
|
29795
29914
|
// Delete or Backspace to remove selected tool
|
|
29796
29915
|
if (event.key === 'Delete' || event.key === 'Backspace') {
|
|
29797
29916
|
if (this.deleteSelected()) {
|
|
@@ -29812,8 +29931,8 @@
|
|
|
29812
29931
|
}
|
|
29813
29932
|
return;
|
|
29814
29933
|
}
|
|
29815
|
-
// Escape to deselect
|
|
29816
29934
|
if (event.key === 'Escape') {
|
|
29935
|
+
this.cancelPendingDrawings();
|
|
29817
29936
|
this._private__handlePointerUp();
|
|
29818
29937
|
this._private__deselectAll();
|
|
29819
29938
|
this.stopDrawing();
|
|
@@ -29849,7 +29968,7 @@
|
|
|
29849
29968
|
* Returns the current version as a string. For example `'1.0.0'`.
|
|
29850
29969
|
*/
|
|
29851
29970
|
function version() {
|
|
29852
|
-
return "2.2.
|
|
29971
|
+
return "2.2.1";
|
|
29853
29972
|
}
|
|
29854
29973
|
|
|
29855
29974
|
var PipsendChartsModule = /*#__PURE__*/Object.freeze({
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* @license
|
|
3
|
-
* Pipsend Charts v2.2.
|
|
3
|
+
* Pipsend Charts v2.2.1
|
|
4
4
|
* Copyright (c) 2026 Pipsend
|
|
5
5
|
* Licensed under MIT License
|
|
6
6
|
* Built on TradingView Lightweight Charts™ (Apache 2.0)
|
|
@@ -20405,6 +20405,9 @@ class DrawingToolBase {
|
|
|
20405
20405
|
get type() {
|
|
20406
20406
|
return this._type;
|
|
20407
20407
|
}
|
|
20408
|
+
isComplete() {
|
|
20409
|
+
return true;
|
|
20410
|
+
}
|
|
20408
20411
|
/**
|
|
20409
20412
|
* Lets a tool hand the base its own options object, once, in the constructor.
|
|
20410
20413
|
*
|
|
@@ -20732,6 +20735,7 @@ class TrendLineTool extends DrawingToolBase {
|
|
|
20732
20735
|
this._private__dragStartPoint2 = null;
|
|
20733
20736
|
// Interactive mode
|
|
20734
20737
|
this._private__isComplete = false;
|
|
20738
|
+
this._private__interactive = null;
|
|
20735
20739
|
this._private__previewPoint = null;
|
|
20736
20740
|
this._private__trendOptions = {
|
|
20737
20741
|
lineColor: '#2962ff',
|
|
@@ -20779,7 +20783,7 @@ class TrendLineTool extends DrawingToolBase {
|
|
|
20779
20783
|
this._private__isComplete = true;
|
|
20780
20784
|
}
|
|
20781
20785
|
});
|
|
20782
|
-
|
|
20786
|
+
this._private__interactive = manager;
|
|
20783
20787
|
manager._internal_startDrawing();
|
|
20784
20788
|
}
|
|
20785
20789
|
_private__createPrimitive() {
|
|
@@ -21109,7 +21113,14 @@ class TrendLineTool extends DrawingToolBase {
|
|
|
21109
21113
|
_update() {
|
|
21110
21114
|
this._private__requestUpdate();
|
|
21111
21115
|
}
|
|
21116
|
+
isComplete() {
|
|
21117
|
+
return this._private__isComplete;
|
|
21118
|
+
}
|
|
21112
21119
|
remove() {
|
|
21120
|
+
if (this._private__interactive) {
|
|
21121
|
+
this._private__interactive._internal_destroy();
|
|
21122
|
+
this._private__interactive = null;
|
|
21123
|
+
}
|
|
21113
21124
|
if (this._private__primitive) {
|
|
21114
21125
|
// Detach from series
|
|
21115
21126
|
this._series.detachPrimitive(this._private__primitive);
|
|
@@ -22016,6 +22027,9 @@ class PolygonTool extends DrawingToolBase {
|
|
|
22016
22027
|
points() {
|
|
22017
22028
|
return this._private__points;
|
|
22018
22029
|
}
|
|
22030
|
+
isComplete() {
|
|
22031
|
+
return this._private__isComplete;
|
|
22032
|
+
}
|
|
22019
22033
|
remove() {
|
|
22020
22034
|
this._private__stopDrawing();
|
|
22021
22035
|
if (this._private__primitive) {
|
|
@@ -22486,6 +22500,9 @@ class ParallelChannelTool extends DrawingToolBase {
|
|
|
22486
22500
|
isHovered() {
|
|
22487
22501
|
return this._private__isHovered;
|
|
22488
22502
|
}
|
|
22503
|
+
isComplete() {
|
|
22504
|
+
return this._private__isComplete;
|
|
22505
|
+
}
|
|
22489
22506
|
remove() {
|
|
22490
22507
|
this._private__stopDrawing();
|
|
22491
22508
|
if (this._private__primitive) {
|
|
@@ -22950,6 +22967,9 @@ class PitchforkTool extends DrawingToolBase {
|
|
|
22950
22967
|
isHovered() {
|
|
22951
22968
|
return this._private__isHovered;
|
|
22952
22969
|
}
|
|
22970
|
+
isComplete() {
|
|
22971
|
+
return this._private__isComplete;
|
|
22972
|
+
}
|
|
22953
22973
|
remove() {
|
|
22954
22974
|
this._private__stopDrawing();
|
|
22955
22975
|
if (this._private__primitive) {
|
|
@@ -23880,6 +23900,9 @@ class FibonacciTool extends DrawingToolBase {
|
|
|
23880
23900
|
}
|
|
23881
23901
|
return false;
|
|
23882
23902
|
}
|
|
23903
|
+
isComplete() {
|
|
23904
|
+
return this._private__isComplete;
|
|
23905
|
+
}
|
|
23883
23906
|
remove() {
|
|
23884
23907
|
if (this._private__primitive) {
|
|
23885
23908
|
this._series.detachPrimitive(this._private__primitive);
|
|
@@ -24770,6 +24793,9 @@ class FibonacciFanTool extends DrawingToolBase {
|
|
|
24770
24793
|
_update() {
|
|
24771
24794
|
this._private__requestUpdate();
|
|
24772
24795
|
}
|
|
24796
|
+
isComplete() {
|
|
24797
|
+
return !this._private__isDrawing;
|
|
24798
|
+
}
|
|
24773
24799
|
remove() {
|
|
24774
24800
|
if (this._private__clickHandler) {
|
|
24775
24801
|
this._chart.unsubscribeClick(this._private__clickHandler);
|
|
@@ -25313,6 +25339,9 @@ class RectangleTool extends DrawingToolBase {
|
|
|
25313
25339
|
_update() {
|
|
25314
25340
|
this._private__requestUpdate();
|
|
25315
25341
|
}
|
|
25342
|
+
isComplete() {
|
|
25343
|
+
return !this._private__isDrawing;
|
|
25344
|
+
}
|
|
25316
25345
|
remove() {
|
|
25317
25346
|
if (this._private__clickHandler) {
|
|
25318
25347
|
this._chart.unsubscribeClick(this._private__clickHandler);
|
|
@@ -25776,6 +25805,9 @@ class CircleTool extends DrawingToolBase {
|
|
|
25776
25805
|
_update() {
|
|
25777
25806
|
this._private__requestUpdate();
|
|
25778
25807
|
}
|
|
25808
|
+
isComplete() {
|
|
25809
|
+
return !this._private__isDrawing;
|
|
25810
|
+
}
|
|
25779
25811
|
remove() {
|
|
25780
25812
|
if (this._private__clickHandler) {
|
|
25781
25813
|
this._chart.unsubscribeClick(this._private__clickHandler);
|
|
@@ -26318,6 +26350,9 @@ class ArrowTool extends DrawingToolBase {
|
|
|
26318
26350
|
_update() {
|
|
26319
26351
|
this._private__requestUpdate();
|
|
26320
26352
|
}
|
|
26353
|
+
isComplete() {
|
|
26354
|
+
return !this._private__isDrawing;
|
|
26355
|
+
}
|
|
26321
26356
|
remove() {
|
|
26322
26357
|
// Clean up click handler
|
|
26323
26358
|
if (this._private__clickHandler) {
|
|
@@ -26884,7 +26919,7 @@ class TextTool extends DrawingToolBase {
|
|
|
26884
26919
|
}
|
|
26885
26920
|
_private__setupClickOutsideHandler() {
|
|
26886
26921
|
// Set up click handler to finish editing when clicking outside
|
|
26887
|
-
|
|
26922
|
+
const handler = (param) => {
|
|
26888
26923
|
if (!this._private__isEditing)
|
|
26889
26924
|
return;
|
|
26890
26925
|
// Get click coordinates
|
|
@@ -26900,7 +26935,9 @@ class TextTool extends DrawingToolBase {
|
|
|
26900
26935
|
this.remove();
|
|
26901
26936
|
}
|
|
26902
26937
|
}
|
|
26903
|
-
}
|
|
26938
|
+
};
|
|
26939
|
+
this._private__clickOutsideHandler = handler;
|
|
26940
|
+
this._chart.subscribeClick(handler);
|
|
26904
26941
|
}
|
|
26905
26942
|
_private__createPrimitive() {
|
|
26906
26943
|
this._private__paneView = this._private__createPaneView();
|
|
@@ -29049,6 +29086,9 @@ class DrawingToolsManager {
|
|
|
29049
29086
|
this._private__selectionChanged = new Delegate();
|
|
29050
29087
|
this._private__isDragging = false;
|
|
29051
29088
|
this._private__draggedToolId = null;
|
|
29089
|
+
this._private__pendingToolIds = new Set();
|
|
29090
|
+
this._private__completionCheck = null;
|
|
29091
|
+
this._private__drawingCompleted = new Delegate();
|
|
29052
29092
|
this._private__chart = chart;
|
|
29053
29093
|
this._private__series = series;
|
|
29054
29094
|
this._private__options = {
|
|
@@ -29087,9 +29127,63 @@ class DrawingToolsManager {
|
|
|
29087
29127
|
addTool(tool, id) {
|
|
29088
29128
|
const toolId = id ?? tool.id;
|
|
29089
29129
|
this._private__tools.set(toolId, tool);
|
|
29130
|
+
if (!tool.isComplete()) {
|
|
29131
|
+
this._private__pendingToolIds.add(toolId);
|
|
29132
|
+
}
|
|
29090
29133
|
this.recordChange();
|
|
29091
29134
|
return toolId;
|
|
29092
29135
|
}
|
|
29136
|
+
hasPendingDrawing() {
|
|
29137
|
+
return this._private__pendingToolIds.size > 0;
|
|
29138
|
+
}
|
|
29139
|
+
/** Removes every tool still waiting for points; returns how many were dropped. */
|
|
29140
|
+
cancelPendingDrawings() {
|
|
29141
|
+
if (this._private__pendingToolIds.size === 0) {
|
|
29142
|
+
return 0;
|
|
29143
|
+
}
|
|
29144
|
+
let cancelled = 0;
|
|
29145
|
+
for (const id of Array.from(this._private__pendingToolIds)) {
|
|
29146
|
+
const tool = this._private__tools.get(id);
|
|
29147
|
+
if (tool) {
|
|
29148
|
+
if (this._private__selectedToolId === id) {
|
|
29149
|
+
this._private__applySelection(null);
|
|
29150
|
+
}
|
|
29151
|
+
tool.remove();
|
|
29152
|
+
this._private__tools.delete(id);
|
|
29153
|
+
cancelled++;
|
|
29154
|
+
}
|
|
29155
|
+
}
|
|
29156
|
+
this._private__pendingToolIds.clear();
|
|
29157
|
+
if (cancelled > 0) {
|
|
29158
|
+
this.recordChange();
|
|
29159
|
+
}
|
|
29160
|
+
return cancelled;
|
|
29161
|
+
}
|
|
29162
|
+
subscribeDrawingCompleted(handler) {
|
|
29163
|
+
this._private__drawingCompleted._internal_subscribe(handler);
|
|
29164
|
+
}
|
|
29165
|
+
unsubscribeDrawingCompleted(handler) {
|
|
29166
|
+
this._private__drawingCompleted._internal_unsubscribe(handler);
|
|
29167
|
+
}
|
|
29168
|
+
_private__scheduleCompletionCheck() {
|
|
29169
|
+
if (this._private__pendingToolIds.size === 0 || this._private__completionCheck !== null) {
|
|
29170
|
+
return;
|
|
29171
|
+
}
|
|
29172
|
+
this._private__completionCheck = setTimeout(() => {
|
|
29173
|
+
this._private__completionCheck = null;
|
|
29174
|
+
for (const id of Array.from(this._private__pendingToolIds)) {
|
|
29175
|
+
const tool = this._private__tools.get(id);
|
|
29176
|
+
if (!tool) {
|
|
29177
|
+
this._private__pendingToolIds.delete(id);
|
|
29178
|
+
continue;
|
|
29179
|
+
}
|
|
29180
|
+
if (tool.isComplete()) {
|
|
29181
|
+
this._private__pendingToolIds.delete(id);
|
|
29182
|
+
this._private__drawingCompleted._internal_fire(id);
|
|
29183
|
+
}
|
|
29184
|
+
}
|
|
29185
|
+
}, 0);
|
|
29186
|
+
}
|
|
29093
29187
|
/**
|
|
29094
29188
|
* Remove a tool by ID
|
|
29095
29189
|
*/
|
|
@@ -29101,6 +29195,7 @@ class DrawingToolsManager {
|
|
|
29101
29195
|
}
|
|
29102
29196
|
tool.remove();
|
|
29103
29197
|
this._private__tools.delete(id);
|
|
29198
|
+
this._private__pendingToolIds.delete(id);
|
|
29104
29199
|
this.recordChange();
|
|
29105
29200
|
return true;
|
|
29106
29201
|
}
|
|
@@ -29300,6 +29395,7 @@ class DrawingToolsManager {
|
|
|
29300
29395
|
this._private__applySelection(null);
|
|
29301
29396
|
this._private__tools.forEach((tool) => tool.remove());
|
|
29302
29397
|
this._private__tools.clear();
|
|
29398
|
+
this._private__pendingToolIds.clear();
|
|
29303
29399
|
this.recordChange();
|
|
29304
29400
|
}
|
|
29305
29401
|
/**
|
|
@@ -29520,6 +29616,11 @@ class DrawingToolsManager {
|
|
|
29520
29616
|
* Destroy the manager and cleanup
|
|
29521
29617
|
*/
|
|
29522
29618
|
destroy() {
|
|
29619
|
+
if (this._private__completionCheck !== null) {
|
|
29620
|
+
clearTimeout(this._private__completionCheck);
|
|
29621
|
+
this._private__completionCheck = null;
|
|
29622
|
+
}
|
|
29623
|
+
this._private__drawingCompleted._internal_destroy();
|
|
29523
29624
|
this.clearAll();
|
|
29524
29625
|
this._private__detachEventHandlers();
|
|
29525
29626
|
}
|
|
@@ -29539,8 +29640,8 @@ class DrawingToolsManager {
|
|
|
29539
29640
|
const chartElement = this._private__chart.chartElement();
|
|
29540
29641
|
if (chartElement) {
|
|
29541
29642
|
this._private__pointerDownHandler = (event) => this._private__handlePointerDown(event);
|
|
29542
|
-
this._private__pointerUpHandler = (event) => this._private__handlePointerUp();
|
|
29543
|
-
this._private__pointerCancelHandler = (event) => this._private__handlePointerUp();
|
|
29643
|
+
this._private__pointerUpHandler = (event) => this._private__handlePointerUp(event);
|
|
29644
|
+
this._private__pointerCancelHandler = (event) => this._private__handlePointerUp(event);
|
|
29544
29645
|
chartElement.addEventListener('pointerdown', this._private__pointerDownHandler);
|
|
29545
29646
|
chartElement.addEventListener('pointerup', this._private__pointerUpHandler);
|
|
29546
29647
|
chartElement.addEventListener('pointercancel', this._private__pointerCancelHandler);
|
|
@@ -29583,6 +29684,7 @@ class DrawingToolsManager {
|
|
|
29583
29684
|
}
|
|
29584
29685
|
}
|
|
29585
29686
|
_private__handleClick(param) {
|
|
29687
|
+
this._private__scheduleCompletionCheck();
|
|
29586
29688
|
if (!param.point) {
|
|
29587
29689
|
return;
|
|
29588
29690
|
}
|
|
@@ -29662,6 +29764,9 @@ class DrawingToolsManager {
|
|
|
29662
29764
|
return null;
|
|
29663
29765
|
}
|
|
29664
29766
|
_private__handlePointerDown(event) {
|
|
29767
|
+
if (this._private__isDragging) {
|
|
29768
|
+
return;
|
|
29769
|
+
}
|
|
29665
29770
|
// Cleared for every press, then raised only if this one grabs a drawing
|
|
29666
29771
|
setInputClaim(this._private__chart, false);
|
|
29667
29772
|
const chartElement = this._private__chart.chartElement();
|
|
@@ -29704,10 +29809,13 @@ class DrawingToolsManager {
|
|
|
29704
29809
|
// mouse events, and those are what drive the crosshair the drag reads.
|
|
29705
29810
|
this._private__disableChartInteractions();
|
|
29706
29811
|
}
|
|
29707
|
-
_private__handlePointerUp() {
|
|
29812
|
+
_private__handlePointerUp(event) {
|
|
29708
29813
|
if (!this._private__isDragging || this._private__draggedToolId === null) {
|
|
29709
29814
|
return;
|
|
29710
29815
|
}
|
|
29816
|
+
if (event && this._private__pointerId !== null && event.pointerId !== this._private__pointerId) {
|
|
29817
|
+
return;
|
|
29818
|
+
}
|
|
29711
29819
|
const tool = this._private__tools.get(this._private__draggedToolId);
|
|
29712
29820
|
if (tool) {
|
|
29713
29821
|
tool.stopDrag();
|
|
@@ -29765,6 +29873,9 @@ class DrawingToolsManager {
|
|
|
29765
29873
|
this._private__pointerId = null;
|
|
29766
29874
|
}
|
|
29767
29875
|
_private__disableChartInteractions() {
|
|
29876
|
+
if (this._private__interactionsBeforeDrag !== null) {
|
|
29877
|
+
return;
|
|
29878
|
+
}
|
|
29768
29879
|
const options = this._private__chart.options();
|
|
29769
29880
|
this._private__interactionsBeforeDrag = {
|
|
29770
29881
|
_internal_handleScroll: options.handleScroll,
|
|
@@ -29789,6 +29900,14 @@ class DrawingToolsManager {
|
|
|
29789
29900
|
});
|
|
29790
29901
|
}
|
|
29791
29902
|
_private__handleKeyboard(event) {
|
|
29903
|
+
const target = event.target;
|
|
29904
|
+
const typing = !!target && (target.tagName === 'INPUT' || target.tagName === 'TEXTAREA' || target.isContentEditable);
|
|
29905
|
+
if (typing) {
|
|
29906
|
+
return;
|
|
29907
|
+
}
|
|
29908
|
+
if (event.key === 'Enter') {
|
|
29909
|
+
this._private__scheduleCompletionCheck();
|
|
29910
|
+
}
|
|
29792
29911
|
// Delete or Backspace to remove selected tool
|
|
29793
29912
|
if (event.key === 'Delete' || event.key === 'Backspace') {
|
|
29794
29913
|
if (this.deleteSelected()) {
|
|
@@ -29809,8 +29928,8 @@ class DrawingToolsManager {
|
|
|
29809
29928
|
}
|
|
29810
29929
|
return;
|
|
29811
29930
|
}
|
|
29812
|
-
// Escape to deselect
|
|
29813
29931
|
if (event.key === 'Escape') {
|
|
29932
|
+
this.cancelPendingDrawings();
|
|
29814
29933
|
this._private__handlePointerUp();
|
|
29815
29934
|
this._private__deselectAll();
|
|
29816
29935
|
this.stopDrawing();
|
|
@@ -29846,7 +29965,7 @@ const customSeriesDefaultOptions = {
|
|
|
29846
29965
|
* Returns the current version as a string. For example `'1.0.0'`.
|
|
29847
29966
|
*/
|
|
29848
29967
|
function version() {
|
|
29849
|
-
return "2.2.
|
|
29968
|
+
return "2.2.1";
|
|
29850
29969
|
}
|
|
29851
29970
|
|
|
29852
29971
|
export { areaSeries as AreaSeries, ArrowTool, barSeries as BarSeries, baselineSeries as BaselineSeries, BrushTool, candlestickSeries as CandlestickSeries, CircleTool, ColorType, CrossLineTool, CrosshairMode, DEFAULT_SESSIONS, DraggablePriceLine, DrawingToolsManager, EXTENDED_FIBONACCI_RATIOS, FibonacciCalculator, FibonacciExtensionTool, FibonacciFanTool, FibonacciTool, GanttTool, histogramSeries as HistogramSeries, HorizontalLineTool, InteractiveLineManager, LastPriceAnimationMode, lineSeries as LineSeries, LineStyle, LineType, MismatchDirection, ParallelChannelTool, PitchforkTool, PolygonTool, PositionCalculator, PositionMarkersManager, PositionTool, PriceLineSource, PriceScaleMode, RectangleTool, RulerCalculator, RulerTool, STANDARD_FIBONACCI_RATIOS, TextTool, TickMarkType, TrackingModeExitMode, TradingSessionsIndicator, TrendLineTool, VerticalLineTool, VolumeProfileIndicator, applyADX, applyATR, applyBollingerBands, applyCCI, applyDonchianChannels, applyEMA, applyHeikinAshi, applyIchimoku, applyKeltnerChannels, applyMACD, applyMFI, applyOBV, applyParabolicSAR, applyPivotPoints, applyRSI, applySMA, applyStochastic, applySuperTrend, applyVWAP, applyVolume, applyWMA, applyWilliamsR, calculateHeikinAshi, calculatePipConfig, coordinateFromTime, createArrowTool, createBrushTool, createChart, createChartEx, createCircleTool, createCrossLineTool, createFibonacciExtensionTool, createFibonacciFanTool, createFibonacciTool, createGanttTool, createHorizontalLineTool, createImageWatermark, createInteractiveLineManager, createOptionsChart, createParallelChannelTool, createPitchforkTool, createPolygonTool, createPositionMarkers, createPositionTool, createRectangleTool, createRulerTool, createSeriesMarkers, createTextTool, createTextWatermark, createTradingLine, createTradingSessionsIndicator, createTrendLineTool, createUpDownMarkers, createVerticalLineTool, createVolumeProfileIndicator, createYieldCurveChart, customSeriesDefaultOptions, defaultHorzScaleBehavior, getPipConfig, hideSeriesPaint, isBusinessDay, isUTCTimestamp, setSeriesVolumes, setVolumeProfileData, timeFromCoordinate, version };
|