1 /// Implementation of `PreferenceIO`, providing values that depend on the system and the user.2 modulefluid.preference_chain;
3 4 importcore.time;
5 6 importfluid.node;
7 importfluid.types;
8 importfluid.utils;
9 importfluid.node_chain;
10 11 importfluid.io.preference;
12 13 @safe:
14 15 aliaspreferenceChain = nodeBuilder!PreferenceChain;
16 17 /// PreferenceChain implements `PreferenceIO`, accessing crucial, low-level user preferences that affect their usage18 /// of Fluid programs.19 ///20 /// Currently, `PreferenceChain` does *not* communicate with the system, and instead assumes a default value of 40021 /// milliseconds for the double-click interval, and 6 pixels for the maximum double click distance. Communicating22 /// with the system will be enabled in a future update through a `version` flag. See23 /// [issue #295](https://git.samerion.com/Samerion/Fluid/issues/295) for more details.24 classPreferenceChain : NodeChain, PreferenceIO {
25 26 mixincontrolIO;
27 28 this(Nodenext = null) {
29 super(next);
30 }
31 32 overridevoidbeforeResize(Vector2) {
33 startIO();
34 }
35 36 overridevoidafterResize(Vector2) {
37 stopIO();
38 }
39 40 overrideDurationdoubleClickInterval() constnothrow {
41 return400.msecs;
42 }
43 44 overridefloatmaximumDoubleClickDistance() constnothrow {
45 return6;
46 }
47 48 overrideVector2scrollSpeed() constnothrow {
49 50 // Normalize the value: Linux and Windows provide trinary values (-1, 0, 1) but macOS gives analog that often51 // goes far higher than that. This is currently a rough guess of the proportions based on feeling.52 // See53 version (OSX)
54 returnVector2(65 / 4, 65 / 4);
55 else56 returnVector2(65, 65);
57 58 }
59 60 }