Remove leftRef now that forceUpdate made it redundant
Resize handler uses functional setLeft (no direct left read). onPointerDown uses left from render closure directly. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
bccac386a7
commit
d56e94ad09
1 changed files with 1 additions and 4 deletions
|
|
@ -55,9 +55,6 @@ function Testimonials() {
|
||||||
setLeft(function (l) { return Math.max(-maxL, l - STEP); });
|
setLeft(function (l) { return Math.max(-maxL, l - STEP); });
|
||||||
};
|
};
|
||||||
|
|
||||||
var leftRef = useRef(left);
|
|
||||||
leftRef.current = left;
|
|
||||||
|
|
||||||
useEffect(function () {
|
useEffect(function () {
|
||||||
var timer;
|
var timer;
|
||||||
function onResize() {
|
function onResize() {
|
||||||
|
|
@ -78,7 +75,7 @@ function Testimonials() {
|
||||||
var drag = useRef(null); // null when idle, {x, left} when dragging
|
var drag = useRef(null); // null when idle, {x, left} when dragging
|
||||||
|
|
||||||
var onPointerDown = function (e) {
|
var onPointerDown = function (e) {
|
||||||
drag.current = { x: e.clientX, left: leftRef.current };
|
drag.current = { x: e.clientX, left: left };
|
||||||
trackRef.current.style.transition = "none";
|
trackRef.current.style.transition = "none";
|
||||||
e.currentTarget.setPointerCapture(e.pointerId);
|
e.currentTarget.setPointerCapture(e.pointerId);
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue