Skip to content

Commit

Permalink
Merge pull request #24 from Tuch/bugs/issue-23
Browse files Browse the repository at this point in the history
ISSUE-23
  • Loading branch information
Tuch committed Jun 19, 2015
2 parents 7f8f912 + 663c7f1 commit 15975d8
Show file tree
Hide file tree
Showing 8 changed files with 59 additions and 17 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# [Changes]

## v0.1.13
* **bug-fixes
* Fixed a bug with the sequence of events call (leave -> enter -> over)
* **

## v0.1.12
* **bug-fixes
* Fix bug with child elements of dnd-pointer-none
Expand Down
11 changes: 10 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Angular-DND 0.1.12
Angular-DND 0.1.13
=========

Features:
Expand Down Expand Up @@ -193,6 +193,15 @@ Examples
- Also available [link](http://tuch.github.io/angular-dnd/latest/demo)





Plunkers
---------
- [many drop zones](http://embed.plnkr.co/tdBHyg032OEK3Kn8ZQZw/preview)
- [custom sortables](http://embed.plnkr.co/ElwZjFIQh3N2HHe18Gse/preview)


TODO:
---------

Expand Down
2 changes: 1 addition & 1 deletion README_RU.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Angular-DND 0.1.12
Angular-DND 0.1.13
=========

Особенности:
Expand Down
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "angular-dnd-module",
"version": "0.1.12",
"version": "0.1.13",
"authors": [
"Afonin A.V. <[email protected]>"
],
Expand Down
27 changes: 21 additions & 6 deletions dist/angular-dnd.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@


/**
* @license AngularJS-DND v0.1.12
* @license AngularJS-DND v0.1.13
* (c) 2014-2015 Alexander Afonin ([email protected], http://github.com/Tuch)
* License: MIT
*/
Expand All @@ -19,7 +19,7 @@

/* ENVIRONMENT VARIABLES */

var version = '0.1.12',
var version = '0.1.13',
$ = angular.element, $window = $(window), $document = $(document), body = 'body', TRANSFORM, TRANSFORMORIGIN, MATCHES_SELECTOR,
debug = {
mode: false,
Expand Down Expand Up @@ -1218,6 +1218,9 @@ var module = angular.module('dnd', []);
this.dnd.trigger('drag', this.api);

var axis = this.getBorderedAxis(), x = axis.x, y = axis.y, asPoint = this.asPoint;
var dragenter = [];
var dragover = [];
var dragleave = [];

for(var i = 0; i < regions.length; i++) {
var region = regions[i],
Expand All @@ -1231,15 +1234,25 @@ var module = angular.module('dnd', []);
if ( trigger ) {
if (targetIndex === -1) {
this.targets.push(region.dnd.el);
region.dnd.trigger('dragenter', this.api, this.dnd.el);
dragenter.push(region.dnd);
} else {
region.dnd.trigger('dragover', this.api, this.dnd.el);
dragover.push(region.dnd);
}
} else if (targetIndex !== -1) {
$(this.targets[targetIndex]).data('dnd')[this.dnd.layer()].trigger('dragleave', this.api, this.dnd.el);
dragleave.push($(this.targets[targetIndex]).data('dnd')[this.dnd.layer()]);
this.targets.splice(targetIndex, 1);
}
}

this._triggerArray(dragleave, 'dragleave');
this._triggerArray(dragenter, 'dragenter');
this._triggerArray(dragover, 'dragover');
},

_triggerArray: function (arr, event) {
for (var i = 0; i < arr.length; i++) {
arr[i].trigger(event, this.api, this.dnd.el);
}
},

end: function (event) {
Expand Down Expand Up @@ -1799,7 +1812,9 @@ function ($timeout, $parse, $http, $compile, $q, $templateCache, EventEmitter) {

updatePosition: function () {
var position = this.api.getRelBorderedAxis(this.borderOffset).plus(this._offset);
console.log(this.api.getRelBorderedAxis())
if (debug.mode) {
console.log(this.api.getRelBorderedAxis());
}

wrapper.dndCss(position.getAsCss());
},
Expand Down
4 changes: 2 additions & 2 deletions dist/angular-dnd.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "angular-dnd-module",
"version": "0.1.12",
"version": "0.1.13",
"author": "Alexander Afonin",
"devDependencies": {
"grunt-contrib-concat": "*",
Expand Down
23 changes: 18 additions & 5 deletions src/core.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

/**
* @license AngularJS-DND v0.1.12
* @license AngularJS-DND v0.1.13
* (c) 2014-2015 Alexander Afonin ([email protected], http://github.com/Tuch)
* License: MIT
*/
Expand All @@ -17,7 +17,7 @@

/* ENVIRONMENT VARIABLES */

var version = '0.1.12',
var version = '0.1.13',
$ = angular.element, $window = $(window), $document = $(document), body = 'body', TRANSFORM, TRANSFORMORIGIN, MATCHES_SELECTOR,
debug = {
mode: false,
Expand Down Expand Up @@ -1216,6 +1216,9 @@ var module = angular.module('dnd', []);
this.dnd.trigger('drag', this.api);

var axis = this.getBorderedAxis(), x = axis.x, y = axis.y, asPoint = this.asPoint;
var dragenter = [];
var dragover = [];
var dragleave = [];

for(var i = 0; i < regions.length; i++) {
var region = regions[i],
Expand All @@ -1229,15 +1232,25 @@ var module = angular.module('dnd', []);
if ( trigger ) {
if (targetIndex === -1) {
this.targets.push(region.dnd.el);
region.dnd.trigger('dragenter', this.api, this.dnd.el);
dragenter.push(region.dnd);
} else {
region.dnd.trigger('dragover', this.api, this.dnd.el);
dragover.push(region.dnd);
}
} else if (targetIndex !== -1) {
$(this.targets[targetIndex]).data('dnd')[this.dnd.layer()].trigger('dragleave', this.api, this.dnd.el);
dragleave.push($(this.targets[targetIndex]).data('dnd')[this.dnd.layer()]);
this.targets.splice(targetIndex, 1);
}
}

this._triggerArray(dragleave, 'dragleave');
this._triggerArray(dragenter, 'dragenter');
this._triggerArray(dragover, 'dragover');
},

_triggerArray: function (arr, event) {
for (var i = 0; i < arr.length; i++) {
arr[i].trigger(event, this.api, this.dnd.el);
}
},

end: function (event) {
Expand Down

0 comments on commit 15975d8

Please sign in to comment.