Lemmings Forums

Lix => Lix Main => Topic started by: Silken Healer on December 15, 2024, 08:56:22 PM

Title: Fixed: 2-bar splat ruler still snapped even when snap distance option was 0
Post by: Silken Healer on December 15, 2024, 08:56:22 PM
if you select the 2-bar splat ruler and then set the snap distance to 0 it still snaps
Title: Re: Lix splat ruler still snaps even when the snap distance is 0 on 2 bar
Post by: Simon on December 15, 2024, 09:03:26 PM
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
Title: Re: Lix splat ruler still snaps even when the snap distance is 0 on 2 bar
Post by: Simon on December 18, 2024, 06:13:33 AM
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
Title: Re: Lix splat ruler still snaps even when the snap distance is 0 on 2 bar
Post by: Simon on December 19, 2024, 06:00:07 AM
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