Moved panel resize logic into panel.