Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
F
Frontend V2
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
GraphPolaris
Frontend V2
Commits
3c437cdb
Commit
3c437cdb
authored
9 months ago
by
Leonardo
Browse files
Options
Downloads
Patches
Plain Diff
fix: stacked resizable not properly resizing
parent
a13e17d9
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
libs/shared/lib/components/layout/Resizable.tsx
+15
-6
15 additions, 6 deletions
libs/shared/lib/components/layout/Resizable.tsx
with
15 additions
and
6 deletions
libs/shared/lib/components/layout/Resizable.tsx
+
15
−
6
View file @
3c437cdb
...
...
@@ -38,9 +38,14 @@ export const Resizable = ({
useEffect
(()
=>
{
const
handleResize
=
()
=>
{
setWindowSize
({
width
:
window
.
innerWidth
,
height
:
window
.
innerHeight
});
setTimeout
(()
=>
{
// Sometimes the window size is not updated immediately to the proper amount, so retry after 100ms
// setWindowSize({ width: window.innerWidth, height: window.innerHeight });
},
100
);
};
window
.
addEventListener
(
'
resize
'
,
handleResize
);
if
(
ref
.
current
)
new
ResizeObserver
(
handleResize
).
observe
(
ref
.
current
);
return
()
=>
{
window
.
removeEventListener
(
'
resize
'
,
handleResize
);
...
...
@@ -54,11 +59,15 @@ export const Resizable = ({
if
(
ref
.
current
)
{
const
rect
=
ref
.
current
.
getBoundingClientRect
();
if
(
horizontal
)
{
setFirstSize
((
rect
.
width
-
divisorSize
)
*
currentProportion
);
setSecondSize
((
rect
.
width
-
divisorSize
)
*
(
1
-
currentProportion
));
const
newFirstSize
=
(
rect
.
width
-
divisorSize
)
*
currentProportion
;
const
newSecondSize
=
(
rect
.
width
-
divisorSize
)
*
(
1
-
currentProportion
);
setFirstSize
(
newFirstSize
);
setSecondSize
(
newSecondSize
);
}
else
{
setFirstSize
((
rect
.
height
-
divisorSize
)
*
currentProportion
);
setSecondSize
((
rect
.
height
-
divisorSize
)
*
(
1
-
currentProportion
));
const
newFirstSize
=
(
rect
.
height
-
divisorSize
)
*
currentProportion
;
const
newSecondSize
=
(
rect
.
height
-
divisorSize
)
*
(
1
-
currentProportion
);
setFirstSize
(
newFirstSize
);
setSecondSize
(
newSecondSize
);
}
}
},
[
ref
.
current
,
windowSize
]);
...
...
@@ -123,7 +132,7 @@ export const Resizable = ({
{
firstSize
>
0
&&
(
<>
<
div
className
=
{
'
h-full w-full
'
+
(
classNameLeft
!==
undefined
?
classNameLeft
:
''
)
}
className
=
{
'
h-full w-full
flex-grow
'
+
(
classNameLeft
!==
undefined
?
classNameLeft
:
''
)
}
style
=
{
horizontal
?
{
maxWidth
:
firstSize
}
:
{
maxHeight
:
firstSize
}
}
>
{
children2
[
0
]
}
...
...
@@ -140,7 +149,7 @@ export const Resizable = ({
onTouchCancel
=
{
onTouchCancel
}
></
div
>
<
div
className
=
{
'
h-full w-full
'
+
(
classNameRight
!==
undefined
?
classNameRight
:
''
)
}
className
=
{
'
h-full w-full
flex-grow
'
+
(
classNameRight
!==
undefined
?
classNameRight
:
''
)
}
style
=
{
horizontal
?
{
maxWidth
:
secondSize
}
:
{
maxHeight
:
secondSize
}
}
>
{
children2
[
1
]
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment