Fixed: 2-bar splat ruler still snapped even when snap distance option was 0

Started by Silken Healer, December 15, 2024, 08:56:22 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Silken Healer

if you select the 2-bar splat ruler and then set the snap distance to 0 it still snaps

Simon

Right, this is an ancient leftover from when I hardcoded the snap distance.

I had hardcoded smaller snap distance for the 2-bar ruler than for the 3-bar rulers. Then I introduced the option for the snap distance, and defaulted it to the large snap distance (that previously was only for the 3-bar ruler). I didn't want to inflict the massive snap on the 2-bar-ruler users.

But it makes more sense to have everybody rely on the option. If some people have to reconfigure once, so be it. Better to reconfigure once than to have a bug like this. The bug outright prevents you from disabling snap on the 2-bar ruler.

-- Simon

Simon

The obvious fix is a one-liner.

This will produce huge snapping for everybody who has selected the 2-bar ruler. Reason: Those users won't have reconfigured the default of 126 pixels of snap distance. They have relied on how the bug ignores that and turns it into 10. The bugfix kicks it up to 126 for them.

Wondering if it's worth making a separate option for 2-bar ruler snap distance, and default that to 10.

Wondering if 126 is bad default for the 3-bar ruler, and if it should be 10, too. I like the 126, but who knows who else. Choosing my preferences as defaults for others, hmm, often it was the right choice; here, I'm not completely sure.

-- Simon

Simon

I'm considering the following hack.

The three-bar rulers interpret the splat distance option as pixels verbatim. I.e., when the option is set to n, the snap distance from the center is n pixels.

The two-bar ruler interprets the snap distance option as follows. Define

f: ℕ → ℕ with
f(n) = n ÷ 12 for n ≤ 126, round down after dividing,
f(n) = n − 116 for n ≥ 126.

This is chosen so that f(126) = 10, and that the two branches of f agree at 126, and that f is weakly monotonous (i.e., bigger input produces non-smaller output).

And when the option is set to n, the snap distance of the two-bar ruler is f(n) pixels from both ends of the ruler. This produces the existing behavior for the default option value of 126. You'll get no snap at 0, and you'll still get unreasonably wild snap at bigger values.

We would then accept that the exact value loses all intuitive meaning, and that f is not linear. In particular, it has the sharp bent at 126, exactly at the option's default value. If we don't like this, we can introduce a second snap distance option option for the two-bar ruler in the future still.

-- Simon