Opened 8 years ago

Last modified 8 years ago

#6725 new Bug

Mismatch between dialog::resize and dialog::getSize

Reported by: Sa'ar Zac Elias Owned by:
Priority: Normal Milestone:
Component: UI : Dialogs Version:
Keywords: Cc:

Description (last modified by Sa'ar Zac Elias)

While working on #5084 I've noticed that there's a mismatch between the two methods.
The reason is that we use the contents element in the dialog::resize method, while we use the dialog element in the dialog::getSize method.

Change History (5)

comment:1 Changed 8 years ago by Sa'ar Zac Elias

Description: modified (diff)
Status: newconfirmed

comment:2 Changed 8 years ago by Frederico Caldeira Knabben

Status: confirmednew

I think the difference is propositional, because these methods are used for different needs. One is to control the internal size of the dialog (for content fitting needs), while the other brings the full size of it (for dialog movement control, probably).

In any case, if this has been the way for it since the beginning, changes to the current behavior would not be acceptable at this stage.

comment:3 Changed 8 years ago by Alfonso Martínez de Lizarrondo

I noticed (I think it's this problem) a few days ago while trying to make a dialog with iframe resize correctly. It was such a nightmare that I had to give up until I have enough time to understand what's going on, but something as simple as increase the size of the dialog by x pixels was impossible because it behaved wrong and this might be the reason.

So I wonder if anyone is using those methods because if it turns that they aren't used they could be fixed.

At the very least, we should provide some methods that do the right thing.

comment:4 Changed 8 years ago by Frederico Caldeira Knabben

@Alfonso, maybe you can explain what were you trying to do (code).

comment:5 Changed 8 years ago by Alfonso Martínez de Lizarrondo

The basic idea that I was working on is using an iframeDialog inside that iframe an image is loaded, so it's better if the whole dialog is resized if the current size doesn't allow to show the whole contents instead of using scrollbars.

So a basic idea might be to check the current size of the iframe and the whole dimensions (visible vs scrollable), to make them equal, so we take that difference and try to resize the main dialog. Ok as the dialogs doesn't have a resizeBy, let's easily do a getSize(), add the resizing and then call resize(), but then even if the resize is 0 in one dimension the dialog is resized.

That's just one example, other people might have other requirements.

Also, as the current dialog code doesn't check if the dialog fits into the main area, it's important to be careful while setting the initial dimensions of the iframeDialog, or the buttons will be out of view and can't be used as the dialog moves even if the user tries to scroll the page. So that's why I wanted to do the dynamic resize but had to give up until I have enough patience another day to rewrite enough of that code inside the plugin

Note: See TracTickets for help on using tickets.
© 2003 – 2019 CKSource – Frederico Knabben. All rights reserved. | Terms of use | Privacy policy