2018-01-20 00:46:47 -08:00
|
|
|
import Component from '@ember/component';
|
|
|
|
import { get } from '@ember/object';
|
2017-02-13 14:58:21 -08:00
|
|
|
|
2018-01-20 00:46:47 -08:00
|
|
|
export default Component.extend({
|
2017-02-13 14:58:21 -08:00
|
|
|
classNames: ['drop-region'],
|
|
|
|
classNameBindings: ['dragClass'],
|
|
|
|
dragClass: 'deactivated',
|
|
|
|
|
|
|
|
dragLeave(e) {
|
|
|
|
e.preventDefault();
|
|
|
|
this.set('dragClass', 'deactivated');
|
|
|
|
},
|
|
|
|
|
|
|
|
dragOver(e) {
|
|
|
|
e.preventDefault();
|
|
|
|
this.set('dragClass', 'activated');
|
|
|
|
},
|
|
|
|
|
2018-01-20 00:46:47 -08:00
|
|
|
drop(e) {
|
2017-02-13 14:58:21 -08:00
|
|
|
const data = e.dataTransfer.getData('text/data');
|
2018-01-20 00:46:47 -08:00
|
|
|
get(this, 'dropped')(data, get(this, 'param'));
|
2017-02-13 14:58:21 -08:00
|
|
|
this.set('dragClass', 'deactivated');
|
|
|
|
}
|
|
|
|
});
|