forked from teamnwah/openmw-tes3coop
Map keeps focus on wherever it was last moved when resizing map window
This commit is contained in:
parent
d64be1c092
commit
4ecac31752
2 changed files with 22 additions and 0 deletions
|
@ -14,6 +14,9 @@
|
|||
|
||||
#include "../mwrender/globalmap.hpp"
|
||||
|
||||
#include "../mwgui/container.hpp"
|
||||
#include "../mwgui/itemview.hpp"
|
||||
|
||||
#include "../components/esm/globalmap.hpp"
|
||||
|
||||
#include "widgets.hpp"
|
||||
|
@ -537,6 +540,9 @@ namespace MWGui
|
|||
getWidget(mPlayerArrowLocal, "CompassLocal");
|
||||
getWidget(mPlayerArrowGlobal, "CompassGlobal");
|
||||
|
||||
// Seems to be called when the map window is resized at all regardless of local or world map view
|
||||
mLocalMap->eventChangeCoord += MyGUI::newDelegate(this, &MapWindow::onChangeCoord);
|
||||
|
||||
mGlobalMap->setVisible (false);
|
||||
|
||||
getWidget(mButton, "WorldButton");
|
||||
|
@ -632,6 +638,21 @@ namespace MWGui
|
|||
mEditNoteDialog.setText("");
|
||||
}
|
||||
|
||||
void MapWindow::onChangeCoord(MyGUI::Widget* sender)
|
||||
{
|
||||
static MyGUI::IntCoord lastCoordinates = sender->getCoord();
|
||||
MyGUI::IntCoord currentCoordinates = sender->getCoord();
|
||||
|
||||
MyGUI::IntPoint currentViewPortCenter = MyGUI::IntPoint(currentCoordinates.width / 2, currentCoordinates.height / 2);
|
||||
MyGUI::IntPoint lastViewPortCenter = MyGUI::IntPoint(lastCoordinates.width / 2, lastCoordinates.height / 2);
|
||||
MyGUI::IntPoint viewPortCenterDiff = currentViewPortCenter - lastViewPortCenter;
|
||||
|
||||
mLocalMap->setViewOffset(mLocalMap->getViewOffset() + viewPortCenterDiff);
|
||||
mGlobalMap->setViewOffset(mGlobalMap->getViewOffset() + viewPortCenterDiff);
|
||||
|
||||
lastCoordinates = currentCoordinates;
|
||||
}
|
||||
|
||||
void MapWindow::renderGlobalMap(Loading::Listener* loadingListener)
|
||||
{
|
||||
mGlobalMapRender = new MWRender::GlobalMap("");
|
||||
|
|
|
@ -200,6 +200,7 @@ namespace MWGui
|
|||
void onNoteEditDelete();
|
||||
void onNoteEditDeleteConfirm();
|
||||
void onNoteDoubleClicked(MyGUI::Widget* sender);
|
||||
void onChangeCoord(MyGUI::Widget* sender);
|
||||
void globalMapUpdatePlayer();
|
||||
|
||||
MyGUI::ScrollView* mGlobalMap;
|
||||
|
|
Loading…
Reference in a new issue