Created
January 8, 2019 13:25
-
-
Save thomasJang/5b2812d0ba46cb6c0320a2b2f33ff8e8 to your computer and use it in GitHub Desktop.
handleResizerMove.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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