antoniandre / splitpanes

A Vue 3 (and 2) reliable, simple and touch-ready panes splitter / resizer.
https://antoniandre.github.io/splitpanes
MIT License
1.85k stars 166 forks source link

Emit double click event #182

Open giuppep opened 1 year ago

giuppep commented 1 year ago

Currently it's possible to maximise the panel after a splitter by double clicking on it. However, this is not necessarily the behaviour one would generally expect.

For example, I'd like to be able to reset the initial size of the panes when double clicking on the splitter. As another example, one may want to maximise the pane before the splitter - as already mentioned in the docs:

You can also double click a splitter to maximize the next pane! (First pane splitter will be an option soon)

Other users may want to implement other custom behaviour, see e.g. #181.

These issues could all be solved by simply emitting the double-click event and let the user handle it how they like.

M1CK431 commented 1 year ago

I have this need too. Can't use this lib until it's finally handled 😢

mariusvigariu commented 1 year ago

Try this:

  let splitterClickCount = 0 

  const onSplitterClick = () => {
    splitterClickCount += 1
    if (splitterClickCount === 2) {
      doStuffOnDblClick()
      splitterClickCount = 0 
    }
  }