MCPcopy Index your code
hub / github.com/processing/processing / placeWindow

Method placeWindow

core/src/processing/javafx/PSurfaceFX.java:545–576  ·  view source on GitHub ↗
(int[] location, int[] editorLocation)

Source from the content-addressed store, hash-verified

543
544
545 @Override
546 public void placeWindow(int[] location, int[] editorLocation) {
547 if (sketch.sketchFullScreen()) {
548 PApplet.hideMenuBar();
549 return;
550 }
551
552 int wide = sketch.width; // stage.getWidth() is NaN here
553 //int high = sketch.height; // stage.getHeight()
554
555 if (location != null) {
556 // a specific location was received from the Runner
557 // (applet has been run more than once, user placed window)
558 stage.setX(location[0]);
559 stage.setY(location[1]);
560
561 } else if (editorLocation != null) {
562 int locationX = editorLocation[0] - 20;
563 int locationY = editorLocation[1];
564
565 if (locationX - wide > 10) {
566 // if it fits to the left of the window
567 stage.setX(locationX - wide);
568 stage.setY(locationY);
569
570 } else { // doesn't fit
571 stage.centerOnScreen();
572 }
573 } else { // just center on screen
574 stage.centerOnScreen();
575 }
576 }
577
578
579 // http://download.java.net/jdk8/jfxdocs/javafx/stage/Stage.html#setFullScreenExitHint-java.lang.String-

Callers

nothing calls this directly

Calls 2

hideMenuBarMethod · 0.95
sketchFullScreenMethod · 0.80

Tested by

no test coverage detected