Resizes the plot (unless frozen) to fit the window
()
| 163 | |
| 164 | /** Resizes the plot (unless frozen) to fit the window */ |
| 165 | public void fitToWindow() { |
| 166 | if (plot == null || plot.isFrozen()) { |
| 167 | super.fitToWindow(); |
| 168 | return; |
| 169 | } |
| 170 | ImageWindow win = imp.getWindow(); |
| 171 | if (win==null) return; |
| 172 | Rectangle bounds = win.getBounds(); |
| 173 | Dimension extraSize = win.getExtraSize(); |
| 174 | int width = bounds.width-extraSize.width;//(insets.left+insets.right+ImageWindow.HGAP*2); |
| 175 | int height = bounds.height-extraSize.height;//(insets.top+insets.bottom+ImageWindow.VGAP*2); |
| 176 | //IJ.log("fitToWindow "+bounds+"-> w*h="+width+"*"+height); |
| 177 | resizeCanvas(width, height); |
| 178 | getParent().doLayout(); |
| 179 | } |
| 180 | |
| 181 | /** Resizes the canvas when the user resizes the window. To avoid a race condition while creating |
| 182 | * a new window, this is ignored if no window exists or the window has not been activated yet. |
no test coverage detected