Skip to content

Commit

Permalink
Merge pull request #54 from raytiley/drag-in-progress
Browse files Browse the repository at this point in the history
Refactor how in progress drags are handeled.
  • Loading branch information
tim-evans committed Jan 26, 2016
2 parents dbeb307 + 907ce60 commit c4ac5c8
Showing 1 changed file with 7 additions and 16 deletions.
23 changes: 7 additions & 16 deletions addon/components/pl-uploader.js
Original file line number Diff line number Diff line change
Expand Up @@ -137,9 +137,7 @@ export default Ember.Component.extend({
// Send up the pluploader object so the app implementing this component as has access to it
var pluploader = queue.get('queues.firstObject');
this.sendAction('onInitOfUploader', pluploader);

this._firstDragEnter = false;
this._secondDragEnter = false;
this._dragInProgress = false;
this._invalidateDragData();
},

Expand Down Expand Up @@ -181,22 +179,15 @@ export default Ember.Component.extend({

dragData: null,
enteredDropzone({ originalEvent: evt }) {
if (this._firstDragEnter) {
this._secondDragEnter = true;
} else {
this._firstDragEnter = true;
this.activateDropzone(evt);
if (this._dragInProgress === false) {
this._dragInProgress = true;
this.activateDropzone(evt);
}
},

leftDropzone() {
if (this._secondDragEnter) {
this._secondDragEnter = false;
} else {
this._firstDragEnter = false;
}

if (!this._firstDragEnter && !this._secondDragEnter) {
if (this._dragInProgress === true) {
this._dragInProgress = false;
this.deactivateDropzone();
}
},
Expand All @@ -215,7 +206,7 @@ export default Ember.Component.extend({
sheet.css(`#${get(this, 'dropzone.id')} *`, null);
Ember.run.scheduleOnce('render', sheet, 'applyStyles');

this._firstDragEnter = this._secondDragEnter = false;
this._dragInProgress = false;
set(this, 'dragData', null);
},

Expand Down

0 comments on commit c4ac5c8

Please sign in to comment.