Commit e99d0a5407f6e70798724172bc05eedd946e5636

Authored by Amrita Vishnoi
2 parents 7d6f8fb7 ebd19817

Merge branch 'overwritesketchjs' into Develop

400-SOURCECODE/AIAHTML5.Web/app/controllers/DAController.js
... ... @@ -5681,6 +5681,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
5681 5681 $("#DrawMode").addClass('annotationtoolbartab');
5682 5682 //$('.btnCursor').trigger('click');
5683 5683 $("#annotationpaintbrushsize").removeClass("activebtncolor");
  5684 + $("#annotationpainteraser").removeClass("activebtncolor");
5684 5685 $('.btnCursor').addClass('activebtncolor');
5685 5686  
5686 5687 }
... ...
400-SOURCECODE/AIAHTML5.Web/app/controllers/HomeController.js
... ... @@ -61,8 +61,6 @@ function ($rootScope, Modules, $log, $location, $timeout, DataService, Authentic
61 61 $rootScope.modifySavedText = [];
62 62 $rootScope.TextRectangleArr = [];
63 63 $rootScope.rectDimension = [];
64   -
65   - $rootScope.isEraseToolSelected = false;
66 64 $rootScope.isMousedownOnPaintCanvas = false;
67 65 //opacity code
68 66 $rootScope.shapestyleOpacity = 1;
... ... @@ -511,6 +509,7 @@ function ($rootScope, Modules, $log, $location, $timeout, DataService, Authentic
511 509 //annotation tool custom events
512 510 $rootScope.ShowAnnotationWindow = function () {
513 511 //7904
  512 +
514 513 $rootScope.isAnnotatiomToolBarPopupActive = true;
515 514 $rootScope.isAnnotatiomToolBarPopupClosed = false;
516 515 $rootScope.isAnnotaionToolBarDrawingModeActive = false;
... ... @@ -519,13 +518,14 @@ function ($rootScope, Modules, $log, $location, $timeout, DataService, Authentic
519 518 $('#AnnotaionPopupDiv').find('a,input, textarea, button, select,img,div').attr('disabled', 'disabled');
520 519 $('#slider-range-min-2').slider('disable');
521 520 $("#annotationpaintbrushsize").attr('disabled', 'disabled');
522   -
  521 + $("#annotationpainteraser").attr('disabled', 'disabled');
523 522  
524 523 // $rootScope.disableAnnotationTB = false;
525 524 } else {
526 525 $('#AnnotaionPopupDiv').find('input, textarea, button, select,img,div').removeAttr('disabled', 'disabled');
527 526 $('#slider-range-min-2').slider('enable');
528 527 $("#annotationpaintbrushsize").removeAttr('disabled', 'disabled');
  528 + $("#annotationpainteraser").removeAttr('disabled', 'disabled');
529 529 }
530 530 // document.getElementById('modelbackground').style.display = "block";
531 531 // document.getElementById('modeleditstyle').style.display = "block";
... ... @@ -534,9 +534,15 @@ function ($rootScope, Modules, $log, $location, $timeout, DataService, Authentic
534 534 if ($rootScope.MenuModuleName == "CA")
535 535 {
536 536 $("#annotationpaintbrushsize").attr("href", "#");
  537 + $("#annotationpainteraser").attr("href", "#");
  538 + $("#annotationpainteraser").attr('disabled', 'disabled');
  539 + $("#annotationpainteraser").css('pointer-events', 'none');
537 540 }
538 541 else {
539 542 $("#annotationpaintbrushsize").attr("href", "#canvasPaint");
  543 + $("#annotationpainteraser").attr("href", "#canvasPaint");
  544 + $("#annotationpainteraser").removeAttr('disabled', 'disabled');
  545 + $("#annotationpainteraser").css('pointer-events', 'auto');
540 546 }
541 547 $("#OnIdentify").addClass("annotationtoolbartab");
542 548 $("#annotationToolBarOptions").addClass("active");
... ... @@ -892,27 +898,50 @@ function ($rootScope, Modules, $log, $location, $timeout, DataService, Authentic
892 898 }
893 899 $rootScope.EraseDrawing = function () {
894 900 $rootScope.isAnnotaionToolBarDrawingModeActive = true;
895   - $rootScope.switchCanvas();
896   - $rootScope.isEraseToolSelected = true;
897   - //$rootScope.switchCanvasToPaintCanvas();
898 901 $('.btnCursor').removeClass('activebtncolor');
899 902 $(".btn-annotation").removeClass("activebtncolor");
900 903 $(".btn-annotation-erase").addClass("activebtncolor");
901 904 $("#OnIdentify").removeClass('annotationtoolbartab');
902 905 $("#DrawMode").addClass('annotationtoolbartab');
  906 + $rootScope.switchCanvasToPaintCanvas();
  907 + var btneraseBrushSizeValue = $("#btnBrushSize").val();
  908 + $('#canvasPaint').sketch();
  909 + $rootScope.eraseshapeSize = parseInt(btneraseBrushSizeValue);
  910 + $("#annotationpainteraser").attr("data-size", $rootScope.eraseshapeSize);
  911 + return $.sketch.tools.eraser = {
  912 + onEvent: function (e) {
  913 + return $.sketch.tools.marker.onEvent.call(this, e);
  914 + },
  915 + draw: function (action) {
  916 + var oldcomposite;
  917 + oldcomposite = this.context.globalCompositeOperation;
  918 + this.context.globalCompositeOperation = "destination-out";
  919 + action.color = "#000000";
  920 + $.sketch.tools.marker.draw.call(this, action);
  921 + return this.context.globalCompositeOperation = oldcomposite;
  922 + }
  923 + }
  924 +
  925 +
903 926  
904 927 }
905 928  
906 929 $rootScope.isShapeSyleOkBtnClicked = false;
  930 +
907 931 $rootScope.setPropertiesForShapes = function (id) {
908 932 isfilloptionChecked = document.getElementById('fill-option').checked;
909 933 isOutlineOptionChecked = document.getElementById('Outline-Option').checked;
910 934 $rootScope.isShapeSyleOkBtnClicked = true;
911   - if ($("#annotationpaintbrushsize").hasClass('activebtncolor')) {
  935 + if ($("#annotationpaintbrushsize").hasClass('activebtncolor')) {
912 936 $("#annotationpaintbrushsize").removeClass('activebtncolor')
913 937 $rootScope.switchCanvas();
914 938  
915   - }
  939 + }
  940 + if ($("#annotationpainteraser").hasClass('activebtncolor')) {
  941 + $("#annotationpainteraser").removeClass('activebtncolor')
  942 + $rootScope.switchCanvas();
  943 +
  944 + }
916 945 if ((document.getElementById('fill-option').checked == false) && (document.getElementById('Outline-Option').checked == false)) {
917 946 // $('#btnShapeStyle').attr('disabled', 'disabled');
918 947 } else {
... ... @@ -988,6 +1017,7 @@ function ($rootScope, Modules, $log, $location, $timeout, DataService, Authentic
988 1017  
989 1018  
990 1019 $rootScope.disableAnnotationToolBar = function () {
  1020 +
991 1021 if ($rootScope.isShapeSyleOkBtnClicked == false) {
992 1022 $('#editstylebackgroundcolor .minicolors >.minicolors-swatch > .minicolors-swatch-color').css("background-color", "rgb(255,255,255)");
993 1023 $('#outlineColor .minicolors >.minicolors-swatch > .minicolors-swatch-color').css("background-color", "rgb(0,0,0)");
... ... @@ -1030,6 +1060,7 @@ function ($rootScope, Modules, $log, $location, $timeout, DataService, Authentic
1030 1060 // $(".marginTopBtm10 div.outlinediv").css("border-color", x);
1031 1061 //});
1032 1062 } else {
  1063 +
1033 1064 document.getElementById('fill-option').checked = isfilloptionChecked;
1034 1065 document.getElementById('Outline-Option').checked = isOutlineOptionChecked;
1035 1066 if (isfilloptionChecked == true) {
... ... @@ -1056,7 +1087,7 @@ function ($rootScope, Modules, $log, $location, $timeout, DataService, Authentic
1056 1087 $("#borderWidthCanvasElement").css({ "pointer-events": "none" });
1057 1088 $("#outlineColor").css({ "pointer-events": "none" });
1058 1089 }
1059   - var previewBgColor = $("#shapeStyleDiv").css('background-color');
  1090 + var previewBgColor = $("#shapeStyleDiv").css('background-color');
1060 1091 var previewBorderColor = $('#previewBorder').css('border-color');
1061 1092 var previewBorderWidth = $('#previewBorder').css('border-width');
1062 1093 var previewOpacity = $('#previewBorder').css('opacity');
... ... @@ -1068,6 +1099,7 @@ function ($rootScope, Modules, $log, $location, $timeout, DataService, Authentic
1068 1099 $('#borderWidthCanvasElement').val(previewBorderWidth.split("px"));
1069 1100 $("#imgOpacity").css("opacity", previewOpacity);
1070 1101 $(".marginTopBtm10 div.outlinediv").css("opacity", previewOpacity);
  1102 +
1071 1103 }
1072 1104 document.getElementById('modelbackground').style.display = "none";
1073 1105 document.getElementById('modeleditstyle').style.display = "none";
... ... @@ -1165,6 +1197,7 @@ function ($rootScope, Modules, $log, $location, $timeout, DataService, Authentic
1165 1197 }
1166 1198  
1167 1199 $rootScope.DrawRectangleOnModuleItem = function (canvasId, RectNumber, shapestyleFillColor, shapestyleborderColor, shapestyleOpacity, shapestyleborderWidth, offsetX1, offsetY1, x, y) {
  1200 +
1168 1201 if ($rootScope.isRectanglePreviewCompleted == true) {
1169 1202 $rootScope.isRectanglePreviewCompleted = false;
1170 1203 $(canvasId).addLayer({
... ... @@ -2722,12 +2755,16 @@ function ($rootScope, Modules, $log, $location, $timeout, DataService, Authentic
2722 2755 $rootScope.disableAnnotationtoolOnListManager = false;
2723 2756 $rootScope.ShowListManager = function () {
2724 2757 $rootScope.switchCanvas();
2725   - $("#annotationpaintbrushsize").attr("href", "#");
  2758 + $("#annotationpaintbrushsize").attr("href", "#");
  2759 + $("#annotationpainteraser").attr("href", "#");
2726 2760 console.log('ShowListManager')
2727 2761 $rootScope.disableAnnotationtoolOnListManager = true;
2728 2762 $('#AnnotaionPopupDiv').find('a,input, textarea, button, select,img,div').attr('disabled', 'disabled');
2729 2763 $('#slider-range-min-2').slider('disable');
2730 2764 $("#annotationpaintbrushsize").attr('disabled', 'disabled');
  2765 + $("#annotationpainteraser").attr('disabled', 'disabled');
  2766 + $("#annotationpaintbrushsize").css('pointer-events', 'none');
  2767 + $("#annotationpainteraser").css('pointer-events', 'none');
2731 2768 $rootScope.isLoading = true;
2732 2769 $('#spinner').css('visibility', 'visible');
2733 2770  
... ... @@ -2777,10 +2814,14 @@ function ($rootScope, Modules, $log, $location, $timeout, DataService, Authentic
2777 2814 $rootScope.disableAnnotationtoolOnListManager = false;
2778 2815 if ($rootScope.MenuModuleName == "DA") {
2779 2816 $("#annotationpaintbrushsize").attr("href", "#canvasPaint");
  2817 + $("#annotationpainteraser").attr("href", "#canvasPaint");
2780 2818 if ($rootScope.disableAnnotationtoolOnListManager == false) {
2781 2819 $('#AnnotaionPopupDiv').find('a,input, textarea, button, select,img,div').removeAttr('disabled', 'disabled');
2782 2820 $('#slider-range-min-2').slider('enable');
2783 2821 $("#annotationpaintbrushsize").removeAttr('disabled', 'disabled');
  2822 + $("#annotationpainteraser").removeAttr('disabled', 'disabled');
  2823 + $("#annotationpaintbrushsize").css('pointer-events', 'auto');
  2824 + $("#annotationpainteraser").css('pointer-events', 'auto');
2784 2825 $rootScope.switchCanvasToPaintCanvas();
2785 2826 }
2786 2827 }
... ... @@ -2999,77 +3040,14 @@ function ($rootScope, Modules, $log, $location, $timeout, DataService, Authentic
2999 3040  
3000 3041  
3001 3042  
3002   - $rootScope.FreeStylePaint = function (e) {
3003   -
3004   - var annotationCanvas = document.getElementById("canvas");
3005   - annotationCanvas.addEventListener('mousedown', $rootScope.OnPaintBrushCanvasMouseDown, false);
3006   - annotationCanvas.addEventListener('mouseup', $rootScope.OnPaintBrushCanvasMouseUp, false);
3007   - // document.getElementById("canvasPaint").addEventListener("mouseup", OnPaintBrushCanvasMouseUp);
3008   -
3009   - //if ($rootScope.isAnnotaionToolBarDrawingModeActive == true) {
3010 3043  
3011 3044  
3012   - // $rootScope.getAnnotationTextBasedOnSelectedBodyRegion(e);
3013   -
3014   - //}
3015   - //else {
3016   -
3017   -
3018   -
3019   - //}
3020   - }
3021   -
3022 3045  
3023 3046  
3024 3047  
3025 3048  
3026 3049  
3027 3050  
3028   - $rootScope.OnPaintBrushCanvasMouseDown = function (event) {
3029   - if ($rootScope.isAnnotatiomToolBarPopupClosed == false) {
3030   - $rootScope.isMousedownOnPaintCanvas = true;
3031   - $rootScope.isStartPointDeleted = false;
3032   - var annotationCanvas = document.getElementById("canvas");
3033   - $rootScope.startPageX = parseInt(event.clientX - ($("#canvas").offset().left));
3034   - $rootScope.startPageY = parseInt(event.clientY - ($("#canvas").offset().top));
3035   -
3036   - annotationCanvas.addEventListener('mousemove', $rootScope.OnPaintBrushCanvasMouseMove, false);
3037   - }
3038   - }
3039   - $rootScope.OnPaintBrushCanvasMouseMove = function (event) {
3040   -
3041   - $rootScope.xPage = parseInt(event.clientX - ($("#canvas").offset().left));
3042   - $rootScope.yPage = parseInt(event.clientY - ($("#canvas").offset().top));
3043   -
3044   - var btneraseBrushSizeValue = $("#btnBrushSize").val();
3045   - $rootScope.eraseshapeSize = parseInt(btneraseBrushSizeValue);
3046   -
3047   - if ($rootScope.isEraseToolSelected == true && $rootScope.isMousedownOnPaintCanvas == true) {
3048   -
3049   - var sktch = $('#canvasPaint').sketch();
3050   - $('#canvasPaint').sketch().actions = [];
3051   - var paintCanvas = document.getElementById("canvasPaint");
3052   - var paintCanvasContext = paintCanvas.getContext('2d');
3053   - if ($rootScope.isStartPointDeleted == false) {
3054   -
3055   - paintCanvasContext.clearRect($rootScope.startPageX, $rootScope.startPageY, $rootScope.eraseshapeSize, $rootScope.eraseshapeSize);
3056   -
3057   - $rootScope.isStartPointDeleted = true;
3058   - }
3059   -
3060   - paintCanvasContext.clearRect($rootScope.xPage, $rootScope.yPage, $rootScope.eraseshapeSize, $rootScope.eraseshapeSize);
3061   -
3062   -
3063   - }
3064   - }
3065   - $rootScope.OnPaintBrushCanvasMouseUp = function (event) {
3066   - if ($rootScope.isAnnotatiomToolBarPopupClosed == false) {
3067   - $rootScope.isMousedownOnPaintCanvas = false;
3068   - $rootScope.isEraseToolSelected = false;
3069   - $(".btn-annotation-erase").removeClass("activebtncolor");
3070   - }
3071   - }
3072   -
3073 3051  
3074 3052 $rootScope.reloadChildController = function () {
3075 3053  
... ...
400-SOURCECODE/AIAHTML5.Web/index.html
... ... @@ -656,8 +656,10 @@
656 656 <div class="well well-popup">
657 657 <div class="" role="group" aria-label="...">
658 658 <div>
659   - <a href="#canvasPaint" data-size="1" data-color="#fff" id="annotationpaintbrushsize" ng-mouseover="mouseMoveToolTip(270, 50, 120, 'Paint')" ng-mouseleave="mouseOutToolTip()" class="btn btn-black-annotation btn-xs pull-left btn-annotation btn-annotation-brush" role="button" data-placement="top" style="margin-right:1%;" ng-click="paintBrush()"><i class="fa fa-paint-brush"></i></a>
660   - <button type="button" id="annotationpainteraser" class="btn btn-black-annotation btn-xs pull-left btn-annotation btn-annotation-erase" data-placement="top" ng-click="EraseDrawing()" ng-mouseover="mouseMoveToolTip(270, 70, 120, 'Erase')" ng-mouseleave="mouseOutToolTip()"><i class="fa fa-eraser"></i></button>&nbsp;
  659 + <a href="#canvasPaint" data-tool="marker" data-size="1" data-color="#fff" id="annotationpaintbrushsize" ng-mouseover="mouseMoveToolTip(270, 50, 120, 'Paint')" ng-mouseleave="mouseOutToolTip()" class="btn btn-black-annotation btn-xs pull-left btn-annotation btn-annotation-brush" role="button" data-placement="top" style="margin-right:1%;" ng-click="paintBrush()"><i class="fa fa-paint-brush"></i></a>
  660 + <a href="#canvasPaint" data-tool="eraser" class="btn btn-black-annotation btn-xs pull-left btn-annotation btn-annotation-erase" data-placement="top" data-size=" 1" id="annotationpainteraser" ng-click="EraseDrawing()" ng-mouseover="mouseMoveToolTip(270, 70, 120, 'Erase')" ng-mouseleave="mouseOutToolTip()" role="button"><i class=" fa fa-eraser"></i></a>
  661 +
  662 + <!--<button type="button" id="annotationpainteraser" class="btn btn-black-annotation btn-xs pull-left btn-annotation btn-annotation-erase" data-placement="top" ng-click="EraseDrawing()" ng-mouseover="mouseMoveToolTip(270, 70, 120, 'Erase')" ng-mouseleave="mouseOutToolTip()"><i class="fa fa-eraser"></i></button>-->&nbsp;
661 663 <div style="width: 80px; margin: 0px 0px 0px 4px; display: inline-block;float:left;">
662 664 <div style="width: 58px; float: left;" ng-mouseover="mouseMoveToolTip(270, 100, 120, 'Brush Size')" ng-mouseleave="mouseOutToolTip()">
663 665 <input type="text" id="btnBrushSize" class="form-control" value="1" style="height:32px;border-radius:0;" oninput="Brushsize(this)">
... ... @@ -1309,7 +1311,25 @@
1309 1311 $('#canvas').sketch();
1310 1312 });
1311 1313 </script>-->
  1314 +
1312 1315 <script>
  1316 + function onBrushSizeChange()
  1317 + {
  1318 + $('.btnCursor').addClass('activebtncolor');
  1319 + $(".btn-annotation").removeClass("activebtncolor");
  1320 + $(".btn-annotation-erase").removeClass("activebtncolor");
  1321 + $(".btn-annotation-erase").removeClass("activebtncolor");
  1322 + $(".annotationpaintbrushsize").removeClass("activebtncolor");
  1323 + var x = $('#canvasPaint').css("z-index");
  1324 +
  1325 + var y = $('#canvas').css("z-index");
  1326 + if (x > y) {
  1327 + y = parseInt(x) + 1;
  1328 + } else {
  1329 + y = parseInt(y) + 1;
  1330 + }
  1331 + $('#canvas').css("z-index", y);
  1332 + }
1313 1333 $(function () {
1314 1334 $("#slider-range-min-2").slider({
1315 1335 range: "min",
... ... @@ -1317,7 +1337,7 @@
1317 1337 max: 60,
1318 1338 value: 1,
1319 1339 slide: function (event, ui) {
1320   -
  1340 + onBrushSizeChange();
1321 1341 $("#btnBrushSize").val(ui.value);
1322 1342  
1323 1343 },
... ... @@ -1331,14 +1351,17 @@
1331 1351  
1332 1352  
1333 1353 $("#btnBrushSize").keydown(function () {
  1354 + onBrushSizeChange();
1334 1355 var brushSizevalue = this.value;
1335 1356 $("#slider-range-min-2").slider("value", parseInt(brushSizevalue));
1336 1357 });
1337 1358 $("#btnBrushSize").keyup(function () {
  1359 + onBrushSizeChange();
1338 1360 var brushSizevalue = this.value;
1339 1361 $("#slider-range-min-2").slider("value", parseInt(brushSizevalue));
1340 1362 });
1341 1363 $("#btnBrushSizeIncrement").click(function () {
  1364 + abc();
1342 1365 var brushIncrementVar = $("#btnBrushSize").val();
1343 1366 if (brushIncrementVar >= 60) {
1344 1367 $("#slider-range-min-2").slider("value", 60);
... ... @@ -1355,6 +1378,7 @@
1355 1378 }
1356 1379 });
1357 1380 $("#btnBrushSizeDecrease").click(function () {
  1381 + onBrushSizeChange();
1358 1382 var brushDecreaseVar = $("#btnBrushSize").val();
1359 1383 if (brushDecreaseVar == "") {
1360 1384 var brushDecrementedValue = 1;
... ... @@ -1370,6 +1394,7 @@
1370 1394 $("#slider-range-min-2").slider("value", parseInt(brushDecrementedValue));
1371 1395 }
1372 1396 });
  1397 +
1373 1398 $("#btnBrushSize").val($("#slider-range-min-2").slider("value"));
1374 1399  
1375 1400  
... ...