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
+1
View File
@@ -30,6 +30,7 @@ struct DispatcherMessageHandlers {
// In addition, these messages do not change any state in the backend (aside from caches). // In addition, these messages do not change any state in the backend (aside from caches).
const SIDE_EFFECT_FREE_MESSAGES: &[MessageDiscriminant] = &[ const SIDE_EFFECT_FREE_MESSAGES: &[MessageDiscriminant] = &[
MessageDiscriminant::Portfolio(PortfolioMessageDiscriminant::Document(DocumentMessageDiscriminant::RenderDocument)), MessageDiscriminant::Portfolio(PortfolioMessageDiscriminant::Document(DocumentMessageDiscriminant::RenderDocument)),
MessageDiscriminant::Portfolio(PortfolioMessageDiscriminant::Document(DocumentMessageDiscriminant::Overlays(OverlaysMessageDiscriminant::Rerender))),
MessageDiscriminant::Portfolio(PortfolioMessageDiscriminant::Document(DocumentMessageDiscriminant::FolderChanged)), MessageDiscriminant::Portfolio(PortfolioMessageDiscriminant::Document(DocumentMessageDiscriminant::FolderChanged)),
MessageDiscriminant::Frontend(FrontendMessageDiscriminant::UpdateDocumentLayer), MessageDiscriminant::Frontend(FrontendMessageDiscriminant::UpdateDocumentLayer),
MessageDiscriminant::Frontend(FrontendMessageDiscriminant::DisplayDocumentLayerTreeStructure), MessageDiscriminant::Frontend(FrontendMessageDiscriminant::DisplayDocumentLayerTreeStructure),
+15 -14
View File
@@ -18,26 +18,27 @@ impl MessageHandler<OverlaysMessage, bool> for OverlaysMessageHandler {
// Sub-messages // Sub-messages
#[remain::unsorted] #[remain::unsorted]
DispatchOperation(operation) => match self.overlays_graphene_document.handle_operation(&operation) { DispatchOperation(operation) => match self.overlays_graphene_document.handle_operation(&operation) {
Ok(_) => (), Ok(_) => responses.push_back(OverlaysMessage::Rerender.into()),
Err(e) => log::error!("OverlaysError: {:?}", e), Err(e) => log::error!("OverlaysError: {:?}", e),
}, },
// Messages // Messages
ClearAllOverlays => todo!(), ClearAllOverlays => todo!(),
Rerender => (), Rerender =>
} // Render overlays
{
// Render overlays responses.push_back(
responses.push_back( FrontendMessage::UpdateDocumentOverlays {
FrontendMessage::UpdateDocumentOverlays { svg: if overlays_visible {
svg: if overlays_visible { self.overlays_graphene_document.render_root(ViewMode::Normal)
self.overlays_graphene_document.render_root(ViewMode::Normal) } else {
} else { String::from("")
String::from("") },
}, }
.into(),
)
} }
.into(), }
);
} }
fn actions(&self) -> ActionList { fn actions(&self) -> ActionList {