mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-02-22 11:09:40 +00:00
Discarded use of a static variable and renamed event function to be less ambiguous
This commit is contained in:
parent
58d70c2895
commit
25f99c5d5a
2 changed files with 8 additions and 7 deletions
|
@ -537,8 +537,8 @@ namespace MWGui
|
||||||
getWidget(mPlayerArrowLocal, "CompassLocal");
|
getWidget(mPlayerArrowLocal, "CompassLocal");
|
||||||
getWidget(mPlayerArrowGlobal, "CompassGlobal");
|
getWidget(mPlayerArrowGlobal, "CompassGlobal");
|
||||||
|
|
||||||
// Seems to be called when the map window is resized at all regardless of local or world map view
|
mLastScrollWindowCoordinates = mLocalMap->getCoord();
|
||||||
mLocalMap->eventChangeCoord += MyGUI::newDelegate(this, &MapWindow::onChangeCoord);
|
mLocalMap->eventChangeCoord += MyGUI::newDelegate(this, &MapWindow::onChangeScrollWindowCoord);
|
||||||
|
|
||||||
mGlobalMap->setVisible (false);
|
mGlobalMap->setVisible (false);
|
||||||
|
|
||||||
|
@ -635,19 +635,18 @@ namespace MWGui
|
||||||
mEditNoteDialog.setText("");
|
mEditNoteDialog.setText("");
|
||||||
}
|
}
|
||||||
|
|
||||||
void MapWindow::onChangeCoord(MyGUI::Widget* sender)
|
void MapWindow::onChangeScrollWindowCoord(MyGUI::Widget* sender)
|
||||||
{
|
{
|
||||||
static MyGUI::IntCoord lastCoordinates = sender->getCoord();
|
|
||||||
MyGUI::IntCoord currentCoordinates = sender->getCoord();
|
MyGUI::IntCoord currentCoordinates = sender->getCoord();
|
||||||
|
|
||||||
MyGUI::IntPoint currentViewPortCenter = MyGUI::IntPoint(currentCoordinates.width / 2, currentCoordinates.height / 2);
|
MyGUI::IntPoint currentViewPortCenter = MyGUI::IntPoint(currentCoordinates.width / 2, currentCoordinates.height / 2);
|
||||||
MyGUI::IntPoint lastViewPortCenter = MyGUI::IntPoint(lastCoordinates.width / 2, lastCoordinates.height / 2);
|
MyGUI::IntPoint lastViewPortCenter = MyGUI::IntPoint(mLastScrollWindowCoordinates.width / 2, mLastScrollWindowCoordinates.height / 2);
|
||||||
MyGUI::IntPoint viewPortCenterDiff = currentViewPortCenter - lastViewPortCenter;
|
MyGUI::IntPoint viewPortCenterDiff = currentViewPortCenter - lastViewPortCenter;
|
||||||
|
|
||||||
mLocalMap->setViewOffset(mLocalMap->getViewOffset() + viewPortCenterDiff);
|
mLocalMap->setViewOffset(mLocalMap->getViewOffset() + viewPortCenterDiff);
|
||||||
mGlobalMap->setViewOffset(mGlobalMap->getViewOffset() + viewPortCenterDiff);
|
mGlobalMap->setViewOffset(mGlobalMap->getViewOffset() + viewPortCenterDiff);
|
||||||
|
|
||||||
lastCoordinates = currentCoordinates;
|
mLastScrollWindowCoordinates = currentCoordinates;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MapWindow::renderGlobalMap(Loading::Listener* loadingListener)
|
void MapWindow::renderGlobalMap(Loading::Listener* loadingListener)
|
||||||
|
|
|
@ -200,7 +200,7 @@ namespace MWGui
|
||||||
void onNoteEditDelete();
|
void onNoteEditDelete();
|
||||||
void onNoteEditDeleteConfirm();
|
void onNoteEditDeleteConfirm();
|
||||||
void onNoteDoubleClicked(MyGUI::Widget* sender);
|
void onNoteDoubleClicked(MyGUI::Widget* sender);
|
||||||
void onChangeCoord(MyGUI::Widget* sender);
|
void onChangeScrollWindowCoord(MyGUI::Widget* sender);
|
||||||
void globalMapUpdatePlayer();
|
void globalMapUpdatePlayer();
|
||||||
|
|
||||||
MyGUI::ScrollView* mGlobalMap;
|
MyGUI::ScrollView* mGlobalMap;
|
||||||
|
@ -212,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;
|
||||||
|
|
Loading…
Reference in a new issue