Fixed some corner cases in the rotation code (rotation + scaling + stretching)

git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@628 0fc631ac-6414-0410-93d0-97cfa31319b6
This commit is contained in:
twanvl
2007-08-25 00:53:39 +00:00
parent 694566fef4
commit 3937f217a0
3 changed files with 55 additions and 17 deletions
+8 -3
View File
@@ -19,14 +19,19 @@ DEFINE_EVENT_TYPE(EVENT_SIZE_CHANGE);
// ----------------------------------------------------------------------------- : CardViewer
CardViewer::CardViewer(Window* parent, int id, long style)
: wxControl(parent, id, wxDefaultPosition, wxDefaultSize, style | wxNO_FULL_REPAINT_ON_RESIZE)
: wxControl(parent, id, wxDefaultPosition, wxDefaultSize, style)
, up_to_date(false)
{}
wxSize CardViewer::DoGetBestSize() const {
wxSize ws = GetSize(), cs = GetClientSize();
if (set) {
return (wxSize)getRotation().getExternalSize() + ws - cs;
if (!stylesheet) stylesheet = set->stylesheet;
StyleSheetSettings& ss = settings.stylesheetSettingsFor(*stylesheet);
wxSize size(stylesheet->card_width * ss.card_zoom(), stylesheet->card_height * ss.card_zoom());
bool sideways = (ss.card_angle() & 2) != 0;
if (sideways) swap(size.x, size.y);
return size + ws - cs;
}
return cs;
}
@@ -129,7 +134,7 @@ Rotation CardViewer::getRotation() const {
if (!stylesheet) stylesheet = set->stylesheet;
StyleSheetSettings& ss = settings.stylesheetSettingsFor(*stylesheet);
int dx = GetScrollPos(wxHORIZONTAL), dy = GetScrollPos(wxVERTICAL);
return Rotation(ss.card_angle(), stylesheet->getCardRect().move(-dx,-dy,0,0), ss.card_zoom(), true);
return Rotation(ss.card_angle(), stylesheet->getCardRect().move(-dx,-dy,0,0), ss.card_zoom(), 1.0, true);
}
// ----------------------------------------------------------------------------- : Event table