fixes an issue with the input shape dragging slider

This commit is contained in:
hneemann 2021-01-24 11:50:18 +01:00
parent 336a8d283a
commit 42c74f3fcc
3 changed files with 16 additions and 1 deletions

View File

@ -478,6 +478,11 @@ public enum IntFormat {
public boolean isSuitedForAddresses() {
return false;
}
@Override
public boolean isProportional() {
return false;
}
}
}

View File

@ -44,4 +44,14 @@ public interface ValueFormatter {
* @return true if formatter is suited to display addresses
*/
boolean isSuitedForAddresses();
/**
* If the represented value is proportional to the underlying integer value.
* This is not the case at float values.
*
* @return true if represented valueis proportional to the underlying integer value
*/
default boolean isProportional() {
return true;
}
}

View File

@ -183,7 +183,7 @@ public class InputShape implements Shape {
@Override
public void dragged(CircuitComponent cc, Point posOnScreen, Vector pos, Transform transform, IOState ioState, Element element, SyncAccess modelSync) {
ObservableValue value = ioState.getOutput(0);
if (bits > 1 && !value.isHighZ()) {
if (bits > 1 && !value.isHighZ() && formatter.isProportional()) {
if (!isDrag) {
isDrag = true;
startPos = posOnScreen;