Skip to content

Commit

Permalink
Merge branch 'master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
mastastealth authored Aug 20, 2019
2 parents a5167cd + 64f98af commit 6d462bf
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 6 deletions.
9 changes: 5 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Ember Drag Drop

[![Build Status](https://travis-ci.org/mharris717/ember-drag-drop.svg?branch=master)](https://travis-ci.org/mharris717/ember-drag-drop)
[![Download Total](https://img.shields.io/npm/dt/ember-drag-drop.svg)](http://badge.fury.io/js/ember-drag-drop)

Simple drag and drop addon for your Ember CLI app.

Expand Down Expand Up @@ -169,7 +170,7 @@ Ember.Controller.extend({
}
});
```
You can check out an example of this is action [here](http://mharris717.github.io/ember-drag-drop/)
You can check out an example of this is action [here](https://mharris717.github.io/ember-drag-drop/)

## Sorting of objects

Expand All @@ -192,13 +193,13 @@ An Example:
{{/sortable-objects}}
```

On drop of an item in the list, the sortableObjectList is re-ordered and the sortEndAction is fired unless the optional parameter 'enableSort' is false. You can check out an example of this is action [here](http://mharris717.github.io/ember-drag-drop/)
On drop of an item in the list, the sortableObjectList is re-ordered and the sortEndAction is fired unless the optional parameter 'enableSort' is false. You can check out an example of this is action [here](https://mharris717.github.io/ember-drag-drop/)

`useSwap` defaults to true and is optional. If you set it to false, then the sort algorithm will cascade the swap of items, pushing the values down the list. [See Demo](http://mharris717.github.io/ember-drag-drop/horizontal)
`useSwap` defaults to true and is optional. If you set it to false, then the sort algorithm will cascade the swap of items, pushing the values down the list. [See Demo](https://mharris717.github.io/ember-drag-drop/#/horizontal)

`inPlace` defaults to false and is optional. If you set it to true, then the original list will be mutated instead of making a copy.

`sortingScope` is optional and only needed if you have multiple lists on the screen that you want to share dragging between. [See Demo](http://mharris717.github.io/ember-drag-drop/multiple)
`sortingScope` is optional and only needed if you have multiple lists on the screen that you want to share dragging between. [See Demo](https://mharris717.github.io/ember-drag-drop/#/multiple)

**Note: It's important that you add the isSortable=true to each draggable-object or else that item will be draggable, but will not change the order of any item. Also if you set a custom sortingScope they should be the same for the sortable-object and the draggable-objects it contains.**

Expand Down
1 change: 1 addition & 0 deletions addon/components/sortable-objects.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ export default Component.extend( {

drop(event) {
event.stopPropagation();
event.preventDefault();
this.set('dragCoordinator.sortComponentController', undefined);
if (this.get('enableSort') && this.get('sortEndAction')) {
this.get('sortEndAction')(event);
Expand Down
2 changes: 1 addition & 1 deletion addon/services/drag-coordinator.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ export default Service.extend({

this.set('lastEvent', event);

if (!this.get('isMoving')) {
if (!this.get('isMoving') && this.get('currentDragEvent')) {
if (event.target !== this.get('currentDragEvent').target && hasSameSortingScope) { //if not dragging over self
if (currentOffsetItem !== emberObject) {
if (pos.py > 0.33 && moveDirection === 'up' || pos.py > 0.33 && moveDirection === 'down') {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
"test": "tests"
},
"dependencies": {
"ember-cli-babel": "^6.6.0"
"ember-cli-babel": "7.1.3"
},
"ember-addon": {
"configPath": "tests/dummy/config",
Expand Down

0 comments on commit 6d462bf

Please sign in to comment.