X-Git-Url: https://mograsim.net/gitweb/?a=blobdiff_plain;f=LogicUI%2Fsrc%2Fera%2Fmi%2Fcomponents%2Fgui%2FGUIMux.java;h=df61ca777bdd181bb3f79dc382a34b27d8c00218;hb=0cfea6ef89dea8a797708ff685aa2ef9aefd85b9;hp=509a8ccd0658315d84f1540529a9fa96fc281605;hpb=70aaa694028a17acf0ac07ee6870659947ba28f0;p=Mograsim.git diff --git a/LogicUI/src/era/mi/components/gui/GUIMux.java b/LogicUI/src/era/mi/components/gui/GUIMux.java index 509a8ccd..df61ca77 100644 --- a/LogicUI/src/era/mi/components/gui/GUIMux.java +++ b/LogicUI/src/era/mi/components/gui/GUIMux.java @@ -9,6 +9,7 @@ import era.mi.logic.components.Mux; import era.mi.logic.wires.WireArray; import net.haspamelodica.swt.helper.gcs.GeneralGC; import net.haspamelodica.swt.helper.swtobjectwrappers.Point; +import net.haspamelodica.swt.helper.swtobjectwrappers.Rectangle; public class GUIMux extends Mux implements BasicGUIComponent { @@ -20,7 +21,7 @@ public class GUIMux extends Mux implements BasicGUIComponent { super(processTime, out, select, inputs); - double height = inputs.length * 10; + double height = inputs.length * 5; if(height < 10) height = 10; this.height = height; @@ -36,8 +37,8 @@ public class GUIMux extends Mux implements BasicGUIComponent { connectedWireArraysModifiable.addAll(Arrays.asList(inputs)); - double inputHeightIncrement = height / (inputs.length - 1); - double inputHeight = 10; + double inputHeightIncrement = (height + 20) / inputs.length; + double inputHeight = inputHeightIncrement / 2; for(int i = 0; i < inputs.length; i ++, inputHeight += inputHeightIncrement) wireArrayConnectionPointsModifiable.add(new Point(0, inputHeight)); } @@ -45,6 +46,12 @@ public class GUIMux extends Mux implements BasicGUIComponent this.connectedWireArrays = Collections.unmodifiableList(connectedWireArraysModifiable); this.wireArrayConnectionPoints = Collections.unmodifiableList(wireArrayConnectionPointsModifiable); } + + @Override + public Rectangle getBounds() + { + return new Rectangle(0, 0, 20, height + 20); + } @Override public void render(GeneralGC gc) {