jsPanel4 icon indicating copy to clipboard operation
jsPanel4 copied to clipboard

Resizing a panel from the left to a contained limit is buggy

Open kirat68 opened this issue 4 years ago • 3 comments

Hello there, Thank you for this nice piece of code. Could you check this issue when resizing a panel to the left using containment ? I have attached a video to show the problem that I think is related to the line 4211 of jspanel.js

   if (w <= maxWidth && w >= minWidth && w <= maxWidthWest) {

---> self.style.left = startLeft + (eventX - startX) / scaleFactor.x + xDif + 'px'; }

https://user-images.githubusercontent.com/34959570/109388535-aaa70c00-78ff-11eb-948d-6a8f1c52bfd4.mp4

kirat68 avatar Feb 27 '21 13:02 kirat68

@kirat68 Hi there ... and thanks for the praise :smile: Well, I'm aware of this issue already (although I didn't observe it as severe as in your demo video yet). The point is that there are a lot of calculations going on in this process. The panel has to be resized and repositioned and checked for the containment settings, and all simultaneously. That seems to be heavy on the CPU. And yes, the way I programmed that could most probably be improved. I might try a different approach when I recode the complete resizeit interaction. But I don't think this will happen within v4.x.x. So for the time being you have to live with it, sorry. Regards, Stefan

Flyer53 avatar Feb 27 '21 19:02 Flyer53

Bonjour ! Thank you for your quick answer ! Yes, I see how complex the code is at that place and do not understand all involved interactions. But would it be not enough to add this line of code:

            if (w >= maxWidthWest) {
         +   self.style.left = opts.containment[1];
              w = maxWidthWest;
            } 

At least for now it solves this specific bug, but I don't know if it has an impact other functionalities.

kirat68 avatar Feb 28 '21 08:02 kirat68

Hi again, Your welcome! Well, all those checks are there for a reason. Option resizeit allows for quite a few parameters. And those parameters need to be checked while resizing a panel. Otherwise they wouldn't make a lot of sense, don't you think so? Sure, the code could be improved to remove such issues. But as said, this will probably have to wait until I either completely recode the resizeit interaction or start with a new major version of jsPanel.

Happy coding ... and stay healthy, Stefan

Flyer53 avatar Feb 28 '21 12:02 Flyer53