Skip to content

Commit 829c93b

Browse files
committed
2 parents 0f69593 + 139e73f commit 829c93b

File tree

4 files changed

+21
-4
lines changed

4 files changed

+21
-4
lines changed

core/src/com/amhsrobotics/circuitsim/hardware/EPlate.java

+19-3
Original file line numberDiff line numberDiff line change
@@ -84,10 +84,14 @@ public void update(SpriteBatch batch, ModifiedShapeRenderer renderer, ClippedCam
8484
SnapGrid.calculateSnap(vec);
8585
}
8686

87+
8788
if(box.contains(vec.x, vec.y)) {
8889
drawHover(renderer);
8990

90-
if((CableManager.currentCable == null || (!CableManager.currentCable.appendingFromBegin && !CableManager.currentCable.appendingFromEnd)) && Gdx.input.isButtonJustPressed(Input.Buttons.LEFT)) {
91+
if((CableManager.currentCable == null || (!CableManager.currentCable.hoveringMouse(camera) && (!CableManager.currentCable.appendingFromBegin && !CableManager.currentCable.appendingFromEnd && CableManager.currentCable.movingNode == null))) && Gdx.input.isButtonJustPressed(Input.Buttons.LEFT) && checkGood(camera)) {
92+
if(CableManager.currentCable != null) {
93+
CableManager.currentCable = null;
94+
}
9195
HardwareManager.currentHardware = this;
9296
populateProperties();
9397
CircuitGUIManager.propertiesBox.show();
@@ -140,7 +144,7 @@ public void update(SpriteBatch batch, ModifiedShapeRenderer renderer, ClippedCam
140144

141145
if (!canMove) {
142146
for (int x = 0; x < nodes.length; x++) {
143-
if (Gdx.input.isTouched()) {
147+
if (Gdx.input.isTouched() && checkGood(camera)) {
144148
if (nodes[x].contains(vec) && (dragging == -1 || dragging == x)) {
145149
dragging = x;
146150
}
@@ -154,7 +158,7 @@ public void update(SpriteBatch batch, ModifiedShapeRenderer renderer, ClippedCam
154158
}
155159
}
156160

157-
if (Gdx.input.isTouched() && dragging == -1) {
161+
if (Gdx.input.isTouched() && dragging == -1 && checkGood(camera)) {
158162

159163
if (box.contains(vec.x, vec.y) && (HardwareManager.getCurrentlyHovering(camera) == null || canMove)) {
160164
if (!HardwareManager.movingObject) {
@@ -201,6 +205,18 @@ private void setSelectedNode(int index) {
201205
nodes[index].setSelected(true);
202206
}
203207

208+
public boolean checkGood(ClippedCameraController camera) {
209+
boolean good = true;
210+
for(Cable c : CableManager.getCables()) {
211+
if(c.hoveringMouse(camera)) {
212+
good = false;
213+
}
214+
}
215+
216+
return (good && !(CircuitGUIManager.panelShown && Gdx.input.getX() >= Gdx.graphics.getWidth() - 420 && Gdx.input.getY() <= 210) && !(!CircuitGUIManager.panelShown &&
217+
Gdx.input.getX() >= Gdx.graphics.getWidth() - 210 && Gdx.input.getY() <= 210) && ((Gdx.input.getX() <= Gdx.graphics.getWidth() - 210) || !CircuitGUIManager.isPanelShown())&& !CableManager.movingCable);
218+
}
219+
204220
@Override
205221
public void populateProperties() {
206222
CircuitGUIManager.propertiesBox.clearTable();

core/src/com/amhsrobotics/circuitsim/hardware/Hardware.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,8 @@ public void update(SpriteBatch batch, ModifiedShapeRenderer renderer, ClippedCam
258258
}
259259
}
260260

261-
if(!(CableManager.currentCable != null && connections.contains(CableManager.currentCable, true) && !CableManager.currentCable.hoveringMouse(camera)) && (CableManager.currentCable == null || (!(CableManager.currentCable.appendingFromBegin || CableManager.currentCable.appendingFromEnd || CableManager.currentCable.movingNode != null)))) {
261+
if(!(CableManager.currentCable != null && connections.contains(CableManager.currentCable, true) && !CableManager.currentCable.hoveringMouse(camera)) &&
262+
(CableManager.currentCable == null || (!(CableManager.currentCable.appendingFromBegin || CableManager.currentCable.appendingFromEnd || CableManager.currentCable.movingNode != null)))) {
262263
if (Gdx.input.isTouched() && checkGood()) {
263264

264265
if (HardwareManager.getCurrentlyHovering(camera) == this || canMove) {

out-mac/Contents/Info.plist

100644100755
File mode changed.

out-mac/Contents/Resources/desktop-1.0.jar

100644100755
File mode changed.

0 commit comments

Comments
 (0)