Fix live-mode link navigation not selecting the target link
In live mode the DOM is rebuilt from the device when switching sheets, creating new element objects. The pending link from the old tree could not be found by identity in canvas_link_map. Re-resolve it by from/to attributes after the rebuild so the selection matches. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
+1
-1
@@ -8,7 +8,7 @@ so later rebinding would only ever be seen by the module that did it.
|
||||
import configparser
|
||||
import os
|
||||
|
||||
VERSION = "0.0.0.094"
|
||||
VERSION = "0.0.0.095"
|
||||
PROPERTIES_FILE = os.path.join(os.path.dirname(os.path.abspath(__file__)), "editor.properties")
|
||||
DEFAULT_GRID_SIZE = 10
|
||||
DEFAULT_ADD_TIMESTAMP = True
|
||||
|
||||
@@ -637,6 +637,18 @@ def on_tree_select(event):
|
||||
except Exception:
|
||||
import traceback; traceback.print_exc()
|
||||
|
||||
# The DOM rebuild replaced every element object, so a pending link from the
|
||||
# old tree can no longer be found by identity. Re-resolve it by from/to.
|
||||
if pending_link is not None:
|
||||
old_from = pending_link.get("from", "")
|
||||
old_to = pending_link.get("to", "")
|
||||
links_container = app_state.xml_root_element.find("links") if app_state.xml_root_element is not None else None
|
||||
if links_container is not None:
|
||||
for lnk in links_container:
|
||||
if lnk.get("from") == old_from and lnk.get("to") == old_to:
|
||||
pending_link = lnk
|
||||
break
|
||||
|
||||
if element is not None:
|
||||
components_to_render = [child for child in element if child.tag == "comp"]
|
||||
elif tree.exists(selected_id):
|
||||
|
||||
Reference in New Issue
Block a user