forked from 1b-agent/opencadstudio-upstream
Publish built-in document edits to V4 plugins
This commit is contained in:
1 parent
79028bcee4
commit
93afe91afc
4 files changed
+63
-1
No files matched your search
@@ -262,6 +262,23 @@ impl OpenCADStudio {
|
||||
crate::plugin::v4_support::publish_selection_changed_v4(tab_id, handles);
|
||||
}
|
||||
|
||||
/// Refresh the shared V4 document after built-in geometry edits. Plugin
|
||||
/// writes publish through HostSession immediately; the fingerprint avoids
|
||||
/// sending a duplicate notification at this message boundary.
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
pub(super) fn notify_plugins_document_changed(&mut self) {
|
||||
if self.active_tab >= self.tabs.len() {
|
||||
return;
|
||||
}
|
||||
let tab = &self.tabs[self.active_tab];
|
||||
let key = (tab.id, tab.scene.geometry_epoch);
|
||||
if self.last_plugin_document == Some(key) {
|
||||
return;
|
||||
}
|
||||
self.last_plugin_document = Some(key);
|
||||
crate::plugin::v4_support::publish_document_view_v4(tab.id, &tab.scene.document);
|
||||
}
|
||||
|
||||
pub fn update(&mut self, msg: Message) -> Task<Message> {
|
||||
self.control_observe_user_message(&msg);
|
||||
let perf_started = crate::perf::enabled().then(Instant::now);
|
||||
@@ -319,6 +336,8 @@ impl OpenCADStudio {
|
||||
// and plugin request draining).
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
self.notify_plugins_selection_changed();
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
self.notify_plugins_document_changed();
|
||||
// OTRACK acquires tracking points only while a command or grip drag is
|
||||
// running; drop them once neither is active so the temporary tracking
|
||||
// points / vectors disappear when the command ends (issue #64).
|
||||
|
||||
Reference in new issue
Block a user