WebCabin / wcDocker

wcDocker (Web Cabin Docker) is a powerful window layout system with a responsive and completely interactive design. Move, remove, create, and duplicate panel windows at any time! Organize how you wish! View the demo here:
http://docker.webcabin.org
146 stars 53 forks source link

Panel initial width / height #72

Open bulentv opened 9 years ago

bulentv commented 9 years ago

A question : What is the proper way to set a panel's width and / or height (not minWidth or minHeight) ?

For example this doesn't work : (/Code/demo/demoAMD.js, first chat panel's addPanel code, adding 'w' parameter to the option parameter)

var chatPanel1 = myDocker.addPanel('Chat Panel', wcDocker.DOCK.BOTTOM, null, {w: "100px", h: '20%'});
Lochemage commented 9 years ago

@bulentv

You are doing it correctly, however, it is not guaranteed that you will get the size you selected as there are many constraints within the layout. Sometimes, based on the configuration, it's just not possible to set the size to that exact value, and sometimes it may have actually set the size, but another panel added later could cause it to resize again.

In your case, since you docked it to the bottom of the entire docker, it simply can't resize its width because it must match the size of the window (there are no splitters on either side that will allow you to resize the panel).

Does this answer your question?

bulentv commented 9 years ago

@Lochemage

Yes I understand that there are constraints but I believe this still can be improved. Developer doesn't have to be prevented setting the initial width or height for at least some panels.

For the example above; the user is able to resize the both chat panels on runtime by dragging the shared vertical edge to the left or right like a splitter. So I think the developer should either be able to set the width of the firstly added chat panel or quickly resize the panels after adding the both. The second chat panel will obviously has some constrains (width, for the instance) to ignore any initial size value given, which is acceptable.