mirror of
https://github.com/webstudio-is/webstudio.git
synced 2026-11-09 14:03:33 +09:00
better logic
This commit is contained in:
1 parent
fe3cd292f0
commit
d5007343e5
1 file changed
+4
-4
+4
-4
@@ -130,13 +130,13 @@ const useScrub = (options: {
|
||||
}) => {
|
||||
const inputRef = useRef<HTMLInputElement | null>(null);
|
||||
const optionsRef = useRef(options);
|
||||
const hasScrubbed = useRef(false);
|
||||
const shouldSelect = useRef(true);
|
||||
|
||||
const handlePointerUp = () => {
|
||||
if (hasScrubbed.current === false) {
|
||||
if (shouldSelect.current) {
|
||||
inputRef.current?.select();
|
||||
}
|
||||
hasScrubbed.current = false;
|
||||
shouldSelect.current = true;
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
@@ -150,7 +150,7 @@ const useScrub = (options: {
|
||||
const scrub = numericScrubControl(inputRef.current, {
|
||||
initialValue: value.value,
|
||||
onValueInput(event) {
|
||||
hasScrubbed.current = true;
|
||||
shouldSelect.current = false;
|
||||
onChange({
|
||||
...value,
|
||||
value: event.value,
|
||||
|
||||
Reference in new issue
Block a user