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

when using the expand function there is no way to expand it to the actual set size of the spilt , auto close gutter after a size like vs code #320

Open
mapurba opened this issue May 3, 2022 · 4 comments

Comments

@mapurba
Copy link

mapurba commented May 3, 2022

Hello ,
Hope u r all fine .

Please can we have expand to any size functionality

I am trying to achieve the functionality , where is the splitter drag size is in between 100 - 150 it will auto dock to min size .
that's works fine . but when I want to reopen the sidebar with expand function it opens to last remembered position
I need a way to expand it to the size set in the splitter
How can I do this , as per the code its not supported I hope so .
can this be taken in to .next release

  this.splitEl.dragProgress$.subscribe(
      (e: { gutterNum: number; sizes: Array<number> }) => {
        console.log("Drag progress: ", e.sizes[0]);
        if (this.lastpos > 150 && e.sizes[0] >= 100 && e.sizes[0] <= 150) {
          this.onClose1(34);
          this.lastpos = 34;
        }
        if (e.sizes[0] > 150) {
          this.lastpos = e.sizes[0];
        }
      }
    );
  onClose1(newSize = 34) {
    this.areasEl.first.collapse(newSize);
  }

  onOpen1() {
    this.areasEl.first.expand();
    this.splitEl.setVisibleAreaSizes(this.varea);
  }

this the gif
5ca01ac3-099d-4fc6-8148-d87cae504f80

@mapurba
Copy link
Author

mapurba commented May 3, 2022

I was able to do this by

ngAfterViewInit() {
 this.varea = this.splitEl.getVisibleAreaSizes();
}

onOpen1() {
  this.areasEl.first.expand();
  this.splitEl.setVisibleAreaSizes(this.varea);
}

I hope is am doing this right way

@mapurba
Copy link
Author

mapurba commented May 3, 2022

Update ..

Please can we have expand to any size functionality

46743216-0b06-469d-918c-d7dd7fb66b84

@Harpush
Copy link
Collaborator

Harpush commented Sep 2, 2023

This is technically a snap feature.
Aside from that, reverting back to initial size requires defining what initial size is.
For example if I have a binding to a component property that has on init size 40, then the user drag the gutter to size 30. In this case the initial is obviously 40. But, if later in time the property is altered from outside to 60 - what is the initial size? 30 or 60? The same applies if size has two way binding.

I think we can add a snap input for this feature but there are a few problems:

  1. Looking at vscode it recovers the snapped area back to the last "committed" size - hence last drop release size
  2. Do we hide the area or remove it? (visible vs ngIf behavior)
  3. Can the user expand it back with the gutter? If yes the answer to 2 is size 0
  4. Will probably require a new split area snapped event
  5. What is the threshold for closing and opening? Probably half the min size which configured the snap?

@Harpush
Copy link
Collaborator

Harpush commented Sep 2, 2023

Related to #193

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

No branches or pull requests

2 participants