Closed ericfont closed 2 years ago
the workaround I discovered is to set the minimum slider value to 1n ohms.
And I think I know why this glitch happens... The reason is because there is probably some internal condition in circuit js that prohibits resistors from having 0 ohms, cause it seems I am simply not able to set a regular resistor to 0 using the popup set value. However, circuit js does allow me to set a minimum value of 0 for a slider for a resistor. And so when I try to move my slider to the minimum value, the value that ends up getting assigned to the resistor is relative to whatever pixel x-position my mouse was at in the frame prior to reaching the slider's minimum position...
I do consider this a bug and I've renamed the title. I can think of a few simple solutions:
I notice it is possible in the slider configure window that user can set minimum to negative values (which of course are meaningless for resistors in reality). So if were to do input validation for resistor sliders, maybe do if (min <= 0) then set to 1n.
a similar phenomenon occurs with capacitor slider...setting min to 0 means that I can't slide all the way down to zero. (But while 0 capacitance is practically impossible, I do think should allow 0 capacitance.) But if your design wants to prohibit 0 capacitance, then maybe similar to resistor suggestion (1) maybe just set minimum to very small like 1p.
(I'm noticing setting min for capacitor slider to negative results in capacitor slider simply only allowing user to set slider to max, which I suppose is a safe coding decision. A similar thing could be done for resistors set to negative values.)
I suppose I could change the slider GUI to set a small minimum value for resistors or capacitors. Allowing zero valued resistors or capacitors would not make sense, since those would have to be implemented a completely different way than a small resistor/capacitor. Probably not worth the trouble for such an unusual case.
I understand, sounds good, thanks.
Actually what might be easier and also make more sense is for the resistance to be set to a small value if you try to set it to 0 (with a slider or otherwise), rather than just doing nothing. Similarly for a capacitor.
I have a 0-to-50k resistor with slider named "Tempo" here: https://tinyurl.com/y83zccpo (circuit-20220114-0010.circuitjs.txt)
Unfortunately when I try to drag the slider to 0 with my mouse, the value only seems to be able to go down to either 500, or 1k, or 1.5k, or even something higher like 7.5k. I can't get that slider to be slided down to 0 reliably. I'm even on a big screen (2560x1440). Though I can reliably always slide the value up to its maximum of 50k.
(I'm on arch linux 5.15.14-1-lts running latest kde wayland running Google Chrome Version 97.0.4692.71 (Official Build) (64-bit), on Circuit Simulator version 2.6.3js)