Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

optional dependencies lines, part 6

as-opfd4e60789bb4
diff --git a/app/models/work_package/pdf_export/gantt.rb b/app/models/work_package/pdf_export/gantt.rb
index 8cfcbea8b07..5f1d50aedb2 100644
--- a/app/models/work_package/pdf_export/gantt.rb
+++ b/app/models/work_package/pdf_export/gantt.rb
@@ -481,7 +481,7 @@ module WorkPackage::PDFExport::Gantt
end
# Builds the dependency line between two work packages on different horizontal pages
- # where the source work package page is before the target work package page
+ # and the source work package page is before the target work package page
# @param [GanttDataLineInfo] source
# @param [GanttDataLineInfo] target
# @param [Integer] start_page_index
@@ -532,21 +532,40 @@ module WorkPackage::PDFExport::Gantt
end
end
+ # Builds the dependency line between two work packages on different horizontal and vertical pages
+ # and the source work package page is before the target work package page
+ # @param [GanttDataLineInfo] source
+ # @param [GanttDataLineInfo] target
+ # @param [Integer] start_page_index
+ # @param [Integer] finish_page_index
+ # @param [Array<GanttDataPageGroup>] page_groups
def build_multi_group_dep_line_forward(source, target,
start_page_index, finish_page_index, page_groups)
build_multi_page_dep_line_forward_start(source)
build_multi_page_dep_line_middle(source, start_page_index, finish_page_index, source.finish_top)
- build_multi_group_dep_line_forward_end(source, target, finish_page_index, page_groups)
+ build_multi_group_dep_line_end(source, target, finish_page_index, page_groups)
end
+ # Builds the dependency line between two work packages on different horizontal and vertical pages
+ # and the source work package page is after the target work package page
+ # @param [GanttDataLineInfo] source
+ # @param [GanttDataLineInfo] target
+ # @param [Integer] start_page_index
+ # @param [Integer] finish_page_index
+ # @param [Array<GanttDataPageGroup>] page_groups
def build_multi_group_dep_line_backward(source, target,
start_page_index, finish_page_index, page_groups)
build_multi_page_dep_line_backward_start(source, source.finish_row.bottom)
build_multi_page_dep_line_middle(source, start_page_index, finish_page_index, source.finish_top)
- build_multi_group_dep_line_backward_end(source, target, page_groups)
+ build_multi_group_dep_line_end(source, target, finish_page_index, page_groups)
end
- def build_multi_group_dep_line_forward_end(source, target, finish_page_index, page_groups)
+
+ # Builds the dependency line between two work packages on different vertical pages
+ # draw line on the target work package page
+ # @param [GanttDataLineInfo] source
+ # @param [GanttDataLineInfo] target
+ def build_multi_group_dep_line_end(source, target, finish_page_index, page_groups)
target_left = target.start_left
page = source.finish_row.page.group.pages[finish_page_index]
page.add_lines(
@@ -555,6 +574,20 @@ module WorkPackage::PDFExport::Gantt
[target_left - LINE_STEP, target_left - LINE_STEP, source.finish_top, page.height],
]
)
+ build_multi_group_dep_line_middle(source, target, finish_page_index, page_groups)
+ target.start_row.page.add_lines(
+ [
+ [target_left - LINE_STEP, target_left - LINE_STEP, target.finish_row.page.header_row_height, target.finish_top],
+ [target_left - LINE_STEP, target_left, target.finish_top, target.finish_top]
+ ]
+ )
+ end
+
+ # Builds the dependency line between two work packages on different vertical pages
+ # draw line between the source and target work package pages
+ # @param [GanttDataLineInfo] source
+ # @param [GanttDataLineInfo] target
+ def build_multi_group_dep_line_middle(source, target, finish_page_index, page_groups)
start_group_index = page_groups.index(source.finish_row.page.group)
finish_group_index = page_groups.index(target.start_row.page.group)
start = [start_group_index, finish_group_index].min
@@ -562,18 +595,10 @@ module WorkPackage::PDFExport::Gantt
((start + 1)..(finish - 1)).each do |index|
group = page_groups[index]
page = group.pages[finish_page_index]
- page.add_line(target_left - LINE_STEP, page.columns.last.right, source.finish_top, source.finish_top)
+ page.add_line(target.start_left - LINE_STEP, page.columns.last.right, source.finish_top, source.finish_top)
end
- target.start_row.page.add_lines(
- [
- [target_left - LINE_STEP, target_left - LINE_STEP, target.finish_row.page.header_row_height, target.finish_top],
- [target_left - LINE_STEP, target_left, target.finish_top, target.finish_top]
- ]
- )
end
- def build_multi_group_dep_line_backward_end(source, target, page_groups) end
-
# Builds the text column data object if the page is first page of horizontal page group
# @param [Integer] page_index
def build_text_column(page_index)