De duplicate Overlay render messages (#520)

This commit is contained in:
TrueDoctor 2022-02-07 19:15:25 +01:00 committed by Keavon Chambers
parent 386c970b60
commit 5ea4654f53
2 changed files with 16 additions and 14 deletions

View File

@ -30,6 +30,7 @@ struct DispatcherMessageHandlers {
// In addition, these messages do not change any state in the backend (aside from caches).
const SIDE_EFFECT_FREE_MESSAGES: &[MessageDiscriminant] = &[
MessageDiscriminant::Portfolio(PortfolioMessageDiscriminant::Document(DocumentMessageDiscriminant::RenderDocument)),
MessageDiscriminant::Portfolio(PortfolioMessageDiscriminant::Document(DocumentMessageDiscriminant::Overlays(OverlaysMessageDiscriminant::Rerender))),
MessageDiscriminant::Portfolio(PortfolioMessageDiscriminant::Document(DocumentMessageDiscriminant::FolderChanged)),
MessageDiscriminant::Frontend(FrontendMessageDiscriminant::UpdateDocumentLayer),
MessageDiscriminant::Frontend(FrontendMessageDiscriminant::DisplayDocumentLayerTreeStructure),

View File

@ -18,26 +18,27 @@ impl MessageHandler<OverlaysMessage, bool> for OverlaysMessageHandler {
// Sub-messages
#[remain::unsorted]
DispatchOperation(operation) => match self.overlays_graphene_document.handle_operation(&operation) {
Ok(_) => (),
Ok(_) => responses.push_back(OverlaysMessage::Rerender.into()),
Err(e) => log::error!("OverlaysError: {:?}", e),
},
// Messages
ClearAllOverlays => todo!(),
Rerender => (),
}
// Render overlays
responses.push_back(
FrontendMessage::UpdateDocumentOverlays {
svg: if overlays_visible {
self.overlays_graphene_document.render_root(ViewMode::Normal)
} else {
String::from("")
},
Rerender =>
// Render overlays
{
responses.push_back(
FrontendMessage::UpdateDocumentOverlays {
svg: if overlays_visible {
self.overlays_graphene_document.render_root(ViewMode::Normal)
} else {
String::from("")
},
}
.into(),
)
}
.into(),
);
}
}
fn actions(&self) -> ActionList {