@pipsend/charts 1.2.0 → 1.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 +55 -14
- package/dist/pipsend-charts.production.mjs +2 -2
- package/dist/pipsend-charts.standalone.development.js +55 -14
- package/dist/pipsend-charts.standalone.development.mjs +55 -14
- package/dist/pipsend-charts.standalone.production.js +2 -2
- package/dist/pipsend-charts.standalone.production.mjs +2 -2
- package/dist/typings.d.ts +12 -2
- package/package.json +83 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* @license
|
|
3
|
-
* Pipsend Charts v1.2.
|
|
3
|
+
* Pipsend Charts v1.2.1
|
|
4
4
|
* Copyright (c) 2026 Pipsend
|
|
5
5
|
* Licensed under MIT License
|
|
6
6
|
* Built on TradingView Lightweight Charts™ (Apache 2.0)
|
|
@@ -17047,8 +17047,9 @@ function setVolumeProfileData(indicator, data) {
|
|
|
17047
17047
|
indicator.setVolumeData(volumeMap);
|
|
17048
17048
|
}
|
|
17049
17049
|
|
|
17050
|
+
const CLICK_TOLERANCE_PX = 4;
|
|
17050
17051
|
/**
|
|
17051
|
-
* Draggable Price Line - Línea de precio que se puede arrastrar
|
|
17052
|
+
* Draggable Price Line - Línea de precio que se puede arrastrar y/o hacer click
|
|
17052
17053
|
*/
|
|
17053
17054
|
class DraggablePriceLine {
|
|
17054
17055
|
constructor(chart, series, options) {
|
|
@@ -17058,6 +17059,8 @@ class DraggablePriceLine {
|
|
|
17058
17059
|
this._private__unsubscribeHandlers = [];
|
|
17059
17060
|
this._private__isHovering = false;
|
|
17060
17061
|
this._private__originalColor = '';
|
|
17062
|
+
this._private__mouseDownPos = null;
|
|
17063
|
+
this._private__mouseDownOnLine = false;
|
|
17061
17064
|
this._private__chart = chart;
|
|
17062
17065
|
this._private__series = series;
|
|
17063
17066
|
this._private__options = {
|
|
@@ -17068,8 +17071,9 @@ class DraggablePriceLine {
|
|
|
17068
17071
|
...options,
|
|
17069
17072
|
};
|
|
17070
17073
|
this._private__createPriceLine();
|
|
17071
|
-
if (
|
|
17072
|
-
|
|
17074
|
+
// Set up handlers if line is interactive (draggable or clickable)
|
|
17075
|
+
if (this._private__options.draggable || this._private__options.onClick) {
|
|
17076
|
+
this._private__setupInteractionHandlers();
|
|
17073
17077
|
}
|
|
17074
17078
|
}
|
|
17075
17079
|
_private__createPriceLine() {
|
|
@@ -17083,26 +17087,33 @@ class DraggablePriceLine {
|
|
|
17083
17087
|
title: this._private__options.title || '',
|
|
17084
17088
|
});
|
|
17085
17089
|
}
|
|
17086
|
-
|
|
17090
|
+
_private__setupInteractionHandlers() {
|
|
17087
17091
|
const chartElement = this._private__chart.chartElement?.() || document.querySelector('.tv-lightweight-charts');
|
|
17088
17092
|
if (!chartElement)
|
|
17089
17093
|
return;
|
|
17090
17094
|
this._private__container = chartElement;
|
|
17091
17095
|
const handleMouseDown = (e) => {
|
|
17092
|
-
// Solo permitir
|
|
17096
|
+
// Solo permitir interacción desde el área del gráfico (no desde el price axis)
|
|
17093
17097
|
if (!this._private__isInChartArea(e)) {
|
|
17094
17098
|
return;
|
|
17095
17099
|
}
|
|
17096
17100
|
const price = this._private__getPriceFromY(e.clientY);
|
|
17097
|
-
if (this._private__isOnLine(e, price)) {
|
|
17101
|
+
if (!this._private__isOnLine(e, price)) {
|
|
17102
|
+
return;
|
|
17103
|
+
}
|
|
17104
|
+
// Track press for click vs drag detection
|
|
17105
|
+
this._private__mouseDownPos = { _internal_x: e.clientX, _internal_y: e.clientY };
|
|
17106
|
+
this._private__mouseDownOnLine = true;
|
|
17107
|
+
// Only start drag if line is draggable
|
|
17108
|
+
if (this._private__options.draggable) {
|
|
17098
17109
|
this._private__isDragging = true;
|
|
17099
17110
|
this._private__container.style.cursor = 'ns-resize';
|
|
17100
17111
|
if (this._private__options.onDragStart) {
|
|
17101
17112
|
this._private__options.onDragStart(this._private__options.price);
|
|
17102
17113
|
}
|
|
17103
|
-
e.preventDefault();
|
|
17104
|
-
e.stopPropagation();
|
|
17105
17114
|
}
|
|
17115
|
+
e.preventDefault();
|
|
17116
|
+
e.stopPropagation();
|
|
17106
17117
|
};
|
|
17107
17118
|
const handleMouseMove = (e) => {
|
|
17108
17119
|
if (this._private__isDragging) {
|
|
@@ -17123,7 +17134,7 @@ class DraggablePriceLine {
|
|
|
17123
17134
|
}
|
|
17124
17135
|
const price = this._private__getPriceFromY(e.clientY);
|
|
17125
17136
|
if (this._private__isOnLine(e, price)) {
|
|
17126
|
-
this._private__container.style.cursor = 'ns-resize';
|
|
17137
|
+
this._private__container.style.cursor = this._private__options.draggable ? 'ns-resize' : 'pointer';
|
|
17127
17138
|
this._private__setHoverState(true);
|
|
17128
17139
|
}
|
|
17129
17140
|
else {
|
|
@@ -17133,13 +17144,40 @@ class DraggablePriceLine {
|
|
|
17133
17144
|
}
|
|
17134
17145
|
};
|
|
17135
17146
|
const handleMouseUp = (e) => {
|
|
17136
|
-
|
|
17137
|
-
|
|
17147
|
+
const wasDragging = this._private__isDragging;
|
|
17148
|
+
const downOnLine = this._private__mouseDownOnLine;
|
|
17149
|
+
const downPos = this._private__mouseDownPos;
|
|
17150
|
+
// Reset state regardless of outcome
|
|
17151
|
+
this._private__isDragging = false;
|
|
17152
|
+
this._private__mouseDownOnLine = false;
|
|
17153
|
+
this._private__mouseDownPos = null;
|
|
17154
|
+
if (wasDragging) {
|
|
17155
|
+
// Drag-end path
|
|
17138
17156
|
this._private__container.style.cursor = 'default';
|
|
17139
17157
|
this._private__setHoverState(false);
|
|
17140
|
-
|
|
17158
|
+
const movedFromDown = downPos &&
|
|
17159
|
+
(Math.abs(e.clientX - downPos._internal_x) > CLICK_TOLERANCE_PX ||
|
|
17160
|
+
Math.abs(e.clientY - downPos._internal_y) > CLICK_TOLERANCE_PX);
|
|
17161
|
+
// If barely moved, treat as click instead of drag
|
|
17162
|
+
if (!movedFromDown && this._private__options.onClick) {
|
|
17163
|
+
this._private__options.onClick(this._private__options.price);
|
|
17164
|
+
}
|
|
17165
|
+
else if (this._private__options.onDragEnd) {
|
|
17141
17166
|
this._private__options.onDragEnd(this._private__options.price);
|
|
17142
17167
|
}
|
|
17168
|
+
return;
|
|
17169
|
+
}
|
|
17170
|
+
// Pure click path (non-draggable line or draggable that didn't start drag)
|
|
17171
|
+
if (downOnLine && downPos && this._private__options.onClick) {
|
|
17172
|
+
const moved = Math.abs(e.clientX - downPos._internal_x) > CLICK_TOLERANCE_PX ||
|
|
17173
|
+
Math.abs(e.clientY - downPos._internal_y) > CLICK_TOLERANCE_PX;
|
|
17174
|
+
if (!moved) {
|
|
17175
|
+
// Confirm release was still on the line area
|
|
17176
|
+
const price = this._private__getPriceFromY(e.clientY);
|
|
17177
|
+
if (this._private__isOnLine(e, price)) {
|
|
17178
|
+
this._private__options.onClick(this._private__options.price);
|
|
17179
|
+
}
|
|
17180
|
+
}
|
|
17143
17181
|
}
|
|
17144
17182
|
};
|
|
17145
17183
|
const handleMouseLeave = (e) => {
|
|
@@ -17153,6 +17191,8 @@ class DraggablePriceLine {
|
|
|
17153
17191
|
else {
|
|
17154
17192
|
this._private__setHoverState(false);
|
|
17155
17193
|
}
|
|
17194
|
+
this._private__mouseDownOnLine = false;
|
|
17195
|
+
this._private__mouseDownPos = null;
|
|
17156
17196
|
};
|
|
17157
17197
|
this._private__container.addEventListener('mousedown', handleMouseDown);
|
|
17158
17198
|
this._private__container.addEventListener('mousemove', handleMouseMove);
|
|
@@ -17397,6 +17437,7 @@ function createTradingLine(series, chart, options) {
|
|
|
17397
17437
|
onDragStart: options.onDragStart,
|
|
17398
17438
|
onDragMove: options.onDragMove,
|
|
17399
17439
|
onDragEnd: options.onDragEnd,
|
|
17440
|
+
onClick: options.onClick,
|
|
17400
17441
|
};
|
|
17401
17442
|
return new DraggablePriceLine(chart, series, lineOptions);
|
|
17402
17443
|
}
|
|
@@ -24467,7 +24508,7 @@ const customSeriesDefaultOptions = {
|
|
|
24467
24508
|
* Returns the current version as a string. For example `'1.0.0'`.
|
|
24468
24509
|
*/
|
|
24469
24510
|
function version() {
|
|
24470
|
-
return "1.2.
|
|
24511
|
+
return "1.2.1";
|
|
24471
24512
|
}
|
|
24472
24513
|
|
|
24473
24514
|
export { areaSeries as AreaSeries, ArrowTool, barSeries as BarSeries, baselineSeries as BaselineSeries, BrushTool, candlestickSeries as CandlestickSeries, CircleTool, ColorType, 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, PositionCalculator, PositionMarkersManager, PositionTool, PriceLineSource, PriceScaleMode, RectangleTool, RulerCalculator, RulerTool, STANDARD_FIBONACCI_RATIOS, TextTool, TickMarkType, TrackingModeExitMode, TradingSessionsIndicator, TrendLineTool, VerticalLineTool, VolumeProfileIndicator, applyATR, applyBollingerBands, applyEMA, applyMACD, applyOBV, applyRSI, applySMA, applyStochastic, applyVolume, applyWMA, calculatePipConfig, createArrowTool, createBrushTool, createChart, createChartEx, createCircleTool, createFibonacciExtensionTool, createFibonacciFanTool, createFibonacciTool, createGanttTool, createHorizontalLineTool, createImageWatermark, createInteractiveLineManager, createOptionsChart, createPositionMarkers, createPositionTool, createRectangleTool, createRulerTool, createSeriesMarkers, createTextTool, createTextWatermark, createTradingLine, createTradingSessionsIndicator, createTrendLineTool, createUpDownMarkers, createVerticalLineTool, createVolumeProfileIndicator, createYieldCurveChart, customSeriesDefaultOptions, defaultHorzScaleBehavior, getPipConfig, isBusinessDay, isUTCTimestamp, setOBVVolumeData, setVolumeData, setVolumeProfileData, version };
|