@@ -84,10 +84,14 @@ public void update(SpriteBatch batch, ModifiedShapeRenderer renderer, ClippedCam
84
84
SnapGrid .calculateSnap (vec );
85
85
}
86
86
87
+
87
88
if (box .contains (vec .x , vec .y )) {
88
89
drawHover (renderer );
89
90
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
+ }
91
95
HardwareManager .currentHardware = this ;
92
96
populateProperties ();
93
97
CircuitGUIManager .propertiesBox .show ();
@@ -140,7 +144,7 @@ public void update(SpriteBatch batch, ModifiedShapeRenderer renderer, ClippedCam
140
144
141
145
if (!canMove ) {
142
146
for (int x = 0 ; x < nodes .length ; x ++) {
143
- if (Gdx .input .isTouched ()) {
147
+ if (Gdx .input .isTouched () && checkGood ( camera ) ) {
144
148
if (nodes [x ].contains (vec ) && (dragging == -1 || dragging == x )) {
145
149
dragging = x ;
146
150
}
@@ -154,7 +158,7 @@ public void update(SpriteBatch batch, ModifiedShapeRenderer renderer, ClippedCam
154
158
}
155
159
}
156
160
157
- if (Gdx .input .isTouched () && dragging == -1 ) {
161
+ if (Gdx .input .isTouched () && dragging == -1 && checkGood ( camera ) ) {
158
162
159
163
if (box .contains (vec .x , vec .y ) && (HardwareManager .getCurrentlyHovering (camera ) == null || canMove )) {
160
164
if (!HardwareManager .movingObject ) {
@@ -201,6 +205,18 @@ private void setSelectedNode(int index) {
201
205
nodes [index ].setSelected (true );
202
206
}
203
207
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
+
204
220
@ Override
205
221
public void populateProperties () {
206
222
CircuitGUIManager .propertiesBox .clearTable ();
0 commit comments