@@ -313,7 +313,7 @@ public void start(final Stage stage) {
313313 // https://github.com/processing/processing/issues/3823
314314 if ((PApplet .platform == PConstants .MACOSX ||
315315 PApplet .platform == PConstants .LINUX ) &&
316- PApplet .javaVersionName .equals ("1.8.0_60" )) {
316+ PApplet .javaVersionName .compareTo ("1.8.0_60" ) >= 0 ) {
317317 System .err .println ("smooth() disabled for JavaFX with this Java version due to Oracle bug" );
318318 System .err .println ("https://github.com/processing/processing/issues/3795" );
319319 smooth = 0 ;
@@ -446,9 +446,11 @@ public void placeWindow(int[] location, int[] editorLocation) {
446446 }
447447
448448 //Dimension window = setFrameSize();
449-
450449// int contentW = Math.max(sketchWidth, MIN_WINDOW_WIDTH);
451450// int contentH = Math.max(sketchHeight, MIN_WINDOW_HEIGHT);
451+ // System.out.println("stage size is " + stage.getWidth() + " " + stage.getHeight());
452+ int wide = sketch .width ; // stage.getWidth() is NaN here
453+ int high = sketch .height ; // stage.getHeight()
452454
453455 if (location != null ) {
454456 // a specific location was received from the Runner
@@ -460,28 +462,26 @@ public void placeWindow(int[] location, int[] editorLocation) {
460462 int locationX = editorLocation [0 ] - 20 ;
461463 int locationY = editorLocation [1 ];
462464
463- if (locationX - stage . getWidth () > 10 ) {
465+ if (locationX - wide > 10 ) {
464466 // if it fits to the left of the window
465- stage .setX (locationX - stage . getWidth () );
467+ stage .setX (locationX - wide );
466468 stage .setY (locationY );
467469
468470 } else { // doesn't fit
469- /*
470- // if it fits inside the editor window,
471- // offset slightly from upper lefthand corner
472- // so that it's plunked inside the text area
473- locationX = editorLocation[0] + 66;
474- locationY = editorLocation[1] + 66;
475-
476- if ((locationX + stage.getWidth() > sketch.displayWidth - 33) ||
477- (locationY + stage.getHeight() > sketch.displayHeight - 33)) {
478- // otherwise center on screen
479- */
480- locationX = (int ) ((sketch .displayWidth - stage .getWidth ()) / 2 );
481- locationY = (int ) ((sketch .displayHeight - stage .getHeight ()) / 2 );
482- /*
483- }
484- */
471+ // // if it fits inside the editor window,
472+ // // offset slightly from upper lefthand corner
473+ // // so that it's plunked inside the text area
474+ // locationX = editorLocation[0] + 66;
475+ // locationY = editorLocation[1] + 66;
476+ //
477+ // if ((locationX + stage.getWidth() > sketch.displayWidth - 33) ||
478+ // (locationY + stage.getHeight() > sketch.displayHeight - 33)) {
479+ // // otherwise center on screen
480+ // locationX = (int) ((sketch.displayWidth - wide) / 2);
481+ // locationY = (int) ((sketch.displayHeight - high) / 2);
482+ // }
483+ locationX = (sketch .displayWidth - wide ) / 2 ;
484+ locationY = (sketch .displayHeight - high ) / 2 ;
485485 stage .setX (locationX );
486486 stage .setY (locationY );
487487 }
0 commit comments