-
Notifications
You must be signed in to change notification settings - Fork 530
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
Component reordering not working properly in GoldenLayout 2 #681
Comments
Discussed in #647 (near end) |
Hi Paul,
I reported two things in this issue:
Your first point is identical to my first point, but I'm not sure if I get your second point right. Does this mean "no additional configurability" or "we keep things as they are"? The second would mean no fix for this and different behavior compared to GoldenLayout 1.5.9 In case any of my points is officially recognized as a bug, please keep this ticket open, as the other ticket was originally on a completely different topic and is already closed. |
@andreasmueller92 The second one that As an additional explanation: |
@martin31821: If those reasons do not apply for drag as well, wouldn't it help to take dragability out of this constraint? Meaning that one can drag any component (independent of closability), but popouts only work for closable components? |
It is true that having that connected to dragability as well is a bit over-restricted, and I think for us it would be good to liften that restriction. @pbklink what do you think about that? |
Agree with all the above. I think the question is what to do about it. As mentioned in #647, the code for this inside Golden Layout is already quite messy. I do not want to add another 'fix' making it even more confusing. What it needs is some kind of clean up. Probably with new configuration properties which make more sense. I think the next step is to write up how it should work and get feedback. I have some ideas. Will post my thoughts after Virtual Components (#679) is released and bedded down and spare time permitting. |
What about the following solution? AFAICT it fixes the problem. diff --git a/src/ts/controls/header.ts b/src/ts/controls/header.ts
index 7f279dd..9aa5f45 100644
--- a/src/ts/controls/header.ts
+++ b/src/ts/controls/header.ts
@@ -358,15 +358,11 @@ export class Header extends EventEmitter {
/** @internal */
private handleTabInitiatedDragStartEvent(x: number, y: number, dragListener: DragListener, componentItem: ComponentItem) {
- if (!this._canRemoveComponent) {
- dragListener.cancelDrag();
- } else {
if (this._componentDragStartEvent === undefined) {
throw new UnexpectedUndefinedError('HHTDSE22294');
} else {
this._componentDragStartEvent(x, y, dragListener, componentItem);
}
- }
} |
@NotWearingPants I have come across this issue today and found the same reponsbile code as you causing the issue. Did you try using Golden Layout with that code removed and not notice any regressions? If so, potentially it is worth raising a PR |
FYI I have fixed the issue in our fork here genesiscommunitysuccess#2 |
Current behavior
miniRow
and hitLoad Layout
Golden
component cannot be reordered, while theLayout
one can be dragged to a new position.Expected behavior:
It should be possible to reorder all components, independent of their closability.
Code example:
After a lot of trial and error, it comes down to component closability and header configuration, as described below.
Sorry in advance for not providing a standalone CodePen example, but I could not find a bundled GoldenLayout 2 JS source file as in the v1.5.9 CodePen example.
The following minimal example allows all components to be moved around (while being closable):
(1)
tofalse
will break reordering behavior for all components. In addition, the close buttons on the tabs won't work anymore, is any of these consequences intended?(2)
or(3)
tofalse
will break reordering behavior for that specific component. This is what happens in the apitest example.And, even more confusing, setting
(2)
tofalse
and following the next steps will result in both tabs being unable to be reordered:Layout
onto the same stack asGolden
Golden
(which suddenly becomes dragable) away from the stack so that is above/below/right of/left ofLayout
The text was updated successfully, but these errors were encountered: