@tradingaction/interactive 2.0.15 → 2.0.16

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.
@@ -0,0 +1,86 @@
1
+ import * as React from "react";
2
+ import { strokeDashTypes } from "@tradingaction/core";
3
+ export interface RectangleProps {
4
+ readonly snap: boolean;
5
+ readonly enabled: boolean;
6
+ readonly snapTo?: (datum: any) => number | number[];
7
+ readonly shouldDisableSnap?: (e: React.MouseEvent) => boolean;
8
+ readonly onStart: (e: React.MouseEvent, moreProps: any) => void;
9
+ readonly onComplete?: (e: React.MouseEvent, newTrends: any[], moreProps: any) => void;
10
+ readonly onSelect?: (e: React.MouseEvent, interactives: any[], moreProps: any) => void;
11
+ readonly onDoubleClickWhenHover?: (e: React.MouseEvent, moreProps: any, index: any) => void;
12
+ readonly onClickWhenHover?: (e: React.MouseEvent, moreProps: any, index: any) => void;
13
+ readonly onClickOutside?: (e: React.MouseEvent, moreProps: any, index: any) => void;
14
+ readonly onContextMenuWhenHover?: (e: React.MouseEvent, moreProps: any, index: any) => void;
15
+ readonly currentPositionStroke?: string;
16
+ readonly currentPositionStrokeWidth?: number;
17
+ readonly currentPositionstrokeOpacity?: number;
18
+ readonly currentPositionRadius?: number;
19
+ readonly type: "XLINE" | "RAY" | "LINE";
20
+ readonly hoverText: object;
21
+ readonly trends: any[];
22
+ readonly appearance: {
23
+ readonly strokeStyle: string;
24
+ readonly strokeWidth: number;
25
+ readonly strokeDasharray: strokeDashTypes;
26
+ readonly edgeStrokeWidth: number;
27
+ readonly edgeFill: string;
28
+ readonly edgeStroke: string;
29
+ readonly rectangleFill: string;
30
+ };
31
+ }
32
+ interface RectangleState {
33
+ current?: any;
34
+ override?: any;
35
+ trends?: any;
36
+ }
37
+ export declare class Rectangle extends React.Component<RectangleProps, RectangleState> {
38
+ static defaultProps: {
39
+ type: string;
40
+ onStart: () => void;
41
+ onSelect: () => void;
42
+ onDoubleClickWhenHover: () => void;
43
+ onClickWhenHover: () => void;
44
+ onClickOutside: () => void;
45
+ currentPositionStroke: string;
46
+ currentPositionstrokeOpacity: number;
47
+ currentPositionStrokeWidth: number;
48
+ currentPositionRadius: number;
49
+ shouldDisableSnap: (e: React.MouseEvent) => boolean;
50
+ hoverText: {
51
+ enable: boolean;
52
+ bgHeight: string;
53
+ bgWidth: string;
54
+ text: string;
55
+ selectedText: string;
56
+ fontFamily: string;
57
+ fontSize: number;
58
+ fill: string;
59
+ bgFill: string;
60
+ bgOpacity: number;
61
+ };
62
+ trends: never[];
63
+ appearance: {
64
+ strokeStyle: string;
65
+ strokeWidth: number;
66
+ strokeDasharray: string;
67
+ edgeStrokeWidth: number;
68
+ edgeFill: string;
69
+ edgeStroke: string;
70
+ rectangleFill: string;
71
+ r: number;
72
+ };
73
+ };
74
+ private getSelectionState;
75
+ private mouseMoved;
76
+ private saveNodeType;
77
+ private terminate;
78
+ constructor(props: RectangleProps);
79
+ render(): JSX.Element;
80
+ private readonly handleEnd;
81
+ private readonly handleStart;
82
+ private readonly handleDrawLine;
83
+ private readonly handleDragLineComplete;
84
+ private readonly handleDragLine;
85
+ }
86
+ export {};
@@ -0,0 +1,129 @@
1
+ import * as React from "react";
2
+ import { isDefined, isNotDefined, noop } from "@tradingaction/core";
3
+ import { getValueFromOverride, isHoverForInteractiveType, saveNodeType, terminate } from "./utils";
4
+ import { HoverTextNearMouse, MouseLocationIndicator, InteractiveRectangle } from "./components";
5
+ import { EachRectangle } from "./wrapper";
6
+ export class Rectangle extends React.Component {
7
+ constructor(props) {
8
+ super(props);
9
+ this.handleEnd = (e, xyValue, moreProps) => {
10
+ const { current } = this.state;
11
+ const { trends, appearance, type } = this.props;
12
+ if (this.mouseMoved && isDefined(current) && isDefined(current.topLeft)) {
13
+ const newTrends = [
14
+ ...trends.map((d) => (Object.assign(Object.assign({}, d), { selected: false }))),
15
+ {
16
+ topLeft: current.topLeft,
17
+ topRight: xyValue,
18
+ selected: true,
19
+ appearance,
20
+ type,
21
+ },
22
+ ];
23
+ this.setState({
24
+ current: null,
25
+ trends: newTrends,
26
+ }, () => {
27
+ const { onComplete } = this.props;
28
+ if (onComplete !== undefined) {
29
+ onComplete(e, newTrends, moreProps);
30
+ }
31
+ });
32
+ }
33
+ };
34
+ this.handleStart = (e, xyValue, moreProps) => {
35
+ const { current } = this.state;
36
+ if (isNotDefined(current) || isNotDefined(current.topLeft)) {
37
+ this.mouseMoved = false;
38
+ this.setState({
39
+ current: {
40
+ topLeft: xyValue,
41
+ topRight: null,
42
+ },
43
+ }, () => {
44
+ const { onStart } = this.props;
45
+ if (onStart !== undefined) {
46
+ onStart(e, moreProps);
47
+ }
48
+ });
49
+ }
50
+ };
51
+ this.handleDrawLine = (_, xyValue) => {
52
+ const { current } = this.state;
53
+ if (isDefined(current) && isDefined(current.topLeft)) {
54
+ this.mouseMoved = true;
55
+ this.setState({
56
+ current: {
57
+ topLeft: current.topLeft,
58
+ topRight: xyValue,
59
+ },
60
+ });
61
+ }
62
+ };
63
+ this.handleDragLineComplete = (e, moreProps) => {
64
+ const { override } = this.state;
65
+ if (isDefined(override)) {
66
+ const { trends } = this.props;
67
+ const newTrends = trends.map((each, idx) => idx === override.index
68
+ ? Object.assign(Object.assign({}, each), { topLeft: [override.topLeft, override.topRight], topRight: [override.topRightX, override.topRightY], selected: true }) : Object.assign(Object.assign({}, each), { selected: false }));
69
+ this.setState({
70
+ override: null,
71
+ }, () => {
72
+ const { onComplete } = this.props;
73
+ if (onComplete !== undefined) {
74
+ onComplete(e, newTrends, moreProps);
75
+ }
76
+ });
77
+ }
78
+ };
79
+ this.handleDragLine = (_, index, newXYValue) => {
80
+ this.setState({
81
+ override: Object.assign({ index }, newXYValue),
82
+ });
83
+ };
84
+ this.terminate = terminate.bind(this);
85
+ this.saveNodeType = saveNodeType.bind(this);
86
+ this.getSelectionState = isHoverForInteractiveType("trends").bind(this);
87
+ this.state = {};
88
+ }
89
+ render() {
90
+ const { appearance, currentPositionstrokeOpacity, currentPositionRadius = Rectangle.defaultProps.currentPositionRadius, currentPositionStroke, currentPositionStrokeWidth, enabled, hoverText, shouldDisableSnap, snap, snapTo, trends, type, } = this.props;
91
+ const { current, override } = this.state;
92
+ const tempLine = isDefined(current) && isDefined(current.topRight) ? (React.createElement(InteractiveRectangle, { type: type, topLeftX: current.topLeft[0], topLeftY: current.topLeft[1], topRightX: current.topRight[0], topRightY: current.topRight[1], bottomLeftX: current.bottomLeft[0], bottomLeftY: current.bottomLeft[1], bottomRightX: current.bottomRight[0], bottomRightY: current.bottomRight[1], strokeStyle: appearance.strokeStyle, strokeWidth: appearance.strokeWidth })) : null;
93
+ return (React.createElement("g", null,
94
+ trends.map((each, idx) => {
95
+ const eachAppearance = isDefined(each.appearance)
96
+ ? Object.assign(Object.assign({}, appearance), each.appearance) : appearance;
97
+ const hoverTextWithDefault = Object.assign(Object.assign({}, Rectangle.defaultProps.hoverText), hoverText);
98
+ return (React.createElement(EachRectangle, { key: idx, ref: this.saveNodeType(idx), index: idx, type: each.type, selected: each.selected, topLeftX: getValueFromOverride(override, idx, "topLeftX", each.topLeft[0]), topLeftY: getValueFromOverride(override, idx, "topLeftY", each.topLeft[1]), topRightX: getValueFromOverride(override, idx, "topRightX", each.topRight[0]), topRightY: getValueFromOverride(override, idx, "topRightY", each.topRight[1]), bottomLeftX: getValueFromOverride(override, idx, "bottomLeftX", each.bottomLeft[0]), bottomLeftY: getValueFromOverride(override, idx, "bottomLeftY", each.bottomLeft[1]), bottomRightX: getValueFromOverride(override, idx, "bottomRightX", each.bottomRight[0]), bottomRightY: getValueFromOverride(override, idx, "bottomRightY", each.bottomRight[1]), strokeStyle: eachAppearance.strokeStyle, strokeWidth: eachAppearance.strokeWidth, strokeOpacity: eachAppearance.strokeOpacity, strokeDasharray: eachAppearance.strokeDasharray, edgeStroke: eachAppearance.edgeStroke, edgeFill: eachAppearance.edgeFill, edgeStrokeWidth: eachAppearance.edgeStrokeWidth, rectangleFill: eachAppearance.rectangleFill, r: eachAppearance.r, hoverText: hoverTextWithDefault, onDrag: this.handleDragLine, onDragComplete: this.handleDragLineComplete, edgeInteractiveCursor: "react-financial-charts-move-cursor", lineInteractiveCursor: "react-financial-charts-move-cursor", onDoubleClickWhenHover: this.props.onDoubleClickWhenHover, onClickWhenHover: this.props.onClickWhenHover, onClickOutside: this.props.onClickOutside, onContextMenuWhenHover: this.props.onContextMenuWhenHover }));
99
+ }),
100
+ tempLine,
101
+ React.createElement(MouseLocationIndicator, { enabled: enabled, snap: snap, shouldDisableSnap: shouldDisableSnap, snapTo: snapTo, r: currentPositionRadius, stroke: currentPositionStroke, opacity: currentPositionstrokeOpacity, strokeWidth: currentPositionStrokeWidth, onMouseDown: this.handleStart, onClick: this.handleEnd, onMouseMove: this.handleDrawLine })));
102
+ }
103
+ }
104
+ Rectangle.defaultProps = {
105
+ type: "XLINE",
106
+ onStart: noop,
107
+ onSelect: noop,
108
+ onDoubleClickWhenHover: noop,
109
+ onClickWhenHover: noop,
110
+ onClickOutside: noop,
111
+ currentPositionStroke: "#000000",
112
+ currentPositionstrokeOpacity: 1,
113
+ currentPositionStrokeWidth: 3,
114
+ currentPositionRadius: 0,
115
+ shouldDisableSnap: (e) => e.button === 2 || e.shiftKey,
116
+ hoverText: Object.assign(Object.assign({}, HoverTextNearMouse.defaultProps), { enable: true, bgHeight: "auto", bgWidth: "auto", text: "Click to select object", selectedText: "" }),
117
+ trends: [],
118
+ appearance: {
119
+ strokeStyle: "#000000",
120
+ strokeWidth: 1,
121
+ strokeDasharray: "Solid",
122
+ edgeStrokeWidth: 1,
123
+ edgeFill: "#FFFFFF",
124
+ edgeStroke: "#000000",
125
+ rectangleFill: "transparent",
126
+ r: 6,
127
+ },
128
+ };
129
+ //# sourceMappingURL=Rectangle.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Rectangle.js","sourceRoot":"","sources":["../src/Rectangle.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE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,gBAAgB,EAAE,IAAI;IACtB,cAAc,EAAE,IAAI;IACpB,qBAAqB,EAAE,SAAS;IAChC,4BAA4B,EAAE,CAAC;IAC/B,0BAA0B,EAAE,CAAC;IAC7B,qBAAqB,EAAE,CAAC;IACxB,iBAAiB,EAAE,CAAC,CAAmB,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,KAAK,CAAC,IAAI,CAAC,CAAC,QAAQ;IACxE,SAAS,kCACF,kBAAkB,CAAC,YAAY,KAClC,MAAM,EAAE,IAAI,EACZ,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,wBAAwB,EAC9B,YAAY,EAAE,EAAE,GACnB;IACD,MAAM,EAAE,EAAE;IACV,UAAU,EAAE;QACR,WAAW,EAAE,SAAS;QACtB,WAAW,EAAE,CAAC;QACd,eAAe,EAAE,OAAO;QACxB,eAAe,EAAE,CAAC;QAClB,QAAQ,EAAE,SAAS;QACnB,UAAU,EAAE,SAAS;QACrB,aAAa,EAAE,aAAa;QAC5B,CAAC,EAAE,CAAC;KACP;CACJ,CAAC"}
@@ -0,0 +1,67 @@
1
+ import { strokeDashTypes } from "@tradingaction/core";
2
+ import * as React from "react";
3
+ export interface RectangleProps {
4
+ readonly topLeftX: any;
5
+ readonly topRightX: any;
6
+ readonly topLeftY: any;
7
+ readonly topRightY: any;
8
+ readonly bottomLeftX: any;
9
+ readonly bottomLeftY: any;
10
+ readonly bottomRightX: any;
11
+ readonly bottomRightY: any;
12
+ readonly interactiveCursorClass?: string;
13
+ readonly strokeStyle: string;
14
+ readonly strokeWidth?: number;
15
+ readonly strokeDasharray?: strokeDashTypes;
16
+ readonly type: "XLINE" | "RAY" | "LINE";
17
+ readonly onEdge1Drag?: any;
18
+ readonly onEdge2Drag?: any;
19
+ readonly onDragStart?: (e: React.MouseEvent, moreProps: any) => void;
20
+ readonly onDrag?: (e: React.MouseEvent, moreProps: any) => void;
21
+ readonly onDragComplete?: (e: React.MouseEvent, moreProps: any) => void;
22
+ readonly onHover?: (e: React.MouseEvent, moreProps: any) => void;
23
+ readonly onUnHover?: (e: React.MouseEvent, moreProps: any) => void;
24
+ readonly onDoubleClickWhenHover?: (e: React.MouseEvent, moreProps: any) => void;
25
+ readonly onClickWhenHover?: (e: React.MouseEvent, moreProps: any) => void;
26
+ readonly onClickOutside?: (e: React.MouseEvent, moreProps: any) => void;
27
+ readonly onContextMenuWhenHover?: (e: React.MouseEvent, moreProps: any) => void;
28
+ readonly defaultClassName?: string;
29
+ readonly r?: number;
30
+ readonly edgeFill?: string;
31
+ readonly edgeStroke?: string;
32
+ readonly edgeStrokeWidth?: number;
33
+ readonly rectangleFill?: string;
34
+ readonly withEdge?: boolean;
35
+ readonly tolerance?: number;
36
+ readonly selected?: boolean;
37
+ }
38
+ export declare class InteractiveRectangle extends React.Component<RectangleProps> {
39
+ static defaultProps: {
40
+ onEdge1Drag: () => void;
41
+ onEdge2Drag: () => void;
42
+ edgeStrokeWidth: number;
43
+ edgeStroke: string;
44
+ edgeFill: string;
45
+ rectangleFill: string;
46
+ r: number;
47
+ withEdge: boolean;
48
+ strokeWidth: number;
49
+ strokeDasharray: string;
50
+ children: () => void;
51
+ tolerance: number;
52
+ selected: boolean;
53
+ };
54
+ render(): JSX.Element;
55
+ private readonly isHover;
56
+ private readonly drawOnCanvas;
57
+ }
58
+ export declare function generateRectangle({ type, start, end, startBottom, endBottom, xScale, yScale }: any): {
59
+ x1: any;
60
+ y1: any;
61
+ x2: any;
62
+ y2: any;
63
+ x1Bottom: any;
64
+ y1Bottom: any;
65
+ x2Bottom: any;
66
+ y2Bottom: any;
67
+ };
@@ -0,0 +1,265 @@
1
+ import { getStrokeDasharrayCanvas, getMouseCanvas, GenericChartComponent, noop, } from "@tradingaction/core";
2
+ import * as React from "react";
3
+ export class InteractiveRectangle extends React.Component {
4
+ constructor() {
5
+ super(...arguments);
6
+ this.isHover = (moreProps) => {
7
+ const { tolerance, onHover } = this.props;
8
+ if (onHover !== undefined) {
9
+ const { topLeftX, topRightX, topLeftY, topRightY, bottomLeftX, bottomLeftY, bottomRightX, bottomRightY, type } = this.props;
10
+ const { mouseXY, xScale } = moreProps;
11
+ const { chartConfig: { yScale }, } = moreProps;
12
+ const hovering = isHovering({
13
+ topLeftX,
14
+ topLeftY,
15
+ topRightX,
16
+ topRightY,
17
+ bottomLeftX, bottomLeftY, bottomRightX, bottomRightY,
18
+ mouseXY,
19
+ type,
20
+ tolerance,
21
+ xScale,
22
+ yScale,
23
+ });
24
+ return hovering;
25
+ }
26
+ return false;
27
+ };
28
+ this.drawOnCanvas = (ctx, moreProps) => {
29
+ const { strokeWidth = InteractiveRectangle.defaultProps.strokeWidth, strokeDasharray, strokeStyle, rectangleFill } = this.props;
30
+ const { x1, y1, // top-left
31
+ x2, y2, // top-right
32
+ x1Bottom, y1Bottom, // bottom-left
33
+ x2Bottom, y2Bottom, // bottom-right
34
+ } = helper(this.props, moreProps);
35
+ // Set canvas styles
36
+ ctx.lineWidth = strokeWidth;
37
+ ctx.strokeStyle = strokeStyle || "transparent"; // Default to no border
38
+ ctx.fillStyle = rectangleFill || "rgba(0, 255, 0, 0.2)"; // Default fill color
39
+ ctx.setLineDash(getStrokeDasharrayCanvas(strokeDasharray));
40
+ // Begin rectangle path
41
+ ctx.beginPath();
42
+ // Start at top-left
43
+ ctx.moveTo(x1, y1);
44
+ // Draw to top-right
45
+ ctx.lineTo(x2, y2);
46
+ // Draw to bottom-right
47
+ ctx.lineTo(x2Bottom, y2Bottom);
48
+ // Draw to bottom-left
49
+ ctx.lineTo(x1Bottom, y1Bottom);
50
+ // Close the path back to top-left
51
+ ctx.closePath();
52
+ // ✅ Fill the rectangle
53
+ ctx.fill();
54
+ // ✅ Stroke the outline (optional)
55
+ if (strokeStyle !== "transparent" && strokeWidth > 0) {
56
+ ctx.stroke();
57
+ }
58
+ };
59
+ }
60
+ render() {
61
+ const { selected, interactiveCursorClass } = this.props;
62
+ const { onDragStart, onDrag, onDragComplete, onHover, onUnHover, onDoubleClickWhenHover, onClickWhenHover, onClickOutside, onContextMenuWhenHover, } = this.props;
63
+ return (React.createElement(GenericChartComponent, { isHover: this.isHover, canvasToDraw: getMouseCanvas, canvasDraw: this.drawOnCanvas, interactiveCursorClass: interactiveCursorClass, selected: selected, onDragStart: onDragStart, onDrag: onDrag, onDragComplete: onDragComplete, onHover: onHover, onUnHover: onUnHover, drawOn: ["mousemove", "pan", "drag"], onDoubleClickWhenHover: onDoubleClickWhenHover, onClickWhenHover: onClickWhenHover, onClickOutside: onClickOutside, onContextMenuWhenHover: onContextMenuWhenHover }));
64
+ }
65
+ }
66
+ InteractiveRectangle.defaultProps = {
67
+ onEdge1Drag: noop,
68
+ onEdge2Drag: noop,
69
+ edgeStrokeWidth: 3,
70
+ edgeStroke: "#000000",
71
+ edgeFill: "#FFFFFF",
72
+ rectangleFill: 'transparent',
73
+ r: 10,
74
+ withEdge: false,
75
+ strokeWidth: 1,
76
+ strokeDasharray: "Solid",
77
+ children: noop,
78
+ tolerance: 7,
79
+ selected: false,
80
+ };
81
+ function isHovering({ topLeftX, topLeftY, topRightX, topRightY, bottomLeftX, bottomLeftY, bottomRightX, bottomRightY, mouseXY, type, tolerance, xScale, yScale }) {
82
+ const line = generateRectangle({
83
+ type,
84
+ start: [topLeftX, topLeftY],
85
+ end: [topRightX, topRightY],
86
+ startBottom: [bottomLeftX, bottomLeftY],
87
+ endBottom: [bottomRightX, bottomRightY],
88
+ xScale,
89
+ yScale,
90
+ });
91
+ const start = [xScale(line.x1), yScale(line.y1)];
92
+ const end = [xScale(line.x2), yScale(line.y2)];
93
+ const m = getSlope(start, end);
94
+ const [mouseX, mouseY] = mouseXY;
95
+ if (m !== undefined) {
96
+ const b = getYIntercept(m, end);
97
+ const y = m * mouseX + b;
98
+ return (mouseY < y + tolerance &&
99
+ mouseY > y - tolerance &&
100
+ mouseX > Math.min(start[0], end[0]) - tolerance &&
101
+ mouseX < Math.max(start[0], end[0]) + tolerance);
102
+ }
103
+ else {
104
+ return (mouseY >= Math.min(start[1], end[1]) &&
105
+ mouseY <= Math.max(start[1], end[1]) &&
106
+ mouseX < start[0] + tolerance &&
107
+ mouseX > start[0] - tolerance);
108
+ }
109
+ }
110
+ function helper(props, moreProps) {
111
+ const { topLeftX, topRightX, topLeftY, topRightY, bottomLeftX, bottomLeftY, bottomRightX, bottomRightY, type } = props;
112
+ const { xScale, chartConfig: { yScale }, } = moreProps;
113
+ const modLine = generateRectangle({
114
+ type,
115
+ start: [topLeftX, topLeftY],
116
+ end: [topRightX, topRightY],
117
+ startBottom: [bottomLeftX, bottomLeftY],
118
+ endBottom: [bottomRightX, bottomRightY],
119
+ xScale,
120
+ yScale,
121
+ });
122
+ const x1 = xScale(modLine.x1);
123
+ const y1 = yScale(modLine.y1);
124
+ const x2 = xScale(modLine.x2);
125
+ const y2 = yScale(modLine.y2);
126
+ const x1Bottom = xScale(modLine.x1Bottom);
127
+ const y1Bottom = yScale(modLine.y1Bottom);
128
+ const x2Bottom = xScale(modLine.x2Bottom);
129
+ const y2Bottom = yScale(modLine.y2Bottom);
130
+ return {
131
+ x1,
132
+ y1,
133
+ x2,
134
+ y2,
135
+ x1Bottom,
136
+ y1Bottom,
137
+ x2Bottom,
138
+ y2Bottom,
139
+ };
140
+ }
141
+ function getSlope(start, end) {
142
+ const m /* slope */ = end[0] === start[0] ? undefined : (end[1] - start[1]) / (end[0] - start[0]);
143
+ return m;
144
+ }
145
+ function getYIntercept(m, end) {
146
+ const b /* y intercept */ = -1 * m * end[0] + end[1];
147
+ return b;
148
+ }
149
+ export function generateRectangle({ type, start, end, startBottom, endBottom, xScale, yScale }) {
150
+ const m /* slope */ = getSlope(start, end);
151
+ const b /* y intercept */ = getYIntercept(m, start);
152
+ switch (type) {
153
+ case "XLINE":
154
+ return getXLineCoordinates({
155
+ start,
156
+ end,
157
+ startBottom, endBottom,
158
+ xScale,
159
+ yScale,
160
+ m,
161
+ b,
162
+ });
163
+ case "RAY":
164
+ return getRayCoordinates({
165
+ start,
166
+ end,
167
+ startBottom, endBottom,
168
+ xScale,
169
+ yScale,
170
+ m,
171
+ b,
172
+ });
173
+ default:
174
+ case "LINE":
175
+ return getLineCoordinates({
176
+ start,
177
+ end,
178
+ startBottom, endBottom,
179
+ });
180
+ }
181
+ }
182
+ function getXLineCoordinates({ start, end, startBottom, endBottom, xScale, yScale, m, b }) {
183
+ const [xBegin, xFinish] = xScale.domain();
184
+ const [yBegin, yFinish] = yScale.domain();
185
+ if (end[0] === start[0]) {
186
+ return {
187
+ x1: end[0],
188
+ y1: yBegin,
189
+ x2: end[0],
190
+ y2: yFinish,
191
+ x1Bottom: 0,
192
+ y1Bottom: 0,
193
+ x2Bottom: 0,
194
+ y2Bottom: 0,
195
+ };
196
+ }
197
+ const [x1, x2] = end[0] > start[0] ? [xBegin, xFinish] : [xFinish, xBegin];
198
+ return {
199
+ x1,
200
+ y1: m * x1 + b,
201
+ x2,
202
+ y2: m * x2 + b,
203
+ x1Bottom: 0,
204
+ y1Bottom: 0,
205
+ x2Bottom: 0,
206
+ y2Bottom: 0,
207
+ };
208
+ }
209
+ function getRayCoordinates({ start, end, startBottom, endBottom, xScale, yScale, m, b }) {
210
+ const [xBegin, xFinish] = xScale.domain();
211
+ const [yBegin, yFinish] = yScale.domain();
212
+ const x1 = start[0];
213
+ if (end[0] === start[0]) {
214
+ return {
215
+ x1,
216
+ y1: start[1],
217
+ x2: x1,
218
+ y2: end[1] > start[1] ? yFinish : yBegin,
219
+ x1Bottom: 0,
220
+ y1Bottom: 0,
221
+ x2Bottom: 0,
222
+ y2Bottom: 0,
223
+ };
224
+ }
225
+ const x2 = end[0] > start[0] ? xFinish : xBegin;
226
+ return {
227
+ x1,
228
+ y1: m * x1 + b,
229
+ x2,
230
+ y2: m * x2 + b,
231
+ x1Bottom: 0,
232
+ y1Bottom: 0,
233
+ x2Bottom: 0,
234
+ y2Bottom: 0,
235
+ };
236
+ }
237
+ function getLineCoordinates({ start, end, startBottom, endBottom, }) {
238
+ const [x1, y1] = start;
239
+ const [x2, y2] = end;
240
+ const [x1Bottom, y1Bottom] = startBottom;
241
+ const [x2Bottom, y2Bottom] = endBottom;
242
+ if (end[0] === start[0] || endBottom[0] === startBottom[0]) {
243
+ return {
244
+ x1,
245
+ y1: start[1],
246
+ x2: x1,
247
+ y2: end[1],
248
+ x1Bottom,
249
+ y1Bottom: startBottom[1],
250
+ x2Bottom,
251
+ y2Bottom: endBottom[1],
252
+ };
253
+ }
254
+ return {
255
+ x1,
256
+ y1,
257
+ x2,
258
+ y2,
259
+ x1Bottom,
260
+ y1Bottom,
261
+ x2Bottom,
262
+ y2Bottom,
263
+ };
264
+ }
265
+ //# sourceMappingURL=InteractiveRectangle.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"InteractiveRectangle.js","sourceRoot":"","sources":["../../src/components/InteractiveRectangle.tsx"],"names":[],"mappings":"AAAA,OAAO,EACH,wBAAwB,EACxB,cAAc,EACd,qBAAqB,EACrB,IAAI,GAEP,MAAM,qBAAqB,CAAC;AAC7B,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AA2C/B,MAAM,OAAO,oBAAqB,SAAQ,KAAK,CAAC,SAAyB;IAAzE;;QAoDqB,YAAO,GAAG,CAAC,SAAc,EAAE,EAAE;YAC1C,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC;YAE1C,IAAI,OAAO,KAAK,SAAS,EAAE;gBACvB,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAE,QAAQ,EAAE,SAAS,EAC5C,WAAW,EAAE,WAAW,EAAE,YAAY,EAAE,YAAY,EACpD,IAAI,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC;gBACxB,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,SAAS,CAAC;gBACtC,MAAM,EACF,WAAW,EAAE,EAAE,MAAM,EAAE,GAC1B,GAAG,SAAS,CAAC;gBAEd,MAAM,QAAQ,GAAG,UAAU,CAAC;oBACxB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QAAQ;QACR,QAAQ;QACR,QAAQ;QACR,QAAQ;KACX,CAAC;AACN,CAAC"}
@@ -4,6 +4,7 @@ export * from "./ClickableShape";
4
4
  export * from "./GannFan";
