Patch #44637 ยป 0001-Remove-unnecessary-Gantt-redraws-on-window-resize.patch
| app/helpers/gantt_helper.rb | ||
|---|---|---|
| 222 | 222 |
# - `gantt--options` toggles checkboxes under Options. |
| 223 | 223 |
# - `gantt--subjects` reports tree expand/collapse. |
| 224 | 224 |
# - Mouse events synchronize the hovered row across the chart panes. |
| 225 |
# - Window resize triggers a redraw of progress lines and relations.
|
|
| 225 |
# - Window resize updates selected column visibility for mobile layouts.
|
|
| 226 | 226 |
action: %w( |
| 227 | 227 |
gantt--options:toggle-display@document->gantt--chart#handleOptionsDisplay |
| 228 | 228 |
gantt--options:toggle-relations@document->gantt--chart#handleOptionsRelations |
| app/javascript/controllers/gantt/chart_controller.js | ||
|---|---|---|
| 87 | 87 | |
| 88 | 88 |
handleWindowResize() {
|
| 89 | 89 |
this.handleChartResize() |
| 90 |
this.#drawProgressLineAndRelations() |
|
| 91 | 90 |
this.#drawSelectedColumns() |
| 92 | 91 |
} |
| 93 | 92 | |
| test/system/gantts_test.rb | ||
|---|---|---|
| 179 | 179 |
assert_equal expected_width, column_width('subjects')
|
| 180 | 180 |
end |
| 181 | 181 | |
| 182 |
test 'window resizing preserves line positions and updates selected columns' do |
|
| 183 |
visit_gantt |
|
| 184 |
expand_options |
|
| 185 |
find('#draw_selected_columns').check
|
|
| 186 |
find('#draw_progress_line').check
|
|
| 187 | ||
| 188 |
assert_selector '.gantt-relations path', minimum: 1 |
|
| 189 |
line_positions = -> { page.evaluate_script("Array.from(document.querySelectorAll('.gantt-relations path'), path => path.getAttribute('d'))") }
|
|
| 190 |
positions_before_resize = line_positions.call |
|
| 191 | ||
| 192 |
[[899, :hidden], [900, :visible]].each do |width, visibility| |
|
| 193 |
page.current_window.resize_to(width, 900) |
|
| 194 | ||
| 195 |
assert_selector '.gantt-selected-column', visible: visibility |
|
| 196 |
assert_equal positions_before_resize, line_positions.call |
|
| 197 |
end |
|
| 198 |
ensure |
|
| 199 |
page.current_window.resize_to(1024, 900) |
|
| 200 |
end |
|
| 201 | ||
| 182 | 202 |
test 'context menu and tooltip interactions' do |
| 183 | 203 |
visit_gantt |
| 184 | 204 | |