Stop resizing when there is no active handle
parent
9c47e759df
commit
e2add18d61
|
@ -77,6 +77,10 @@ class Resizer extends Component<Props, State> {
|
||||||
dragEvent.mouseY
|
dragEvent.mouseY
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if (!this.state.activeHandleID) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
if (orientation === HANDLE_VERTICAL) {
|
if (orientation === HANDLE_VERTICAL) {
|
||||||
const left = dragEvent.percentX < prevState.dragEvent.percentX
|
const left = dragEvent.percentX < prevState.dragEvent.percentX
|
||||||
|
|
||||||
|
@ -166,6 +170,7 @@ class Resizer extends Component<Props, State> {
|
||||||
}
|
}
|
||||||
|
|
||||||
private handleStopDrag = () => {
|
private handleStopDrag = () => {
|
||||||
|
console.log('handleStopDrag')
|
||||||
this.setState({activeHandleID: '', dragEvent: initialDragEvent})
|
this.setState({activeHandleID: '', dragEvent: initialDragEvent})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -290,18 +295,13 @@ class Resizer extends Component<Props, State> {
|
||||||
}
|
}
|
||||||
|
|
||||||
private up = activePosition => () => {
|
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 first = i === 0
|
||||||
const before = i === activePosition - 1
|
const before = i === activePosition - 1
|
||||||
const current = i === activePosition
|
const current = i === activePosition
|
||||||
|
|
||||||
if (first) {
|
if (first && activePosition) {
|
||||||
const below = divs[i + 1]
|
return {...d, size: this.shorter(d.size)}
|
||||||
if (below.size === 0) {
|
|
||||||
return {...d, size: this.shorter(d.size)}
|
|
||||||
}
|
|
||||||
|
|
||||||
return {...d}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (before) {
|
if (before) {
|
||||||
|
|
Loading…
Reference in New Issue