Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 15 additions & 8 deletions source/control_dialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -1087,21 +1087,28 @@ def handle_tree_selection(self, selected_node):
def move_selected_shape(self, event):
"""Move single selected shape around in the hierarchy"""

# Get all selected tree items
tree_items = self._get_selected_tree_items()
if not tree_items:
return

controller = self.get_controller()
diagram = controller.get_diagram()

tree_item = tree_items[0]
curr_shape = controller.get_selected_shape()
if curr_shape is None:
return

tree_item = None
for ti in self._node_to_tree_item_map.values():
if ti.get_rectangle_shape() == curr_shape:
tree_item = ti
break

if tree_item is None:
return

if tree_item:
if event.KeyCode == Key.LEFT:
# move one level up, as next sibling of immediate parent
parent_item = tree_item.get_dad()
if parent_item != None:
# prevent a direct child element of root being moved up the hierarchy
if parent_item != None and parent_item.get_dad() != None:
diagram.move_tree_item(tree_item, parent_item, "sibling")
elif event.KeyCode == Key.RIGHT:
# move one level down, relative to next-upwards sibling
Expand Down Expand Up @@ -1135,7 +1142,7 @@ def move_selected_shape(self, event):
# make sure same entry is still selected
curr_shape = tree_item.get_rectangle_shape()
if curr_shape:
controller.set_selected_shape(curr_shape)
self.select_tree_node_for_shape(curr_shape)


def sync_all_selected_shapes_to_document(self):
Expand Down