@easyv/charts 1.6.7 → 1.6.9
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/lib/components/Band.js
CHANGED
|
@@ -102,18 +102,22 @@ var Chart = /*#__PURE__*/(0, _react.memo)(function (_ref) {
|
|
|
102
102
|
var controlBarWidth = 0;
|
|
103
103
|
var dragPercent = 1;
|
|
104
104
|
var controlHeight = 0;
|
|
105
|
+
var controlX = 0;
|
|
105
106
|
|
|
106
107
|
if (control) {
|
|
107
108
|
var _height = control.height,
|
|
108
109
|
_control$margin = control.margin,
|
|
109
110
|
left = _control$margin.left,
|
|
110
111
|
right = _control$margin.right,
|
|
111
|
-
|
|
112
|
+
_control$drag = control.drag,
|
|
113
|
+
start = _control$drag.start,
|
|
114
|
+
dragWidth = _control$drag.width;
|
|
112
115
|
isControl = true;
|
|
113
116
|
controlHeight = _height;
|
|
114
117
|
controlWidth = width - left - right;
|
|
115
118
|
dragPercent = dragWidth / 100;
|
|
116
119
|
controlBarWidth = controlWidth * dragPercent;
|
|
120
|
+
controlX = (controlWidth - controlBarWidth) * start / 100;
|
|
117
121
|
}
|
|
118
122
|
|
|
119
123
|
var _useState3 = (0, _react.useState)({
|
|
@@ -122,7 +126,7 @@ var Chart = /*#__PURE__*/(0, _react.memo)(function (_ref) {
|
|
|
122
126
|
cHeight: controlHeight,
|
|
123
127
|
cBarWidth: controlBarWidth,
|
|
124
128
|
cPercent: dragPercent,
|
|
125
|
-
cBarX:
|
|
129
|
+
cBarX: controlX
|
|
126
130
|
}),
|
|
127
131
|
_useState4 = (0, _slicedToArray2["default"])(_useState3, 2),
|
|
128
132
|
controlInfo = _useState4[0],
|
|
@@ -141,7 +145,7 @@ var Chart = /*#__PURE__*/(0, _react.memo)(function (_ref) {
|
|
|
141
145
|
cHeight: controlHeight,
|
|
142
146
|
cBarWidth: controlBarWidth,
|
|
143
147
|
cPercent: dragPercent,
|
|
144
|
-
cBarX:
|
|
148
|
+
cBarX: controlX
|
|
145
149
|
});
|
|
146
150
|
}, [JSON.stringify(control)]);
|
|
147
151
|
var svg = (0, _react.useRef)();
|
package/lib/utils/index.js
CHANGED
package/package.json
CHANGED
package/src/components/Band.tsx
CHANGED
|
@@ -83,17 +83,19 @@ const Chart = memo(
|
|
|
83
83
|
let controlBarWidth = 0;
|
|
84
84
|
let dragPercent = 1;
|
|
85
85
|
let controlHeight = 0;
|
|
86
|
+
let controlX = 0;
|
|
86
87
|
if(control){
|
|
87
|
-
const { height, margin:{ left, right }, drag:{ width:dragWidth } } = control;
|
|
88
|
+
const { height, margin:{ left, right }, drag:{ start, width:dragWidth } } = control;
|
|
88
89
|
isControl = true;
|
|
89
90
|
controlHeight = height;
|
|
90
91
|
controlWidth = width-left-right;
|
|
91
92
|
dragPercent = dragWidth/100;
|
|
92
93
|
controlBarWidth = controlWidth*dragPercent;
|
|
94
|
+
controlX = (controlWidth-controlBarWidth)*start/100;
|
|
93
95
|
}
|
|
94
|
-
const [controlInfo, setControlInfo] = useState({ isC:isControl, cWidth:controlWidth, cHeight:controlHeight, cBarWidth:controlBarWidth, cPercent:dragPercent, cBarX:
|
|
96
|
+
const [controlInfo, setControlInfo] = useState({ isC:isControl, cWidth:controlWidth, cHeight:controlHeight, cBarWidth:controlBarWidth, cPercent:dragPercent, cBarX:controlX });
|
|
95
97
|
const { cWidth, cHeight, cBarWidth, cPercent, cBarX } = controlInfo;
|
|
96
|
-
yLineRange -=
|
|
98
|
+
yLineRange -= cHeight;
|
|
97
99
|
useEffect(()=>{
|
|
98
100
|
setControlInfo({
|
|
99
101
|
isC:isControl,
|
|
@@ -101,7 +103,7 @@ const Chart = memo(
|
|
|
101
103
|
cHeight:controlHeight,
|
|
102
104
|
cBarWidth:controlBarWidth,
|
|
103
105
|
cPercent:dragPercent,
|
|
104
|
-
cBarX:
|
|
106
|
+
cBarX:controlX
|
|
105
107
|
});
|
|
106
108
|
},[JSON.stringify(control)]);
|
|
107
109
|
|