Skip to content

Commit 667377d

Browse files
committed
Solves disappearing selection box lines, and other selection issues
use "setAll" instead of addAll otherwise stroke dash patterns are added every time when drawing a selection line Fix typo: width --> height, this might explain why sometimes object are not selected. #85 Make sure the line is always on top of the view. #103
1 parent ac7f61d commit 667377d

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/main/java/com/commonwealthrobotics/SelectionBox.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
import javafx.scene.shape.MeshView;
3131
import javafx.scene.shape.Rectangle;
3232
import javafx.scene.transform.Affine;
33+
import javafx.scene.DepthTest;
3334

3435
public class SelectionBox {
3536

@@ -131,10 +132,11 @@ public void dragged(MouseEvent event) {
131132
rect.setFill(Color.TRANSPARENT);
132133
rect.setStroke(Color.RED);
133134
rect.setStrokeWidth(2);
134-
rect.getStrokeDashArray().addAll(5.0, 5.0);
135+
rect.getStrokeDashArray().setAll(5.0, 5.0);
135136
rect.setWidth(0);
136137
rect.setHeight(0);
137138
rect.setViewOrder(-2);
139+
rect.setDepthTest(DepthTest.DISABLE);
138140

139141
//show.clear();
140142
HashMap<CSG, MeshView> meshes = session.getMeshes();
@@ -193,7 +195,7 @@ public void released(MouseEvent event) {
193195
// ap.get().setWorkplane(cf);
194196
// workplane.placeWorkplaneVisualization();
195197

196-
Bounds sel = new Bounds(new Vector3d(xLeft, yTop, 0), new Vector3d(xLeft + width, yTop + width));
198+
Bounds sel = new Bounds(new Vector3d(xLeft, yTop, 0), new Vector3d(xLeft + width, yTop + height));
197199
Transform boxFrame = TransformFactory.nrToCSG(getBoxFrame());
198200
// if(selection!=null)
199201
// BowlerStudio.runLater(()-> engine.removeObject(selection));

0 commit comments

Comments
 (0)