5
5
  export * from "./HoverTextNearMouse";
6
6
  export * from "./InteractiveStraightLine";
7
+ export * from "./InteractiveRectangle";
7
8
  export * from "./InteractiveText";
8
9
  export * from "./InteractiveYCoordinate";
9
10
  export * from "./LinearRegressionChannelWithArea";
@@ -4,6 +4,7 @@ export * from "./ClickableShape";
4
4
  export * from "./GannFan";
5
5
  export * from "./HoverTextNearMouse";
6
6
  export * from "./InteractiveStraightLine";
7
+ export * from "./InteractiveRectangle";
7
8
  export * from "./InteractiveText";
8
9
  export * from "./InteractiveYCoordinate";
9
10
  export * from "./LinearRegressionChannelWithArea";
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC;AAClC,cAAc,kBAAkB,CAAC;AACjC,cAAc,WAAW,CAAC;AAC1B,cAAc,sBAAsB,CAAC;AACrC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,mBAAmB,CAAC;AAClC,cAAc,0BAA0B,CAAC;AACzC,cAAc,mCAAmC,CAAC;AAClD,cAAc,0BAA0B,CAAC;AACzC,cAAc,QAAQ,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC;AAClC,cAAc,kBAAkB,CAAC;AACjC,cAAc,WAAW,CAAC;AAC1B,cAAc,sBAAsB,CAAC;AACrC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,wBAAwB,CAAC;AACvC,cAAc,mBAAmB,CAAC;AAClC,cAAc,0BAA0B,CAAC;AACzC,cAAc,mCAAmC,CAAC;AAClD,cAAc,0BAA0B,CAAC;AACzC,cAAc,QAAQ,CAAC"}
package/lib/index.d.ts CHANGED
@@ -10,3 +10,4 @@ export { InteractiveYCoordinate } from "./InteractiveYCoordinate";
10
10
  export { DrawingObjectSelector } from "./DrawingObjectSelector";
11
11
  export { ZoomButtons } from "./ZoomButtons";
12
12
  export * from "./utils";
13
+ export { Rectangle } from "./Rectangle";
package/lib/index.js CHANGED
@@ -10,4 +10,5 @@ export { InteractiveYCoordinate } from "./InteractiveYCoordinate";
10
10
  export { DrawingObjectSelector } from "./DrawingObjectSelector";
11
11
  export { ZoomButtons } from "./ZoomButtons";
12
12
  export * from "./utils";
13
+ export { Rectangle } from "./Rectangle";
13
14
  //# sourceMappingURL=index.js.map
package/lib/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAC;AACtE,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,cAAc,SAAS,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,oBA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