Skip to content

Commit

Permalink
Fixed #1182 - Tree drag&drop not working if dragdropScope contains up…
Browse files Browse the repository at this point in the history
…per case letter
  • Loading branch information
Merve7 committed Apr 15, 2020
1 parent 70757d7 commit f7d9d42
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/components/tree/UITreeNode.js
Original file line number Diff line number Diff line change
Expand Up @@ -538,20 +538,20 @@ export class UITreeNode extends Component {
}

onDropPointDragOver(event) {
if (event.dataTransfer.types[1] === this.props.dragdropScope) {
if (event.dataTransfer.types[1] === this.props.dragdropScope.toLocaleLowerCase()) {
event.dataTransfer.dropEffect = 'move';
event.preventDefault();
}
}

onDropPointDragEnter(event) {
if (event.dataTransfer.types[1] === this.props.dragdropScope) {
if (event.dataTransfer.types[1] === this.props.dragdropScope.toLocaleLowerCase()) {
DomHandler.addClass(event.target, 'p-treenode-droppoint-active');
}
}

onDropPointDragLeave(event) {
if (event.dataTransfer.types[1] === this.props.dragdropScope) {
if (event.dataTransfer.types[1] === this.props.dragdropScope.toLocaleLowerCase()) {
DomHandler.removeClass(event.target, 'p-treenode-droppoint-active');
}
}
Expand All @@ -572,21 +572,21 @@ export class UITreeNode extends Component {
}

onDragOver(event) {
if (event.dataTransfer.types[1] === this.props.dragdropScope && this.props.node.droppable !== false) {
if (event.dataTransfer.types[1] === this.props.dragdropScope.toLocaleLowerCase() && this.props.node.droppable !== false) {
event.dataTransfer.dropEffect = 'move';
event.preventDefault();
event.stopPropagation();
}
}

onDragEnter(event) {
if (event.dataTransfer.types[1] === this.props.dragdropScope && this.props.node.droppable !== false) {
if (event.dataTransfer.types[1] === this.props.dragdropScope.toLocaleLowerCase() && this.props.node.droppable !== false) {
DomHandler.addClass(this.contentElement, 'p-treenode-dragover');
}
}

onDragLeave(event) {
if (event.dataTransfer.types[1] === this.props.dragdropScope && this.props.node.droppable !== false) {
if (event.dataTransfer.types[1] === this.props.dragdropScope.toLocaleLowerCase() && this.props.node.droppable !== false) {
let rect = event.currentTarget.getBoundingClientRect();
if (event.nativeEvent.x > rect.left + rect.width || event.nativeEvent.x < rect.left || event.nativeEvent.y >= Math.floor(rect.top + rect.height) || event.nativeEvent.y < rect.top) {
DomHandler.removeClass(this.contentElement, 'p-treenode-dragover');
Expand Down

0 comments on commit f7d9d42

Please sign in to comment.