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

Resizable master panel #24

Open
primozpadar opened this issue Mar 7, 2023 · 0 comments
Open

Resizable master panel #24

primozpadar opened this issue Mar 7, 2023 · 0 comments

Comments

@primozpadar
Copy link

  • Make master panel resizable with mouse drag
  • Store most recent width of the panel to the local storage

Example how this can be achieved with css variables:

  function handleMouseDown() {
    document.addEventListener("mousemove", handleMouseMove);
    document.addEventListener("mouseup", handleMouseUp, { once: true });
  }

  function handleMouseMove(e) {
    const width = Math.max(MIN_WIDTH, e.screenX);
    document.documentElement.style.setProperty("--editor-width", `${width}px`);
  }

  function handleMouseUp() {
    document.removeEventListener("mousemove", handleMouseMove);
  }

And add --editor-width to the css root

:root {
    --editor-width: 300px;
}
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

1 participant