@rfkit/charts 1.3.8 → 1.3.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/index.js +19 -6
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -8975,6 +8975,24 @@ const useDragSelect = (config = {})=>{
|
|
|
8975
8975
|
});
|
|
8976
8976
|
const rectRef = (0, __WEBPACK_EXTERNAL_MODULE_react__.useRef)(rect);
|
|
8977
8977
|
rectRef.current = rect;
|
|
8978
|
+
(0, __WEBPACK_EXTERNAL_MODULE_react__.useEffect)(()=>{
|
|
8979
|
+
if (!isDragging && defaultRect) {
|
|
8980
|
+
const newRect = {
|
|
8981
|
+
position: defaultRect.position ?? rect.position,
|
|
8982
|
+
height: void 0 !== defaultRect.height ? Math.min(defaultRect.height, maxSize) : rect.height,
|
|
8983
|
+
leftPosition: defaultRect.leftPosition ?? rect.leftPosition,
|
|
8984
|
+
width: defaultRect.width ?? rect.width
|
|
8985
|
+
};
|
|
8986
|
+
if (Math.abs(newRect.position - rect.position) > 0.01 || Math.abs(newRect.height - rect.height) > 0.01 || Math.abs(newRect.leftPosition - rect.leftPosition) > 0.01 || Math.abs(newRect.width - rect.width) > 0.01) setRect(newRect);
|
|
8987
|
+
}
|
|
8988
|
+
}, [
|
|
8989
|
+
defaultRect?.position,
|
|
8990
|
+
defaultRect?.height,
|
|
8991
|
+
defaultRect?.leftPosition,
|
|
8992
|
+
defaultRect?.width,
|
|
8993
|
+
isDragging,
|
|
8994
|
+
maxSize
|
|
8995
|
+
]);
|
|
8978
8996
|
const handleMouseDown = (0, __WEBPACK_EXTERNAL_MODULE_react__.useCallback)((e, type)=>{
|
|
8979
8997
|
if (!enabled) return;
|
|
8980
8998
|
e.preventDefault();
|
|
@@ -9419,12 +9437,7 @@ const Slider = ({ id })=>{
|
|
|
9419
9437
|
if (!canSlider) return null;
|
|
9420
9438
|
return /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsxs)(components_DragSelectBox, {
|
|
9421
9439
|
enabled: canSlider,
|
|
9422
|
-
defaultRect:
|
|
9423
|
-
position: DEFAULT_POSITION,
|
|
9424
|
-
height: Math.min(DEFAULT_HEIGHT, MAX_SIZE),
|
|
9425
|
-
leftPosition: 0,
|
|
9426
|
-
width: 100
|
|
9427
|
-
},
|
|
9440
|
+
defaultRect: currentRect,
|
|
9428
9441
|
minSize: MIN_SIZE,
|
|
9429
9442
|
maxSize: MAX_SIZE,
|
|
9430
9443
|
snapThreshold: SNAP_THRESHOLD,
|