(int[] location, int[] editorLocation)
| 715 | |
| 716 | |
| 717 | @Override |
| 718 | public void placeWindow(int[] location, int[] editorLocation) { |
| 719 | //Dimension window = setFrameSize(sketchWidth, sketchHeight); |
| 720 | Dimension window = setFrameSize(); //sketchWidth, sketchHeight); |
| 721 | |
| 722 | int contentW = Math.max(sketchWidth, MIN_WINDOW_WIDTH); |
| 723 | int contentH = Math.max(sketchHeight, MIN_WINDOW_HEIGHT); |
| 724 | |
| 725 | if (sketch.sketchFullScreen()) { |
| 726 | setFullFrame(); |
| 727 | } |
| 728 | |
| 729 | // Ignore placement of previous window and editor when full screen |
| 730 | if (!sketch.sketchFullScreen()) { |
| 731 | if (location != null) { |
| 732 | // a specific location was received from the Runner |
| 733 | // (sketch has been run more than once, user placed window) |
| 734 | frame.setLocation(location[0], location[1]); |
| 735 | |
| 736 | } else if (editorLocation != null) { |
| 737 | int locationX = editorLocation[0] - 20; |
| 738 | int locationY = editorLocation[1]; |
| 739 | |
| 740 | if (locationX - window.width > 10) { |
| 741 | // if it fits to the left of the window |
| 742 | frame.setLocation(locationX - window.width, locationY); |
| 743 | |
| 744 | } else { // doesn't fit |
| 745 | // if it fits inside the editor window, |
| 746 | // offset slightly from upper lefthand corner |
| 747 | // so that it's plunked inside the text area |
| 748 | //locationX = editorLocation[0] + 66; |
| 749 | //locationY = editorLocation[1] + 66; |
| 750 | locationX = (sketch.displayWidth - window.width) / 2; |
| 751 | locationY = (sketch.displayHeight - window.height) / 2; |
| 752 | |
| 753 | /* |
| 754 | if ((locationX + window.width > sketch.displayWidth - 33) || |
| 755 | (locationY + window.height > sketch.displayHeight - 33)) { |
| 756 | // otherwise center on screen |
| 757 | locationX = (sketch.displayWidth - window.width) / 2; |
| 758 | locationY = (sketch.displayHeight - window.height) / 2; |
| 759 | } |
| 760 | */ |
| 761 | frame.setLocation(locationX, locationY); |
| 762 | } |
| 763 | } else { // just center on screen |
| 764 | setFrameCentered(); |
| 765 | } |
| 766 | Point frameLoc = frame.getLocation(); |
| 767 | if (frameLoc.y < 0) { |
| 768 | // Windows actually allows you to place frames where they can't be |
| 769 | // closed. Awesome. https://download.processing.org/bugzilla/1508.html |
| 770 | frame.setLocation(frameLoc.x, 30); |
| 771 | } |
| 772 | // make sure that windowX and windowY are set on startup |
| 773 | sketch.postWindowMoved(frame.getX(), frame.getY()); |
| 774 | } |
nothing calls this directly
no test coverage detected