Fix ghost pages having no size
This commit is contained in:
parent
aa02506d4c
commit
375e87ec84
@ -1098,13 +1098,12 @@ class GLWidget(UndoableInteractionMixin, QOpenGLWidget):
|
||||
if not hasattr(main_window, 'project'):
|
||||
return False
|
||||
|
||||
# Get full layout with ghosts to determine insertion position
|
||||
layout_with_ghosts = main_window.project.calculate_page_layout_with_ghosts()
|
||||
# Get page positions which includes ghosts
|
||||
page_positions = self._get_page_positions()
|
||||
|
||||
# Track which index in the page list corresponds to each position
|
||||
ghost_index = 0
|
||||
for idx, ((page_type, page_obj_layout, logical_pos), (_, page_or_ghost, y_offset)) in enumerate(zip(layout_with_ghosts, page_positions)):
|
||||
# Check each position for ghost pages
|
||||
for idx, (page_type, page_or_ghost, y_offset) in enumerate(page_positions):
|
||||
# Skip non-ghost pages
|
||||
if page_type != 'ghost':
|
||||
continue
|
||||
|
||||
@ -1129,8 +1128,8 @@ class GLWidget(UndoableInteractionMixin, QOpenGLWidget):
|
||||
# Check if click is anywhere on the ghost page (entire page is clickable)
|
||||
if renderer.is_point_in_page(x, y):
|
||||
# User clicked the ghost page!
|
||||
# Calculate the insertion index (count real pages before this ghost)
|
||||
insert_index = sum(1 for i, (pt, _, _) in enumerate(layout_with_ghosts) if i < idx and pt == 'page')
|
||||
# Calculate the insertion index (count real pages before this ghost in page_positions)
|
||||
insert_index = sum(1 for i, (pt, _, _) in enumerate(page_positions) if i < idx and pt == 'page')
|
||||
|
||||
print(f"Ghost page clicked at index {insert_index} - inserting new page in place")
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user