Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using moveable(false) cause that the panel will not renderd with 100% height #94

Open
AFamularo-lomoSoft opened this issue Feb 29, 2016 · 1 comment

Comments

@AFamularo-lomoSoft
Copy link

Hello Jeff,

Scenario:

  • We want a fixed panel to give the user a "calm" experience - a safe location where a new detail panel will appear.

Steps:

  • Load the page
  • (You find the code in the file LomoDocker.js / Line 32)

moveable = true
moveable set to true

moveable= false
moveable set to false

Do I miss something?

Sample:
wcDocker.zip

Thank you.

Best,
Alexander

@Lochemage
Copy link
Contributor

@AFamularo-lomoSoft

I know why this is happening, it is a side effect of non-moveable panels. The problem is that non-moveable panels can also NOT be a drop target for other panels (the very act of docking a panel into another, moves both panels). Whenever your layout does not contain any valid drop targets, or moveable panels, a placeholder panel is introduced and automatically added to the layout (hence the empty gap you are seeing).

The placeholder is necessary because without it, you essentially lose all ability to edit your layout (you can no longer attach any new or existing panels because there are no valid drop targets). I know that is what you were intending in this case, but without the placeholder, you would also be permanently locked out of editing your layout if you happen to close all existing panels through the interface. You may get a better understanding if you were to add your non-moveable panel using DOCK.RIGHT, as it would then be docked to the right side of the empty space instead.

This is not an easy problem to solve, the placeholder exists solely to prevent a situation where your user is permanently locked out from using the interface at all. However, it seems that this is exactly what you intend to do, so in this case I will illustrate a simple hack you can do to force the effect you want:

myDocker.registerPanelType('myPanel', {
  isPrivate: true,
  onCreate: function(myPanel) {
    setTimeout(function() {
      myPanel.moveable(false);
    }, 0);
  }
});

By adding a timeout within the creation callback of the panel, and only assigning it as non-moveable after the creation has already happened, you essentially fool the interface into thinking it doesn't need the placeholder. The placeholder is only added when there are no valid drop targets during an add, remove, or move panel event, since you added a moveable panel to the interface, it does not need the placeholder. Changing the moveable attribute after it has already been added, and assuming you do not later add or adjust more panels, does not cause it to reassess whether it needs the placeholder again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants