@newtonedev/components 0.1.11 → 0.1.12
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Slider.d.ts","sourceRoot":"","sources":["../../../../src/composites/range-inputs/Slider/Slider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAIlD,wBAAgB,MAAM,CAAC,EACrB,KAAK,EACL,aAAa,EACb,GAAO,EACP,GAAS,EACT,IAAQ,EACR,KAAK,EACL,SAAiB,EACjB,aAAqB,EACrB,QAAgB,EAChB,KAAK,GACN,EAAE,WAAW,
|
|
1
|
+
{"version":3,"file":"Slider.d.ts","sourceRoot":"","sources":["../../../../src/composites/range-inputs/Slider/Slider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAIlD,wBAAgB,MAAM,CAAC,EACrB,KAAK,EACL,aAAa,EACb,GAAO,EACP,GAAS,EACT,IAAQ,EACR,KAAK,EACL,SAAiB,EACjB,aAAqB,EACrB,QAAgB,EAChB,KAAK,GACN,EAAE,WAAW,qBAyHb"}
|
package/dist/index.cjs
CHANGED
|
@@ -2541,7 +2541,19 @@ function Slider({
|
|
|
2541
2541
|
const ratio = max > min ? (value - min) / (max - min) : 0;
|
|
2542
2542
|
const usableWidth = Math.max(0, layoutWidth - THUMB_SIZE2);
|
|
2543
2543
|
const thumbLeft = ratio * usableWidth;
|
|
2544
|
-
const
|
|
2544
|
+
const isCenterOrigin = min < 0 && max > 0;
|
|
2545
|
+
let fillLeft;
|
|
2546
|
+
let fillWidth;
|
|
2547
|
+
if (isCenterOrigin) {
|
|
2548
|
+
const centerRatio = (0 - min) / (max - min);
|
|
2549
|
+
const centerX = centerRatio * usableWidth + THUMB_SIZE2 / 2;
|
|
2550
|
+
const thumbCenterX = thumbLeft + THUMB_SIZE2 / 2;
|
|
2551
|
+
fillLeft = Math.min(centerX, thumbCenterX);
|
|
2552
|
+
fillWidth = Math.abs(thumbCenterX - centerX);
|
|
2553
|
+
} else {
|
|
2554
|
+
fillLeft = 0;
|
|
2555
|
+
fillWidth = thumbLeft + THUMB_SIZE2 / 2;
|
|
2556
|
+
}
|
|
2545
2557
|
const handleValueTextSubmit = React14__default.default.useCallback(
|
|
2546
2558
|
(text) => {
|
|
2547
2559
|
const raw = Number(text);
|
|
@@ -2584,7 +2596,7 @@ function Slider({
|
|
|
2584
2596
|
...panResponder.panHandlers
|
|
2585
2597
|
},
|
|
2586
2598
|
/* @__PURE__ */ React14__default.default.createElement(reactNative.View, { style: styles.trackRail }),
|
|
2587
|
-
/* @__PURE__ */ React14__default.default.createElement(reactNative.View, { style: [styles.trackFill, { width: fillWidth }] }),
|
|
2599
|
+
/* @__PURE__ */ React14__default.default.createElement(reactNative.View, { style: [styles.trackFill, { left: fillLeft, width: fillWidth }] }),
|
|
2588
2600
|
/* @__PURE__ */ React14__default.default.createElement(reactNative.View, { style: [styles.thumb, { left: thumbLeft }] })
|
|
2589
2601
|
));
|
|
2590
2602
|
}
|