@rfkit/charts 1.3.8 → 1.3.10

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.
Files changed (2) hide show
  1. package/index.js +21 -8
  2. 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,
@@ -9433,8 +9446,8 @@ const Slider = ({ id })=>{
9433
9446
  zIndex: 6,
9434
9447
  showBoundaryLines: true,
9435
9448
  labels: {
9436
- left: `${info?.startFrequencyFormat}${unit}`,
9437
- right: `${info?.endFrequencyFormat}${unit}`,
9449
+ left: info?.startFrequencyFormat ? `${info.startFrequencyFormat}${unit}` : '',
9450
+ right: info?.endFrequencyFormat ? `${info.endFrequencyFormat}${unit}` : '',
9438
9451
  top: info?.endTimestamp,
9439
9452
  bottom: info?.startTimestamp
9440
9453
  },
package/package.json CHANGED
@@ -5,6 +5,6 @@
5
5
  "types": "index.d.ts",
6
6
  "author": "Hxgh",
7
7
  "license": "MIT",
8
- "version": "1.3.8",
8
+ "version": "1.3.10",
9
9
  "private": false
10
10
  }