From 123f8a49687392f02772382c47909bbf285a9370 Mon Sep 17 00:00:00 2001 From: nikita Date: Mon, 5 Mar 2018 13:10:00 +0530 Subject: [PATCH] resolved ovelap issue: multiple options was dragged in one box. resolved this. --- 400-SOURCECODE/AIAHTML5.Web/app/controllers/LabExercController.js | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/400-SOURCECODE/AIAHTML5.Web/app/controllers/LabExercController.js b/400-SOURCECODE/AIAHTML5.Web/app/controllers/LabExercController.js index 9bfb241..807cc2c 100644 --- a/400-SOURCECODE/AIAHTML5.Web/app/controllers/LabExercController.js +++ b/400-SOURCECODE/AIAHTML5.Web/app/controllers/LabExercController.js @@ -410,7 +410,7 @@ function ($scope, $rootScope, pages, log, $http,$timeout, DataService, $filter, } $scope.dragableId = $(this).attr("Id"); - // alert($scope.dragableId); + console.log($scope.dragableId); $scope.dragableText = $("#" + $scope.dragableId).text(); // alert($("#" + $scope.dragableId).text()); @@ -523,6 +523,11 @@ function ($scope, $rootScope, pages, log, $http,$timeout, DataService, $filter, ) } else { + $(this).each(function (key, value) { + + var droppedID = $(this).attr("id").split("-"); + + if (droppedID[0] == 'blockbox') { var labExerciseModulePath = '~/../content/data/json/le/' + keywords.labexercise + '.json'; DataService.getAnotherJson(labExerciseModulePath).then( function (result) { @@ -535,15 +540,14 @@ function ($scope, $rootScope, pages, log, $http,$timeout, DataService, $filter, if (Options[inx].BoxName == id.split('-')[1]) { if ($scope.DraggedList != null) { $.each($scope.DraggedList, function (inx1, value3) { - if ($scope.DraggedList[inx1].Value == dataText) { $scope.DraggedList.splice(inx1, 1); } }); } - // $scope.UserAttempt.push({ "BlankBoxName": id.split('-')[1], "OptionName": $scope.dragableId.split('-')[1] }); - //$scope.UserAttempt.push({ balnkBox: +$scope.dragableId.split('-')[1] }); - $scope.UserAttempt.push({ "BlankBoxName": id.split('-')[1], "OptionName": $scope.dragableId.split('-')[1] }); + // $scope.UserAttempt.push({ "BlankBoxName": id.split('-')[1], "OptionName": $scope.dragableId.split('-')[1] }); + //$scope.UserAttempt.push({ balnkBox: +$scope.dragableId.split('-')[1] }); + $scope.UserAttempt.push({ "BlankBoxName": id.split('-')[1], "OptionName": $scope.dragableId.split('-')[1] }); $scope.DraggedList.push({ "id": id.split('-')[1], "optionName": id.split('-')[1], "Value": dataText, "topcoord": Options[inx].topcoord, "leftcoord": Options[inx].leftcoord }); $('#' + $scope.dragableId).css("display", "none"); $('#blockans-' + Options[inx].OptionNumber).css("background-color", "transparent !important"); @@ -555,12 +559,15 @@ function ($scope, $rootScope, pages, log, $http,$timeout, DataService, $filter, } }); - + + }, function (error) { console.log(error.statusText) } ) + } + }); } $scope.$apply(); -- libgit2 0.21.4