We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent d6fc3e4 commit b8edcd6Copy full SHA for b8edcd6
1 file changed
opencti-platform/opencti-front/src/components/graph/utils/useGraphInteractions.ts
@@ -79,8 +79,17 @@ const useGraphInteractions = () => {
79
const zoomToFit = () => {
80
const nbOfNodes = graphData?.nodes.length ?? 0;
81
let padding = 50;
82
- if (nbOfNodes === 1) padding = 300;
83
- else if (nbOfNodes < 4) padding = 200;
+ if (nbOfNodes === 1) {
+ if (window.innerHeight < 600) {
84
+ padding = 50;
85
+ } else if (window.innerHeight < 900) {
86
+ padding = 150;
87
+ } else if (window.innerHeight < 1100) {
88
+ padding = 300;
89
+ } else {
90
+ padding = 400;
91
+ }
92
+ } else if (nbOfNodes < 4) padding = 200;
93
else if (nbOfNodes < 8) padding = 100;
94
// Different padding depending on the number of nodes in the graph.
95
graphRef2D.current?.zoomToFit(400, padding);
0 commit comments