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
d8fb65be
Commit
d8fb65be
authored
1 year ago
by
duncan
Browse files
Options
Downloads
Patches
Plain Diff
fix(resize): fix the position of the drag, and set a minimum width/height
parent
270198c7
No related branches found
Branches containing commit
No related tags found
2 merge requests
!135
geo intergation
,
!129
Feat/visManager
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
libs/shared/lib/components/Resizable.tsx
+14
-6
14 additions, 6 deletions
libs/shared/lib/components/Resizable.tsx
with
14 additions
and
6 deletions
libs/shared/lib/components/Resizable.tsx
+
14
−
6
View file @
d8fb65be
...
...
@@ -54,15 +54,23 @@ export const Resizable = ({
setDragging
(
false
);
window
.
removeEventListener
(
'
mouseup
'
,
onMouseUp
);
};
function
onMouseMove
(
e
:
React
.
MouseEvent
<
HTMLDivElement
,
MouseEvent
>
)
{
if
(
dragging
)
{
if
(
horizontal
&&
ref
.
current
)
{
if
(
ref
.
current
)
{
const
rect
=
ref
.
current
.
getBoundingClientRect
();
setFirstSize
(
e
.
clientX
);
setSecondSize
(
rect
.
width
-
e
.
clientX
);
}
else
{
setFirstSize
(
e
.
clientY
);
setSecondSize
(
window
.
innerHeight
-
e
.
clientY
);
const
relativeX
=
e
.
clientX
-
rect
.
left
;
const
relativeY
=
e
.
clientY
-
rect
.
top
;
const
minSizeX
=
16
;
const
minSizeY
=
28
;
if
(
horizontal
)
{
setFirstSize
(
Math
.
max
(
minSizeX
,
relativeX
));
setSecondSize
(
Math
.
max
(
minSizeX
,
rect
.
width
-
relativeX
));
}
else
{
setFirstSize
(
Math
.
max
(
minSizeY
,
relativeY
));
setSecondSize
(
Math
.
max
(
minSizeY
,
rect
.
height
-
relativeY
));
}
}
}
}
...
...
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