where a plugin can contrôle mouse speed/frequency ?

This issue has been tracked since 2023-02-04.

sup friend, on my side i contrôle mouse frequency update like this for some of my inputs.

	style={{ cursor: 'w-resize' }}
	onPointerDown={(e) => {
		const { min, max, step, speed } = metas ?? {}; // metas options of the input

		const sdx = (e.clientX - e.clientY);
		const pointermove = (e: PointerEvent) => {
			const dx = (e.clientX - e.clientY);
			let v = value + ((dx - sdx) * (speed ?? 0.5)); // speed of mouse 🟢
			if (step) v = Math.round(v / step) * step; // apply step if need 
			if (min !== undefined) v = Math.max(min, v); // apply clamping
			if (max !== undefined) v = Math.min(max, v);
			v = +v.toFixed(3);
		document.addEventListener('pointermove', pointermove);
		document.addEventListener('pointerup', (e) => document.removeEventListener('pointermove', pointermove), { once: true });

did you or can you expose a way to allow user hack mouse speed/frequency ?
1 pixel update is too face for lot of case.
can you guide how archive this with your api ?
related to this issu, thanks

expected behavior

cocopon wrote this answer on 2023-02-04

You mean you want to change a scale for dragging, right?

In the current spec it's estimated from its initial value or step option.

export function getSuitableDraggingScale(
constraint: Constraint<number> | undefined,
rawValue: number,
): number {
const sc = constraint && findConstraint(constraint, StepConstraint);
const base = Math.abs(sc?.step ?? rawValue);
return base === 0 ? 0.1 : Math.pow(10, Math.floor(Math.log10(base)) - 1);

djmisterjon wrote this answer on 2023-02-05


cocopon wrote this answer on 2023-02-05

Wait wait, I'm positive to add an option for changing the scale.

djmisterjon wrote this answer on 2023-02-05

Wait wait, I'm positive to add an option for changing the scale.

ho oups, oki i will try done a monkey patch for my app and keep a eye on your commit 😊

More Details About Repo
Owner Name cocopon
Repo Name tweakpane
Full Name cocopon/tweakpane
Language TypeScript
Created Date 2016-05-10
Updated Date 2023-03-17
Star Count 2603
Watcher Count 19
Fork Count 71
Issue Count 11


Issue Title Created Date Updated Date