diff --git a/400-SOURCECODE/AIAHTML5.Web/app/controllers/DAController.js b/400-SOURCECODE/AIAHTML5.Web/app/controllers/DAController.js index 9a768c3..85c8260 100644 --- a/400-SOURCECODE/AIAHTML5.Web/app/controllers/DAController.js +++ b/400-SOURCECODE/AIAHTML5.Web/app/controllers/DAController.js @@ -5681,6 +5681,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo $("#DrawMode").addClass('annotationtoolbartab'); //$('.btnCursor').trigger('click'); $("#annotationpaintbrushsize").removeClass("activebtncolor"); + $("#annotationpainteraser").removeClass("activebtncolor"); $('.btnCursor').addClass('activebtncolor'); } diff --git a/400-SOURCECODE/AIAHTML5.Web/app/controllers/HomeController.js b/400-SOURCECODE/AIAHTML5.Web/app/controllers/HomeController.js index 27cbf93..7834b35 100644 --- a/400-SOURCECODE/AIAHTML5.Web/app/controllers/HomeController.js +++ b/400-SOURCECODE/AIAHTML5.Web/app/controllers/HomeController.js @@ -61,8 +61,6 @@ function ($rootScope, Modules, $log, $location, $timeout, DataService, Authentic $rootScope.modifySavedText = []; $rootScope.TextRectangleArr = []; $rootScope.rectDimension = []; - - $rootScope.isEraseToolSelected = false; $rootScope.isMousedownOnPaintCanvas = false; //opacity code $rootScope.shapestyleOpacity = 1; @@ -511,6 +509,7 @@ function ($rootScope, Modules, $log, $location, $timeout, DataService, Authentic //annotation tool custom events $rootScope.ShowAnnotationWindow = function () { //7904 + $rootScope.isAnnotatiomToolBarPopupActive = true; $rootScope.isAnnotatiomToolBarPopupClosed = false; $rootScope.isAnnotaionToolBarDrawingModeActive = false; @@ -519,13 +518,14 @@ function ($rootScope, Modules, $log, $location, $timeout, DataService, Authentic $('#AnnotaionPopupDiv').find('a,input, textarea, button, select,img,div').attr('disabled', 'disabled'); $('#slider-range-min-2').slider('disable'); $("#annotationpaintbrushsize").attr('disabled', 'disabled'); - + $("#annotationpainteraser").attr('disabled', 'disabled'); // $rootScope.disableAnnotationTB = false; } else { $('#AnnotaionPopupDiv').find('input, textarea, button, select,img,div').removeAttr('disabled', 'disabled'); $('#slider-range-min-2').slider('enable'); $("#annotationpaintbrushsize").removeAttr('disabled', 'disabled'); + $("#annotationpainteraser").removeAttr('disabled', 'disabled'); } // document.getElementById('modelbackground').style.display = "block"; // document.getElementById('modeleditstyle').style.display = "block"; @@ -534,9 +534,15 @@ function ($rootScope, Modules, $log, $location, $timeout, DataService, Authentic if ($rootScope.MenuModuleName == "CA") { $("#annotationpaintbrushsize").attr("href", "#"); + $("#annotationpainteraser").attr("href", "#"); + $("#annotationpainteraser").attr('disabled', 'disabled'); + $("#annotationpainteraser").css('pointer-events', 'none'); } else { $("#annotationpaintbrushsize").attr("href", "#canvasPaint"); + $("#annotationpainteraser").attr("href", "#canvasPaint"); + $("#annotationpainteraser").removeAttr('disabled', 'disabled'); + $("#annotationpainteraser").css('pointer-events', 'auto'); } $("#OnIdentify").addClass("annotationtoolbartab"); $("#annotationToolBarOptions").addClass("active"); @@ -892,27 +898,50 @@ function ($rootScope, Modules, $log, $location, $timeout, DataService, Authentic } $rootScope.EraseDrawing = function () { $rootScope.isAnnotaionToolBarDrawingModeActive = true; - $rootScope.switchCanvas(); - $rootScope.isEraseToolSelected = true; - //$rootScope.switchCanvasToPaintCanvas(); $('.btnCursor').removeClass('activebtncolor'); $(".btn-annotation").removeClass("activebtncolor"); $(".btn-annotation-erase").addClass("activebtncolor"); $("#OnIdentify").removeClass('annotationtoolbartab'); $("#DrawMode").addClass('annotationtoolbartab'); + $rootScope.switchCanvasToPaintCanvas(); + var btneraseBrushSizeValue = $("#btnBrushSize").val(); + $('#canvasPaint').sketch(); + $rootScope.eraseshapeSize = parseInt(btneraseBrushSizeValue); + $("#annotationpainteraser").attr("data-size", $rootScope.eraseshapeSize); + return $.sketch.tools.eraser = { + onEvent: function (e) { + return $.sketch.tools.marker.onEvent.call(this, e); + }, + draw: function (action) { + var oldcomposite; + oldcomposite = this.context.globalCompositeOperation; + this.context.globalCompositeOperation = "destination-out"; + action.color = "#000000"; + $.sketch.tools.marker.draw.call(this, action); + return this.context.globalCompositeOperation = oldcomposite; + } + } + + } $rootScope.isShapeSyleOkBtnClicked = false; + $rootScope.setPropertiesForShapes = function (id) { isfilloptionChecked = document.getElementById('fill-option').checked; isOutlineOptionChecked = document.getElementById('Outline-Option').checked; $rootScope.isShapeSyleOkBtnClicked = true; - if ($("#annotationpaintbrushsize").hasClass('activebtncolor')) { + if ($("#annotationpaintbrushsize").hasClass('activebtncolor')) { $("#annotationpaintbrushsize").removeClass('activebtncolor') $rootScope.switchCanvas(); - } + } + if ($("#annotationpainteraser").hasClass('activebtncolor')) { + $("#annotationpainteraser").removeClass('activebtncolor') + $rootScope.switchCanvas(); + + } if ((document.getElementById('fill-option').checked == false) && (document.getElementById('Outline-Option').checked == false)) { // $('#btnShapeStyle').attr('disabled', 'disabled'); } else { @@ -988,6 +1017,7 @@ function ($rootScope, Modules, $log, $location, $timeout, DataService, Authentic $rootScope.disableAnnotationToolBar = function () { + if ($rootScope.isShapeSyleOkBtnClicked == false) { $('#editstylebackgroundcolor .minicolors >.minicolors-swatch > .minicolors-swatch-color').css("background-color", "rgb(255,255,255)"); $('#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 // $(".marginTopBtm10 div.outlinediv").css("border-color", x); //}); } else { + document.getElementById('fill-option').checked = isfilloptionChecked; document.getElementById('Outline-Option').checked = isOutlineOptionChecked; if (isfilloptionChecked == true) { @@ -1056,7 +1087,7 @@ function ($rootScope, Modules, $log, $location, $timeout, DataService, Authentic $("#borderWidthCanvasElement").css({ "pointer-events": "none" }); $("#outlineColor").css({ "pointer-events": "none" }); } - var previewBgColor = $("#shapeStyleDiv").css('background-color'); + var previewBgColor = $("#shapeStyleDiv").css('background-color'); var previewBorderColor = $('#previewBorder').css('border-color'); var previewBorderWidth = $('#previewBorder').css('border-width'); var previewOpacity = $('#previewBorder').css('opacity'); @@ -1068,6 +1099,7 @@ function ($rootScope, Modules, $log, $location, $timeout, DataService, Authentic $('#borderWidthCanvasElement').val(previewBorderWidth.split("px")); $("#imgOpacity").css("opacity", previewOpacity); $(".marginTopBtm10 div.outlinediv").css("opacity", previewOpacity); + } document.getElementById('modelbackground').style.display = "none"; document.getElementById('modeleditstyle').style.display = "none"; @@ -1165,6 +1197,7 @@ function ($rootScope, Modules, $log, $location, $timeout, DataService, Authentic } $rootScope.DrawRectangleOnModuleItem = function (canvasId, RectNumber, shapestyleFillColor, shapestyleborderColor, shapestyleOpacity, shapestyleborderWidth, offsetX1, offsetY1, x, y) { + if ($rootScope.isRectanglePreviewCompleted == true) { $rootScope.isRectanglePreviewCompleted = false; $(canvasId).addLayer({ @@ -2722,12 +2755,16 @@ function ($rootScope, Modules, $log, $location, $timeout, DataService, Authentic $rootScope.disableAnnotationtoolOnListManager = false; $rootScope.ShowListManager = function () { $rootScope.switchCanvas(); - $("#annotationpaintbrushsize").attr("href", "#"); + $("#annotationpaintbrushsize").attr("href", "#"); + $("#annotationpainteraser").attr("href", "#"); console.log('ShowListManager') $rootScope.disableAnnotationtoolOnListManager = true; $('#AnnotaionPopupDiv').find('a,input, textarea, button, select,img,div').attr('disabled', 'disabled'); $('#slider-range-min-2').slider('disable'); $("#annotationpaintbrushsize").attr('disabled', 'disabled'); + $("#annotationpainteraser").attr('disabled', 'disabled'); + $("#annotationpaintbrushsize").css('pointer-events', 'none'); + $("#annotationpainteraser").css('pointer-events', 'none'); $rootScope.isLoading = true; $('#spinner').css('visibility', 'visible'); @@ -2777,10 +2814,14 @@ function ($rootScope, Modules, $log, $location, $timeout, DataService, Authentic $rootScope.disableAnnotationtoolOnListManager = false; if ($rootScope.MenuModuleName == "DA") { $("#annotationpaintbrushsize").attr("href", "#canvasPaint"); + $("#annotationpainteraser").attr("href", "#canvasPaint"); if ($rootScope.disableAnnotationtoolOnListManager == false) { $('#AnnotaionPopupDiv').find('a,input, textarea, button, select,img,div').removeAttr('disabled', 'disabled'); $('#slider-range-min-2').slider('enable'); $("#annotationpaintbrushsize").removeAttr('disabled', 'disabled'); + $("#annotationpainteraser").removeAttr('disabled', 'disabled'); + $("#annotationpaintbrushsize").css('pointer-events', 'auto'); + $("#annotationpainteraser").css('pointer-events', 'auto'); $rootScope.switchCanvasToPaintCanvas(); } } @@ -2999,77 +3040,14 @@ function ($rootScope, Modules, $log, $location, $timeout, DataService, Authentic - $rootScope.FreeStylePaint = function (e) { - - var annotationCanvas = document.getElementById("canvas"); - annotationCanvas.addEventListener('mousedown', $rootScope.OnPaintBrushCanvasMouseDown, false); - annotationCanvas.addEventListener('mouseup', $rootScope.OnPaintBrushCanvasMouseUp, false); - // document.getElementById("canvasPaint").addEventListener("mouseup", OnPaintBrushCanvasMouseUp); - - //if ($rootScope.isAnnotaionToolBarDrawingModeActive == true) { - // $rootScope.getAnnotationTextBasedOnSelectedBodyRegion(e); - - //} - //else { - - - - //} - } - - $rootScope.OnPaintBrushCanvasMouseDown = function (event) { - if ($rootScope.isAnnotatiomToolBarPopupClosed == false) { - $rootScope.isMousedownOnPaintCanvas = true; - $rootScope.isStartPointDeleted = false; - var annotationCanvas = document.getElementById("canvas"); - $rootScope.startPageX = parseInt(event.clientX - ($("#canvas").offset().left)); - $rootScope.startPageY = parseInt(event.clientY - ($("#canvas").offset().top)); - - annotationCanvas.addEventListener('mousemove', $rootScope.OnPaintBrushCanvasMouseMove, false); - } - } - $rootScope.OnPaintBrushCanvasMouseMove = function (event) { - - $rootScope.xPage = parseInt(event.clientX - ($("#canvas").offset().left)); - $rootScope.yPage = parseInt(event.clientY - ($("#canvas").offset().top)); - - var btneraseBrushSizeValue = $("#btnBrushSize").val(); - $rootScope.eraseshapeSize = parseInt(btneraseBrushSizeValue); - - if ($rootScope.isEraseToolSelected == true && $rootScope.isMousedownOnPaintCanvas == true) { - - var sktch = $('#canvasPaint').sketch(); - $('#canvasPaint').sketch().actions = []; - var paintCanvas = document.getElementById("canvasPaint"); - var paintCanvasContext = paintCanvas.getContext('2d'); - if ($rootScope.isStartPointDeleted == false) { - - paintCanvasContext.clearRect($rootScope.startPageX, $rootScope.startPageY, $rootScope.eraseshapeSize, $rootScope.eraseshapeSize); - - $rootScope.isStartPointDeleted = true; - } - - paintCanvasContext.clearRect($rootScope.xPage, $rootScope.yPage, $rootScope.eraseshapeSize, $rootScope.eraseshapeSize); - - - } - } - $rootScope.OnPaintBrushCanvasMouseUp = function (event) { - if ($rootScope.isAnnotatiomToolBarPopupClosed == false) { - $rootScope.isMousedownOnPaintCanvas = false; - $rootScope.isEraseToolSelected = false; - $(".btn-annotation-erase").removeClass("activebtncolor"); - } - } - $rootScope.reloadChildController = function () { diff --git a/400-SOURCECODE/AIAHTML5.Web/index.html b/400-SOURCECODE/AIAHTML5.Web/index.html index 51e4090..f2c1ae1 100644 --- a/400-SOURCECODE/AIAHTML5.Web/index.html +++ b/400-SOURCECODE/AIAHTML5.Web/index.html @@ -656,8 +656,10 @@