Skip to content

Commit 6cc169a

Browse files
committed
equality function args change
1 parent 065a8d4 commit 6cc169a

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

angular-tree-control.js

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ if (typeof module !== "undefined" && typeof exports !== "undefined" && module.ex
4848

4949
return dst || src;
5050
}
51-
function defaultEquality($scope,a, b) {
51+
function defaultEquality(a, b,$scope) {
5252
if (!a || !b)
5353
return false;
5454
a = shallowCopy(a);
@@ -136,11 +136,11 @@ if (typeof module !== "undefined" && typeof exports !== "undefined" && module.ex
136136

137137

138138
function isSelectedNode(node) {
139-
if (!$scope.options.multiSelection && ($scope.options.equality($scope,node, $scope.selectedNode)))
139+
if (!$scope.options.multiSelection && ($scope.options.equality(node, $scope.selectedNode , $scope)))
140140
return true;
141141
else if ($scope.options.multiSelection && $scope.selectedNodes) {
142142
for (var i = 0; (i < $scope.selectedNodes.length); i++) {
143-
if ($scope.options.equality($scope,node, $scope.selectedNodes[i])) {
143+
if ($scope.options.equality(node, $scope.selectedNodes[i] , $scope)) {
144144
return true;
145145
}
146146
}
@@ -182,7 +182,7 @@ if (typeof module !== "undefined" && typeof exports !== "undefined" && module.ex
182182
else {
183183
var index;
184184
for (var i=0; (i < $scope.expandedNodes.length) && !index; i++) {
185-
if ($scope.options.equality($scope,$scope.expandedNodes[i], transcludedScope.node)) {
185+
if ($scope.options.equality($scope.expandedNodes[i], transcludedScope.node , $scope)) {
186186
index = i;
187187
}
188188
}
@@ -214,7 +214,7 @@ if (typeof module !== "undefined" && typeof exports !== "undefined" && module.ex
214214
if ($scope.options.multiSelection) {
215215
var pos = -1;
216216
for (var i=0; i < $scope.selectedNodes.length; i++) {
217-
if($scope.options.equality($scope,selectedNode, $scope.selectedNodes[i])) {
217+
if($scope.options.equality(selectedNode, $scope.selectedNodes[i] , $scope)) {
218218
pos = i;
219219
break;
220220
}
@@ -226,7 +226,7 @@ if (typeof module !== "undefined" && typeof exports !== "undefined" && module.ex
226226
$scope.selectedNodes.splice(pos, 1);
227227
}
228228
} else {
229-
if (!$scope.options.equality($scope,selectedNode, $scope.selectedNode)) {
229+
if (!$scope.options.equality(selectedNode, $scope.selectedNode , $scope)) {
230230
$scope.selectedNode = selectedNode;
231231
selected = true;
232232
}
@@ -345,7 +345,7 @@ if (typeof module !== "undefined" && typeof exports !== "undefined" && module.ex
345345
var found = false;
346346
for (var i=0; (i < existingScopes.length) && !found; i++) {
347347
var existingScope = existingScopes[i];
348-
if (scope.options.equality(scope,newExNode, existingScope.node)) {
348+
if (scope.options.equality(newExNode, existingScope.node , scope)) {
349349
newExpandedNodesMap[existingScope.$id] = existingScope.node;
350350
found = true;
351351
}
@@ -402,18 +402,18 @@ if (typeof module !== "undefined" && typeof exports !== "undefined" && module.ex
402402
link: function(scope, element, attrs, controller) {
403403
if (!scope.options.isLeaf(scope,scope.node)) {
404404
angular.forEach(scope.expandedNodesMap, function (node, id) {
405-
if (scope.options.equality(scope,node, scope.node)) {
405+
if (scope.options.equality(node, scope.node , scope)) {
406406
scope.expandedNodesMap[scope.$id] = scope.node;
407407
scope.expandedNodesMap[id] = undefined;
408408
}
409409
});
410410
}
411-
if (!scope.options.multiSelection && scope.options.equality(scope,scope.node, scope.selectedNode)) {
411+
if (!scope.options.multiSelection && scope.options.equality(scope.node, scope.selectedNode , scope)) {
412412
scope.selectedNode = scope.node;
413413
} else if (scope.options.multiSelection) {
414414
var newSelectedNodes = [];
415415
for (var i = 0; (i < scope.selectedNodes.length); i++) {
416-
if (scope.options.equality(scope,scope.node, scope.selectedNodes[i])) {
416+
if (scope.options.equality(scope.node, scope.selectedNodes[i] , scope)) {
417417
newSelectedNodes.push(scope.node);
418418
}
419419
}

0 commit comments

Comments
 (0)