Skip to content

Commit

Permalink
attach drag handler to body for better experience
Browse files Browse the repository at this point in the history
  • Loading branch information
sgratzl committed Mar 31, 2020
1 parent 2fcc3d6 commit d74607b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
4 changes: 4 additions & 0 deletions src/styles/engine/_header.scss
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,10 @@
}
}

.#{$lu_css_prefix}-resizing {
cursor: col-resize !important;
}

// FIXME
.#{$lu_css_prefix}-dialog-sub-nested > section {
margin-bottom: $lu_engine_grip_gap + 15px;
Expand Down
4 changes: 3 additions & 1 deletion src/ui/header.ts
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,7 @@ export function dragWidth(col: Column, node: HTMLElement) {
ueberElement.removeEventListener('mousemove', mouseMove);
ueberElement.removeEventListener('mouseup', mouseUp);
ueberElement.removeEventListener('mouseleave', mouseUp);
ueberElement.classList.remove(cssClass('resizing'));
node.style.width = null;

if (Math.abs(start - end) < 2) {
Expand All @@ -323,10 +324,11 @@ export function dragWidth(col: Column, node: HTMLElement) {
node.classList.add(cssClass('change-width'));

start = evt.clientX;
ueberElement = <HTMLElement>node.closest('header')!;
ueberElement = <HTMLElement>node.closest('body') || <HTMLElement>node.closest(`.${cssClass()}`)!; // take the whole body or root lineup
ueberElement.addEventListener('mousemove', mouseMove);
ueberElement.addEventListener('mouseup', mouseUp);
ueberElement.addEventListener('mouseleave', mouseUp);
ueberElement.classList.add(cssClass('resizing'));
};
handle.onclick = (evt) => {
// avoid resorting
Expand Down

0 comments on commit d74607b

Please sign in to comment.