@rfkit/charts 1.3.7 → 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.
Files changed (2) hide show
  1. package/index.js +20 -6
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -7183,6 +7183,7 @@ const Gauge_Gauge = ({ onChange })=>{
7183
7183
  chart?.reset();
7184
7184
  return true;
7185
7185
  }
7186
+ if (d.pstype === constants_PSType.Resize) return false;
7186
7187
  chart?.updateSeries(d);
7187
7188
  return true;
7188
7189
  }, [
@@ -8974,6 +8975,24 @@ const useDragSelect = (config = {})=>{
8974
8975
  });
8975
8976
  const rectRef = (0, __WEBPACK_EXTERNAL_MODULE_react__.useRef)(rect);
8976
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
+ ]);
8977
8996
  const handleMouseDown = (0, __WEBPACK_EXTERNAL_MODULE_react__.useCallback)((e, type)=>{
8978
8997
  if (!enabled) return;
8979
8998
  e.preventDefault();
@@ -9418,12 +9437,7 @@ const Slider = ({ id })=>{
9418
9437
  if (!canSlider) return null;
9419
9438
  return /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsxs)(components_DragSelectBox, {
9420
9439
  enabled: canSlider,
9421
- defaultRect: {
9422
- position: DEFAULT_POSITION,
9423
- height: Math.min(DEFAULT_HEIGHT, MAX_SIZE),
9424
- leftPosition: 0,
9425
- width: 100
9426
- },
9440
+ defaultRect: currentRect,
9427
9441
  minSize: MIN_SIZE,
9428
9442
  maxSize: MAX_SIZE,
9429
9443
  snapThreshold: SNAP_THRESHOLD,
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.7",
8
+ "version": "1.3.9",
9
9
  "private": false
10
10
  }