How to receive only horizontal change values of ```.mouseMoveAction``` by pressing a modifier in a View instance?

Dear users and developers,

What is the best way to receive only horizontal change values of .mouseMoveAction by pressing a modifier in a View?

I have tried to build a Theremin-like instrument with a keyboard-like GUI in the following code. The GUI is only for getting precise pitches, but sometimes it is not easy because mouse point movement results are not always in the intended positions. Thus, I tried to constrain to receive only horizontal change of mouse point movement. However, I am not sure my method is good enough. So, what do you do for this kind of feature when programmers do it?
Other perspectives on the code block are also welcome. The code belows seems not to be optimised and is somewhat unnecessarily long:

(
var win, bnds, width, height, view, synth, xShift, xTemp;
bnds= Window.screenBounds;
width = bnds.width/8;
height = bnds.height;
win = Window("Control", Rect(width * 3, 0, width, bnds.height), border: false);
win
.background_(Color.white)
.onClose_{ synth.isRunning.if { synth.free } }
.acceptsMouseOver_(true)
.front;
CmdPeriod.doOnce{ win.close };
view = View(win, width@height);
view
.mouseOverAction_{ arg ... args;
	xShift = (args[3] != 131072).if {
		xTemp = args[2]
	} {
		xTemp
	};
	synth.set(
		\freqCoarse, (args[3] != 131072).if
		{ args[2].linlin(0, height-2, 53 + (12 * 4), 53).round(1).midicps
		}{
			xShift.linlin(0, height-2, 53 + (12 * 4), 53).round(1).midicps
		},
		//\freqMicro, 0,
		//\mul, args[1].lincurve(0, width-2, -48.dbamp, -18.dbamp, 2)
	)
}
.mouseMoveAction_{ arg ... args;
	xShift = (args[3] != 131072).if {
		xTemp = args[2]
	} {
		xTemp
	};
	synth.set(
		\freqCoarse, (args[3] != 131072).if
		{ args[2].linlin(0, height-2, 53 + (12 * 4), 53).round(1).midicps
		}{
			xShift.linlin(0, height-2, 53 + (12 * 4), 53).round(1).midicps
		},
		//\freqMicro, args[2].linlin(0, height-2, 53 + (12 * 4), 53).midicps,
		\mul, args[1].lincurve(0, width-2, -51.dbamp, -21.dbamp, 2)
	)
}
.mouseDownAction_{ arg ... args;
	xShift = (args[3] != 131072).if {
		xTemp = args[2]
	} {
		xTemp
	};
	synth.set(\gate, 1,
		//\freqCoarse, (args[3] != 131072).if
		//{ args[2].linlin(0, height-2, 53 + (12 * 4), 53).round(1).midicps
		//}{
		//xShift.linlin(0, height-2, 53 + (12 * 4), 53).round(1).midicps
		//},
		//\freqMicro, 0,
		\mul, args[1].lincurve(0, width-2, -48.dbamp, -18.dbamp, 2)
	)
}
.mouseUpAction_{ synth.set(\gate, 0) };

win.drawFunc = {
	48.do { |i|
		([0, 2, 4, 5, 7, 9, 11].includes(i % 12)).if {
			Pen.strokeColor = Color.grey;
			Pen.fillColor = Color.white;
			Pen.addRect(Rect(0, height * i / 48 + (height / 96), width, height / 48 + (height / 96)));
			Pen.fillStroke;
		} {
			//Pen.color = Color.black;
			Pen.addRect(Rect(0, height * i / 48 + (height / 96), width, height / 48 + (height / 96)));
			//Pen.fillAxialGradient(0 @ (height * i / 48 + (height / 96)), width * 5 / 8 @ (height * (i + 1)/ 48 + (height / 96)), Color.grey(0), Color.grey(1));
			Pen.fillRadialGradient((width / 2) @ (height * i / 48), (width / 2) @ (height * i / 48), 0, width, Color.grey(0), Color.grey(1));
		};
		Pen.strokeColor = Color.grey;
		Pen.line(width / 8 * 3 @ (i / 48 * height) , width / 8 * 5 @ (i / 48 * height));
		Pen.fillStroke;
		Pen.fill
	};
};

s.waitForBoot{
	synth = { |gate = 0, freqCoarse = 440, freqMicro = 0, mul = 0|
		var freq, env, vibSpeed, vibDepth, vibAmp, vibFreq, sig;
		freq = freqCoarse + freqMicro; // MouseY.kr(220, 220 * (2 ** 4), 1)
		env = Env.asr(0.05, 1, 1).kr(gate: gate);
		vibSpeed = Env.pairs([[0, 4], [0.1, 4], [1, 7]], \lin).ar(gate: gate);
		vibDepth = Env.pairs([[0, 1], [0.1, 1], [2, 0.5]], \lin).ar(gate: gate);
		vibFreq = SinOsc.kr(vibSpeed, mul: vibDepth).atan.range(-0.25 * mul, 0.25 * mul).midiratio;
		vibAmp = SinOsc.kr(vibSpeed, mul: vibDepth).atan.range(-9.dbamp - mul, 0.dbamp);
		sig = LFTri.ar(freq.lag(0.4) * vibFreq)//SinOsc.ar( freq )
		* mul.lag(0.02)
		//* MouseButton.kr(0, 1, 0.3)
		//* MouseX.kr(0, 0.1)
		* AmpCompA.kr( freq )
		* env
		* vibAmp;
		GVerb.ar(
			sig,
			100, 0.8, 0.5, 0.5, 15, -9.dbamp, -12.dbamp, -96.dbamp
		)
	}.play.register
}
)