Commit 7cca942dafee2be94f37eeee8dceb4b20561a5d3

Authored by Nikita Kulshreshtha
2 parents 2ce7857f 966a7a2c

Merge branch 'Erasetoolfunctionality' into Develop

400-SOURCECODE/AIAHTML5.Web/app/controllers/DAController.js
@@ -6430,15 +6430,55 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo @@ -6430,15 +6430,55 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
6430 6430
6431 6431
6432 6432
6433 - function OnPaintCanvasMouseMove(event) {  
6434 6433
  6434 + $rootScope.FreeStylePaint = function (e) {
  6435 +
  6436 + var annotationCanvas = document.getElementById("canvas");
  6437 + // document.getElementById("canvasPaint").addEventListener("mouseup", OnPaintBrushCanvasMouseUp);
  6438 +
  6439 + annotationCanvas.addEventListener('mousedown', $scope.OnPaintCanvasMouseDown, false);
6435 6440
  6441 + annotationCanvas.addEventListener('mouseup', $scope.OnPaintBrushCanvasMouseUp, false);
6436 } 6442 }
  6443 + $scope.OnPaintCanvasMouseDown = function (event) {
  6444 + $rootScope.isMousedownOnPaintCanvas = true;
  6445 + $scope.isStartPointDeleted = false;
  6446 + var annotationCanvas = document.getElementById("canvas");
  6447 + $scope.startPageX = parseInt(event.clientX - ($("#canvas").offset().left));
  6448 + $scope.startPageY = parseInt(event.clientY - ($("#canvas").offset().top));
  6449 +
  6450 + annotationCanvas.addEventListener('mousemove', $scope.OnPaintCanvasMouseMove, false);
6437 6451
6438 - $rootScope.FreeStylePaint = function (e) {  
6439 6452
6440 6453
6441 } 6454 }
  6455 + $scope.OnPaintCanvasMouseMove = function (event) {
  6456 +
  6457 +
  6458 + $rootScope.xPage = parseInt(event.clientX - ($("#canvas").offset().left));
  6459 + $rootScope.yPage = parseInt(event.clientY - ($("#canvas").offset().top));
  6460 +
  6461 + var btneraseBrushSizeValue = $("#btnBrushSize").val();
  6462 + $rootScope.eraseshapeSize = parseInt(btneraseBrushSizeValue);
  6463 +
  6464 + if ($rootScope.isEraseToolSelected == true && $rootScope.isMousedownOnPaintCanvas == true) {
  6465 +
  6466 + var sktch = $('#canvasPaint').sketch();
  6467 + $('#canvasPaint').sketch().actions = [];
  6468 + var paintCanvas = document.getElementById("canvasPaint");
  6469 + var paintCanvasContext = paintCanvas.getContext('2d');
  6470 + if ($scope.isStartPointDeleted == false) {
  6471 +
  6472 + paintCanvasContext.clearRect($scope.startPageX, $scope.startPageY, $rootScope.eraseshapeSize, $rootScope.eraseshapeSize);
  6473 +
  6474 + $scope.isStartPointDeleted = true;
  6475 + }
  6476 +
  6477 + paintCanvasContext.clearRect($rootScope.xPage, $rootScope.yPage, $rootScope.eraseshapeSize, $rootScope.eraseshapeSize);
  6478 +
  6479 +
  6480 + }
  6481 + }
6442 $scope.OnPaintBrushCanvasMouseDown = function (event) { 6482 $scope.OnPaintBrushCanvasMouseDown = function (event) {
6443 switch ($rootScope.shapeType) { 6483 switch ($rootScope.shapeType) {
6444 6484
@@ -6467,7 +6507,8 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo @@ -6467,7 +6507,8 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
6467 } 6507 }
6468 } 6508 }
6469 $scope.OnPaintBrushCanvasMouseUp = function (event) { 6509 $scope.OnPaintBrushCanvasMouseUp = function (event) {
6470 - 6510 + $rootScope.isMousedownOnPaintCanvas = false;
  6511 + $rootScope.isEraseToolSelected = false;
6471 6512
6472 // var canvasElement1 = document.getElementById("canvasPaint"); 6513 // var canvasElement1 = document.getElementById("canvasPaint");
6473 // var ctx1 = canvasElement1.getContext("2d"); 6514 // var ctx1 = canvasElement1.getContext("2d");
400-SOURCECODE/AIAHTML5.Web/app/controllers/HomeController.js
@@ -62,7 +62,8 @@ AIA.controller("HomeController", ["$rootScope", "Modules", "$log", "$location", @@ -62,7 +62,8 @@ AIA.controller("HomeController", ["$rootScope", "Modules", "$log", "$location",
62 $rootScope.TextRectangleArr = []; 62 $rootScope.TextRectangleArr = [];
63 $rootScope.rectDimension = []; 63 $rootScope.rectDimension = [];
64 64
65 - 65 + $rootScope.isEraseToolSelected = false;
  66 + $rootScope.isMousedownOnPaintCanvas = false;
66 67
67 $rootScope.$on("$locationChangeSuccess", function () { 68 $rootScope.$on("$locationChangeSuccess", function () {
68 69
@@ -440,14 +441,16 @@ AIA.controller("HomeController", ["$rootScope", "Modules", "$log", "$location", @@ -440,14 +441,16 @@ AIA.controller("HomeController", ["$rootScope", "Modules", "$log", "$location",
440 $('#canvas').css("z-index", y); 441 $('#canvas').css("z-index", y);
441 } 442 }
442 $rootScope.EraseDrawing = function () { 443 $rootScope.EraseDrawing = function () {
443 - $rootScope.switchCanvasToPaintCanvas();  
444 - // $('#canvasPaint').sketch({ defaultColor: "yellow", defaultSize: 1 });  
445 - var sktch = $('#canvasPaint').sketch();  
446 - $('#canvasPaint').sketch().actions = []; // this line empties the actions.  
447 - var myCanvas = document.getElementById("canvasPaint");  
448 - var ctx = myCanvas.getContext('2d');  
449 - ctx.clearRect(0, 0, myCanvas.width, myCanvas.height);  
450 $rootScope.switchCanvas(); 444 $rootScope.switchCanvas();
  445 + $rootScope.isEraseToolSelected = true;
  446 + //$rootScope.switchCanvasToPaintCanvas();
  447 + //// $('#canvasPaint').sketch({ defaultColor: "yellow", defaultSize: 1 });
  448 + //var sktch = $('#canvasPaint').sketch();
  449 + //$('#canvasPaint').sketch().actions = []; // this line empties the actions.
  450 + //var myCanvas = document.getElementById("canvasPaint");
  451 + //var ctx = myCanvas.getContext('2d');
  452 + //ctx.clearRect(0, 0, myCanvas.width, myCanvas.height);
  453 + //$rootScope.switchCanvas();
451 454
452 } 455 }
453 456