@@ -28,7 +28,7 @@ public class CanvasWithFrame extends BorderPane {
28
28
29
29
private final ObjectProperty <Color > borderColor = new SimpleObjectProperty <>(Color .LIGHTBLUE );
30
30
31
- private final BooleanProperty roundedBorderPy = new SimpleBooleanProperty (true ) {
31
+ private final BooleanProperty roundedBorder = new SimpleBooleanProperty (true ) {
32
32
@ Override
33
33
protected void invalidated () {
34
34
doLayout (scaling (), true );
@@ -77,7 +77,7 @@ public CanvasWithFrame() {
77
77
clipRect .setArcHeight (arcSize );
78
78
}
79
79
return clipRect ;
80
- }, roundedBorderPy , scaling , unscaledCanvasWidth , unscaledCanvasHeight ));
80
+ }, roundedBorder , scaling , unscaledCanvasWidth , unscaledCanvasHeight ));
81
81
82
82
borderProperty ().bind (Bindings .createObjectBinding (() -> {
83
83
if (!hasRoundedBorder () || !isBorderVisible ()) {
@@ -86,7 +86,7 @@ public CanvasWithFrame() {
86
86
double bw = Math .max (5 , Math .ceil (computeSize ().getHeight () / 55 )); // TODO avoid magic numbers
87
87
CornerRadii cr = hasRoundedBorder () ? new CornerRadii (Math .ceil (10 * scaling ())) : null ;
88
88
return new Border (new BorderStroke (borderColor (), BorderStrokeStyle .SOLID , cr , new BorderWidths (bw )));
89
- }, roundedBorderPy , borderVisible , scaling , unscaledCanvasWidth , unscaledCanvasHeight ));
89
+ }, roundedBorder , borderVisible , scaling , unscaledCanvasWidth , unscaledCanvasHeight ));
90
90
}
91
91
92
92
private void doLayout (double newScaling , boolean forced ) {
@@ -121,10 +121,6 @@ private Dimension2D computeSize() {
121
121
);
122
122
}
123
123
124
- public Canvas canvas () {
125
- return canvas ;
126
- }
127
-
128
124
public void resizeTo (double width , double height ) {
129
125
if (hasRoundedBorder ()) {
130
126
double downScaledWidth = width , downScaledHeight = height ;
@@ -143,6 +139,10 @@ public void resizeTo(double width, double height) {
143
139
Logger .debug ("Game canvas container resized to width={} height={}" , getWidth (), getHeight ());
144
140
}
145
141
142
+ public Canvas canvas () {
143
+ return canvas ;
144
+ }
145
+
146
146
public DoubleProperty scalingProperty () { return scaling ; }
147
147
public double scaling () {
148
148
return scaling .get ();
@@ -167,24 +167,28 @@ public void setUnscaledCanvasSize(double width, double height) {
167
167
unscaledCanvasHeight .set (height );
168
168
}
169
169
170
- public BooleanProperty roundedBorderProperty () { return roundedBorderPy ; }
170
+ public BooleanProperty roundedBorderProperty () { return roundedBorder ; }
171
+
171
172
public boolean hasRoundedBorder () {
172
- return roundedBorderPy .get ();
173
+ return roundedBorder .get ();
173
174
}
175
+
174
176
public void setRoundedBorder (boolean enabled ) {
175
- roundedBorderPy .set (enabled );
177
+ roundedBorder .set (enabled );
176
178
}
177
179
178
180
public Color borderColor () {
179
181
return borderColor .get ();
180
182
}
183
+
181
184
public void setBorderColor (Color color ) {
182
185
borderColor .set (color );
183
186
}
184
187
185
188
public boolean isBorderVisible () {
186
189
return borderVisible .get ();
187
190
}
191
+
188
192
public void setBorderVisible (boolean visible ) {
189
193
borderVisible .set (visible );
190
194
}
0 commit comments