Short patches: Difference between revisions
From FreeMind
Jump to navigationJump to search
No edit summary |
m (Reverted edit of Yvyfyjeh, changed back to last version by Adaniel) |
||
Line 1: | Line 1: | ||
===Patch resizing images upon zoom=== | |||
Our user ''Mario Claerhout'' has written to us: Since I like FreeMind so much I decided to add a little contribution. Attached you find an altered NodeView.java which contains following modification : | Our user ''Mario Claerhout'' has written to us: Since I like FreeMind so much I decided to add a little contribution. Attached you find an altered NodeView.java which contains following modification : | ||
Line 11: | Line 11: | ||
int width=(int)(prefSize.width * map.getZoom()); | int width=(int)(prefSize.width * map.getZoom()); | ||
int height=(int)(prefSize.height * map.getZoom()); | int height=(int)(prefSize.height * map.getZoom()); | ||
String result=text.replaceAll( | String result=text.replaceAll("(<html>.*?<img src=\".*?\")", | ||
"$1 width=\""+width+"\" height=\""+height+"\""); | |||
System.out.println(result); | System.out.println(result); | ||
return result; | return result; | ||
Line 18: | Line 18: | ||
} | } | ||
</table> | |||
Revision as of 19:10, 18 November 2010
Patch resizing images upon zoom
Our user Mario Claerhout has written to us: Since I like FreeMind so much I decided to add a little contribution. Attached you find an altered NodeView.java which contains following modification : Nodes containing images are now also resized when zooming. I did this by adding the method:
private String resizeImage(String text) { JLabel imageLabel=new JLabel(text); Dimension prefSize=imageLabel.getPreferredSize(); int width=(int)(prefSize.width * map.getZoom()); int height=(int)(prefSize.height * map.getZoom()); String result=text.replaceAll("(<html>.*?<img src=\".*?\")", "$1 width=\""+width+"\" height=\""+height+"\""); System.out.println(result); return result; }