1
0
mirror of https://github.com/mattermost/focalboard.git synced 2024-11-27 08:31:20 +02:00

Cleanup drag and drop logic

This commit is contained in:
Chen-I Lim 2020-11-09 10:02:54 -08:00
parent 16e21c74ac
commit 4079c99666
2 changed files with 14 additions and 8 deletions

View File

@ -70,10 +70,14 @@ class BoardCard extends React.Component<BoardCardProps, BoardCardState> {
}}
onDragOver={(e) => {
this.setState({isDragOver: true})
if (!this.state.isDragOver) {
this.setState({isDragOver: true})
}
}}
onDragEnter={(e) => {
this.setState({isDragOver: true})
if (!this.state.isDragOver) {
this.setState({isDragOver: true})
}
}}
onDragLeave={(e) => {
this.setState({isDragOver: false})

View File

@ -9,8 +9,6 @@ type Props = {
type State = {
isDragOver?: boolean
dragPageX?: number
dragPageY?: number
}
class BoardColumn extends React.Component<Props, State> {
@ -29,18 +27,22 @@ class BoardColumn extends React.Component<Props, State> {
className={className}
onDragOver={(e) => {
e.preventDefault()
this.setState({isDragOver: true, dragPageX: e.pageX, dragPageY: e.pageY})
if (!this.state.isDragOver) {
this.setState({isDragOver: true})
}
}}
onDragEnter={(e) => {
e.preventDefault()
this.setState({isDragOver: true, dragPageX: e.pageX, dragPageY: e.pageY})
if (!this.state.isDragOver) {
this.setState({isDragOver: true})
}
}}
onDragLeave={(e) => {
e.preventDefault()
this.setState({isDragOver: false, dragPageX: undefined, dragPageY: undefined})
this.setState({isDragOver: false})
}}
onDrop={(e) => {
this.setState({isDragOver: false, dragPageX: undefined, dragPageY: undefined})
this.setState({isDragOver: false})
if (this.props.isDropZone) {
this.props.onDrop(e)
}