Fix broken Opacity slider in Layers panel (#2004)

Fix Opacity slider in Layers panel adding Transactions on_update and add Transactions when on_commit
This commit is contained in:
Utsav Singh 2024-09-24 02:06:28 +05:30 committed by GitHub
parent 8a1089938e
commit b57c53a427
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -974,12 +974,7 @@ impl MessageHandler<DocumentMessage, DocumentMessageData<'_>> for DocumentMessag
}
DocumentMessage::SetOpacityForSelectedLayers { opacity } => {
let opacity = opacity.clamp(0., 1.);
let mut added_transaction = false;
for layer in self.network_interface.selected_nodes(&[]).unwrap().selected_layers_except_artboards(&self.network_interface) {
if !added_transaction {
responses.add(DocumentMessage::AddTransaction);
added_transaction = true;
}
responses.add(GraphOperationMessage::OpacitySet { layer, opacity });
}
}
@ -1942,6 +1937,7 @@ impl DocumentMessageHandler {
Message::NoOp
}
})
.on_commit(|_| DocumentMessage::AddTransaction.into())
.widget_holder(),
//
Separator::new(SeparatorType::Unrelated).widget_holder(),