Stop resizing when there is no active handle

pull/3374/head
Andrew Watkins 2018-05-02 14:09:41 -07:00
parent 9c47e759df
commit e2add18d61
1 changed files with 8 additions and 8 deletions

View File

@ -77,6 +77,10 @@ class Resizer extends Component<Props, State> {
dragEvent.mouseY
)
if (!this.state.activeHandleID) {
return
}
if (orientation === HANDLE_VERTICAL) {
const left = dragEvent.percentX < prevState.dragEvent.percentX
@ -166,6 +170,7 @@ class Resizer extends Component<Props, State> {
}
private handleStopDrag = () => {
console.log('handleStopDrag')
this.setState({activeHandleID: '', dragEvent: initialDragEvent})
}
@ -290,18 +295,13 @@ class Resizer extends Component<Props, State> {
}
private up = activePosition => () => {
const divisions = this.state.divisions.map((d, i, divs) => {
const divisions = this.state.divisions.map((d, i) => {
const first = i === 0
const before = i === activePosition - 1
const current = i === activePosition
if (first) {
const below = divs[i + 1]
if (below.size === 0) {
return {...d, size: this.shorter(d.size)}
}
return {...d}
if (first && activePosition) {
return {...d, size: this.shorter(d.size)}
}
if (before) {