solve solution is
I understand your issue. Let me explain what's happening and how to fix it in simple terms:
The problem:
Your mousemove event is firing all the time, even when you're just hovering, not clicking and dragging. This happens because mousemove events occur whenever the mouse moves, regardless of whether a button is pressed.
Why it's happening:
You set up a mousedown event to initialize your resizing (setting the default size).
You also set up a mousemove event to handle the resizing.
But the mousemove event listener is always active, not just when the mouse button is down.
The solution:
We need to make the mousemove event only work when the mouse button is pressed. Here's how to do it:
In your mousedown event, set a flag variable (let's call it isResizing) to true.
In your mousemove event, check if this flag is true before doing any resizing.
Add a mouseup event that sets the flag back to false.