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:
parent
16e21c74ac
commit
4079c99666
@ -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})
|
||||
|
@ -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)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user