Skip to content

Instantly share code, notes, and snippets.

@thomasJang
Created January 8, 2019 13:25
Show Gist options
  • Save thomasJang/5b2812d0ba46cb6c0320a2b2f33ff8e8 to your computer and use it in GitHub Desktop.
Save thomasJang/5b2812d0ba46cb6c0320a2b2f33ff8e8 to your computer and use it in GitHub Desktop.
handleResizerMove.ts
const prevBoxWidth =
typeof parsedSQL.boxWidth === 'undefined'
? this.resultBoxWidth
: parsedSQL.boxWidth;
const prevResizerLeft = e.currentTarget.getBoundingClientRect().left;
const prevScrollLeft = this.resultRef.current.scrollLeft;
mouseEventSubscribe(
(mpos: IMousePosition) => {
const resizerMoveX = mpos.clientX - prevResizerLeft;
if (containerLeft + containerWidth < mpos.clientX) {
if (this.resultRef.current) {
this.resultRef.current.scroll({
left: prevScrollLeft + resizerMoveX,
});
}
}
setBoxWidth(parsedSQLIndex, prevBoxWidth + resizerMoveX);
},
() => {},
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment