1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-02-04 12:39:55 +00:00

Merge remote-tracking branch 'ragora/fixmapresize'

This commit is contained in:
Marc Zinnschlag 2014-09-13 15:52:36 +02:00
commit 690273d5b3
2 changed files with 20 additions and 0 deletions

View File

@ -537,6 +537,9 @@ namespace MWGui
getWidget(mPlayerArrowLocal, "CompassLocal"); getWidget(mPlayerArrowLocal, "CompassLocal");
getWidget(mPlayerArrowGlobal, "CompassGlobal"); getWidget(mPlayerArrowGlobal, "CompassGlobal");
mLastScrollWindowCoordinates = mLocalMap->getCoord();
mLocalMap->eventChangeCoord += MyGUI::newDelegate(this, &MapWindow::onChangeScrollWindowCoord);
mGlobalMap->setVisible (false); mGlobalMap->setVisible (false);
getWidget(mButton, "WorldButton"); getWidget(mButton, "WorldButton");
@ -632,6 +635,20 @@ namespace MWGui
mEditNoteDialog.setText(""); mEditNoteDialog.setText("");
} }
void MapWindow::onChangeScrollWindowCoord(MyGUI::Widget* sender)
{
MyGUI::IntCoord currentCoordinates = sender->getCoord();
MyGUI::IntPoint currentViewPortCenter = MyGUI::IntPoint(currentCoordinates.width / 2, currentCoordinates.height / 2);
MyGUI::IntPoint lastViewPortCenter = MyGUI::IntPoint(mLastScrollWindowCoordinates.width / 2, mLastScrollWindowCoordinates.height / 2);
MyGUI::IntPoint viewPortCenterDiff = currentViewPortCenter - lastViewPortCenter;
mLocalMap->setViewOffset(mLocalMap->getViewOffset() + viewPortCenterDiff);
mGlobalMap->setViewOffset(mGlobalMap->getViewOffset() + viewPortCenterDiff);
mLastScrollWindowCoordinates = currentCoordinates;
}
void MapWindow::renderGlobalMap(Loading::Listener* loadingListener) void MapWindow::renderGlobalMap(Loading::Listener* loadingListener)
{ {
mGlobalMapRender = new MWRender::GlobalMap(""); mGlobalMapRender = new MWRender::GlobalMap("");

View File

@ -200,6 +200,7 @@ namespace MWGui
void onNoteEditDelete(); void onNoteEditDelete();
void onNoteEditDeleteConfirm(); void onNoteEditDeleteConfirm();
void onNoteDoubleClicked(MyGUI::Widget* sender); void onNoteDoubleClicked(MyGUI::Widget* sender);
void onChangeScrollWindowCoord(MyGUI::Widget* sender);
void globalMapUpdatePlayer(); void globalMapUpdatePlayer();
MyGUI::ScrollView* mGlobalMap; MyGUI::ScrollView* mGlobalMap;
@ -211,6 +212,8 @@ namespace MWGui
MyGUI::IntPoint mLastDragPos; MyGUI::IntPoint mLastDragPos;
bool mGlobal; bool mGlobal;
MyGUI::IntCoord mLastScrollWindowCoordinates;
// Markers on global map // Markers on global map
typedef std::pair<int, int> CellId; typedef std::pair<int, int> CellId;
std::vector<CellId> mMarkers; std::vector<CellId> mMarkers;