Patch #44637 ยป 0001-Remove-unnecessary-Gantt-redraws-on-window-resize.patch
| app/helpers/gantt_helper.rb | ||
|---|---|---|
|
# - `gantt--options` toggles checkboxes under Options.
|
||
|
# - `gantt--subjects` reports tree expand/collapse.
|
||
|
# - Mouse events synchronize the hovered row across the chart panes.
|
||
|
# - Window resize triggers a redraw of progress lines and relations.
|
||
|
# - Window resize updates selected column visibility for mobile layouts.
|
||
|
action: %w(
|
||
|
gantt--options:toggle-display@document->gantt--chart#handleOptionsDisplay
|
||
|
gantt--options:toggle-relations@document->gantt--chart#handleOptionsRelations
|
||
| app/javascript/controllers/gantt/chart_controller.js | ||
|---|---|---|
|
handleWindowResize() {
|
||
|
this.handleChartResize()
|
||
|
this.#drawProgressLineAndRelations()
|
||
|
this.#drawSelectedColumns()
|
||
|
}
|
||
| test/system/gantts_test.rb | ||
|---|---|---|
|
assert_equal expected_width, column_width('subjects')
|
||
|
end
|
||
|
test 'window resizing preserves line positions and updates selected columns' do
|
||
|
visit_gantt
|
||
|
expand_options
|
||
|
find('#draw_selected_columns').check
|
||
|
find('#draw_progress_line').check
|
||
|
assert_selector '.gantt-relations path', minimum: 1
|
||
|
line_positions = -> { page.evaluate_script("Array.from(document.querySelectorAll('.gantt-relations path'), path => path.getAttribute('d'))") }
|
||
|
positions_before_resize = line_positions.call
|
||
|
[[899, :hidden], [900, :visible]].each do |width, visibility|
|
||
|
page.current_window.resize_to(width, 900)
|
||
|
assert_selector '.gantt-selected-column', visible: visibility
|
||
|
assert_equal positions_before_resize, line_positions.call
|
||
|
end
|
||
|
ensure
|
||
|
page.current_window.resize_to(1024, 900)
|
||
|
end
|
||
|
test 'context menu and tooltip interactions' do
|
||
|
visit_gantt
|
||