Merge pull request #7698 from archimede67/use-editor-components

Use `CEditorComponent` methods instead of only `CMapView`
This commit is contained in:
Robert Müller 2023-12-23 15:47:45 +00:00 committed by GitHub
commit 8f3d09eb29
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 15 additions and 6 deletions

View file

@ -8164,6 +8164,9 @@ void CEditor::Render()
MapView()->Zoom()->ChangeValue(-20.0f);
}
for(CEditorComponent &Component : m_vComponents)
Component.OnRender(View);
MapView()->UpdateZoom();
UI()->RenderPopupMenus();
@ -8259,7 +8262,9 @@ void CEditor::Reset(bool CreateDefault)
UI()->ClosePopupMenus();
m_Map.Clean();
m_MapView.OnReset();
for(CEditorComponent &Component : m_vComponents)
Component.OnReset();
// create default layers
if(CreateDefault)
{
@ -8633,6 +8638,9 @@ void CEditor::OnUpdate()
DispatchInputEvents();
HandleAutosave();
HandleWriterFinishJobs();
for(CEditorComponent &Component : m_vComponents)
Component.OnUpdate();
}
void CEditor::OnRender()
@ -8760,7 +8768,9 @@ bool CEditor::Load(const char *pFileName, int StorageType)
str_copy(m_aFileName, pFileName);
SortImages();
SelectGameLayer();
MapView()->OnMapLoad();
for(CEditorComponent &Component : m_vComponents)
Component.OnMapLoad();
}
else
{

View file

@ -8,9 +8,8 @@ void CEditorObject::Init(CEditor *pEditor)
OnReset();
}
void CEditorObject::OnUpdate(CUIRect View)
void CEditorObject::OnUpdate()
{
OnRender(View);
if(IsActive())
OnActive();
else if(IsHot())

View file

@ -31,9 +31,9 @@ public:
virtual void Init(CEditor *pEditor);
/**
* Calls `OnRender` and then maybe `OnHot` or `OnActive`.
* Maybe calls `OnHot` or `OnActive`.
*/
void OnUpdate(CUIRect View);
virtual void OnUpdate();
/**
* Gets called before `OnRender`. Should return true