stable

Clone or download

Read-only

Reduce gap to not produce scroll overflow

Given a gantt chart with at least two tasks, with a dependency from a task to the last one, When we display the dependencies, Then a vertical scrollbar appears at the right of the chart. πŸ˜• Context ======= As explain in commit ["Introduce arrows for dependencies"][0], we use a safety gap to ensure that path, arrows, half turn can be displayed. ``` svg ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓ ┃ ┃ ┃ ┃ ┃ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”β”β”“ ┃ ┃ β”‚ β”‚ ┃ ┃ ┃ ┏━━━━━━━━━━━━━━━━━━━━━━━┛ ┃ ┃ ┃ β”‚ β”‚ ┃ ┃ ┃ β”‚ β”‚ ┃ ┃ ┃ β”‚ β”‚ ┃ ┃ ┃ β”‚ β”‚ ┃ ┃ ┃ β”‚ β”‚ ┃ ┃ ┃ β”‚ β”‚ ┃ | gap ┃ ┃ β”‚ β”‚ ┃ v ┃ β”—β”β–Άβ””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜---------+- ┃ | ┃ | ┃ | ┃ | ┗━━━━━━━━━━━━━━━━━━━━━━━|━━━━┛----+- | | gap | | ----->+----+ | | ``` We chose an arbitrary value of 2 Γ— offset + radius to have enough room. If we zoom in: ``` gap │◀──────────────────▢▒ β”‚ β–’ β”‚offset radius offsetβ–’ │◀────▢│◀────▢│◀────▢▒ β”‚ β”‚ β”‚ β–’ β”‚ β”‚ β”‚ β–’ β”‚ β”‚ β”‚ β–’ β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ β”‚ β–’ β–ˆβ–ˆ β”‚ β–’ β–ˆ β”‚ β–’ β–ˆβ”‚ β–’ β–ˆβ”‚ β–’ β–ˆ β–’ β–ˆ β–’ β–ˆ β–’ β–’ β–’ ``` Problem ======= The extra offset is a wasted space, but most important, it adds unecessary height to the svg graph, producing a scroll overflow when the arrow start from or points to the last task of the graph. Since the arrow is positionned at the middle of the task bar, the gap should be lesser than the half of the height of the task. For example, until now, gap was 24 (2 Γ— 8 + 8) while the height of the task is 40: 24 > 40/2 => meh ☹️. ``` ┆ ╠═══════════╬══│════════┃════════════════════════════════════════ β•‘ β•‘ β”‚ ┃ ʌ β•‘ β•‘ β”‚ ┃ ┏━━━━━━━━━━━━━━━━━━━┓ | β•‘ task #123 β•‘ β”‚ -----β”—β”β–Άβ”ƒβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ”ƒ | Task height β•‘ β•‘ β”‚ ʌ ┗━━━━━━━━━━━━━━━━━━━┛ | β•‘ β•‘ β”‚ |gap v β•šβ•β•β•β•β•β•β•β•β•β•β•β•©β•β•β”‚β•β•β•β•β•|═══════════════════════════════════════════ β”‚ v └─────────────────┄┄ svg ``` Solution ======== The proposal is to remove the extra offset from the gap (but keep 1px room for the display of the line): ``` gap │◀────────────▢▒ β”‚ β–’ β”‚offset radius β–’ │◀────▢│◀────▢│▒ β”‚ β”‚ β”‚β–’ β”‚ β”‚ β”‚β–’ β”‚ β”‚ β”‚β–’ β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ β”‚β–’ β–ˆβ–ˆ β”‚β–’ β–ˆ β”‚β–’ β–ˆβ”‚β–’ β–ˆβ”‚β–’ β–ˆβ–’ β–ˆβ–’ β–ˆβ–’ β–’ β–’ ``` With the current settings we have now: gap = offset + radius + 1 = 17 wich is less than 40/2 => no moar scrollbar πŸŽ‰ Part of story #19734: have a Roadmap widget on dashboard [0]: git #tuleap/stable/acb60c4c1af35694ed8fbc1f17a0e29435f8c922 Change-Id: I1cbb785faca14bfd4c67a67de153669f6a61c37b

Modified Files

Name
M plugins/roadmap/scripts/roadmap-widget/src/components/Gantt/Task/DependencyArrow.test.ts +24 βˆ’24 Go to diff View file
M plugins/roadmap/scripts/roadmap-widget/src/helpers/path.test.ts +16 βˆ’11 Go to diff View file
M plugins/roadmap/scripts/roadmap-widget/src/helpers/path.ts +1 βˆ’1 Go to diff View file
M plugins/roadmap/scripts/roadmap-widget/src/helpers/svg-arrow-path.test.ts +6 βˆ’6 Go to diff View file