From dd601b777a778ad21f6a2325b275e7db6ab88ad9 Mon Sep 17 00:00:00 2001 From: Birendra Date: Thu, 3 Sep 2020 08:47:13 +0530 Subject: [PATCH] fix bug in annotation tools --- 400-SOURCECODE/AIAHTML5.Web/app/controllers/DAController.js | 8 +++++++- 400-SOURCECODE/AIAHTML5.Web/app/controllers/HomeController.js | 66 ++++++++++++++++++++++++++++++++++++++++++------------------------ 400-SOURCECODE/AIAHTML5.Web/index.aspx | 12 ++++++------ 400-SOURCECODE/AIAHTML5.Web/libs/sketch.js | 10 +++++++--- 4 files changed, 62 insertions(+), 34 deletions(-) diff --git a/400-SOURCECODE/AIAHTML5.Web/app/controllers/DAController.js b/400-SOURCECODE/AIAHTML5.Web/app/controllers/DAController.js index b04b3b2..443fbed 100644 --- a/400-SOURCECODE/AIAHTML5.Web/app/controllers/DAController.js +++ b/400-SOURCECODE/AIAHTML5.Web/app/controllers/DAController.js @@ -8720,7 +8720,13 @@ AIA.controller("DAController", ["$scope", "$rootScope", "$compile", "$http", "$l $scope.SetwindowStoreData(windowviewid,'zoomInOut',25); $('#zoomValueDA_' + windowviewid).attr('value', $scope.GetwindowStoreData(windowviewid,'zoomInOut')); } - + $rootScope.isLoading = true; + $('#spinner').css('visibility', 'visible'); + var canDiv = document.getElementById('canvasDivDA_' + windowviewid); + var canDivChildCount = canDiv.childElementCount; + if (canDivChildCount > 0) { + canDiv.innerHTML = ''; + } var viewOrientationId = $scope.GetwindowStoreData(windowviewid, 'viewOrientationId'); $scope.CalculateImageCordinates(viewOrientationId,windowviewid); diff --git a/400-SOURCECODE/AIAHTML5.Web/app/controllers/HomeController.js b/400-SOURCECODE/AIAHTML5.Web/app/controllers/HomeController.js index c56c15a..fc1dad8 100644 --- a/400-SOURCECODE/AIAHTML5.Web/app/controllers/HomeController.js +++ b/400-SOURCECODE/AIAHTML5.Web/app/controllers/HomeController.js @@ -2660,7 +2660,10 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data } $rootScope.CIAnotationIdentifyModeOff = false; $rootScope.OnIdentifyClick = function () { - + //clear sketch js event for paint and erase + $.sketch = { tools: {}}; + $rootScope.shapeType = ""; + $(".btn-annotation").removeClass("activebtncolor"); $("#OnIdentify").addClass("annotationtoolbartab"); $("#DrawMode").removeClass("annotationtoolbartab"); @@ -2842,7 +2845,8 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data } $rootScope.DrawingMode = function () { - + //clear sketch js event for paint and erase + $.sketch = { tools: {}}; //Annotation History $rootScope.isAnnotaionToolBarDrawingModeActive = true; $("#OnIdentify").removeClass("annotationtoolbartab"); @@ -2917,6 +2921,8 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data //----Annotation Toolbar: Jcanvas----- $rootScope.DrawLine = function (e) { + //clear sketch js event for paint and erase + $.sketch = { tools: {}}; $('.btnCursor').removeClass('activebtncolor'); $(".btn-annotation").removeClass("activebtncolor"); $(".btn-annotation-line").addClass("activebtncolor"); @@ -2980,7 +2986,8 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data } $rootScope.DrawPin = function (e) { - + //clear sketch js event for paint and erase + $.sketch = { tools: {}}; $('.btnCursor').removeClass('activebtncolor'); $(".btn-annotation").removeClass("activebtncolor"); $(".btn-annotation-pin").addClass("activebtncolor"); @@ -3022,7 +3029,9 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data } - $rootScope.Cursor = function () { + $rootScope.Cursor = function () { + //clear sketch js event for paint and erase + $.sketch = { tools: {}}; $rootScope.shapeType = "cursor"; $(".btn-annotation").removeClass("activebtncolor"); // $("#" + e.currentTarget.id).removeClass("activebtncolor"); @@ -3051,7 +3060,8 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data } $rootScope.DrawRectangle = function (e) { - + //clear sketch js event for paint and erase + $.sketch = { tools: {}}; $('.btnCursor').removeClass('activebtncolor'); $(".btn-annotation").removeClass("activebtncolor"); $(".btn-annotation-rectangle").addClass("activebtncolor"); @@ -3152,13 +3162,12 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data } $rootScope.shapeType = "FreeStylePaint"; - var btnBrushSizeValue = $("#btnBrushSize").val(); - $rootScope.shapeSize = parseInt(btnBrushSizeValue); - $("#annotationpaintbrushsize").attr("data-size", $rootScope.shapeSize); + + $("#annotationpaintbrushsize").attr("data-size", parseInt($("#btnBrushSize").val())); $("#annotationpaintbrushsize").attr("data-color", $rootScope.shapestyleColorWithOpacity); - if ($rootScope.shapeSize == '') { + if (parseInt($("#btnBrushSize").val()) <1) { $("#" + canvasPaintId).sketch({ defaultSize: 1}); } else { @@ -3195,12 +3204,10 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data $rootScope.isAnnotaionToolBarDrawingModeActive = true; $rootScope.switchCanvasToPaintCanvas(paneld); - var btneraseBrushSizeValue = $("#btnBrushSize").val(); - $rootScope.shapeSize = parseInt(btneraseBrushSizeValue); $('#' + canvasPaintId).sketch(); - $("#annotationpainteraser").attr("data-size", $rootScope.shapeSize); + $("#annotationpainteraser").attr("data-size", parseInt($("#btnBrushSize").val())); $scope.PaintEraseEvent(); } } @@ -3219,14 +3226,14 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data this.stopPainting(); } this.color= $rootScope.shapestyleColorWithOpacity!=undefined ? $rootScope.shapestyleColorWithOpacity : "#fff"; - this.size=$rootScope.shapeSize; + this.size= parseInt($("#btnBrushSize").val()); if ($("#annotationpaintbrushsize").hasClass("activebtncolor")) { this.tool='marker'; this.startPainting(); } else if ($("#annotationpainteraser").hasClass("activebtncolor")) { this.tool='eraser'; - this.size=$rootScope.shapeSize>5?$rootScope.shapeSize:5; + this.size=parseInt($("#btnBrushSize").val())>5?parseInt($("#btnBrushSize").val()):5; this.startPainting(); } else @@ -3360,7 +3367,9 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data } } - $rootScope.DrawCircle = function (e) { + $rootScope.DrawCircle = function (e) { + //clear sketch js event for paint and erase + $.sketch = { tools: {}}; $('.btnCursor').removeClass('activebtncolor'); $(".btn-annotation").removeClass("activebtncolor"); $(".btn-annotation-circle").addClass("activebtncolor"); @@ -3402,6 +3411,8 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data } $rootScope.DrawArrow = function (e) { + //clear sketch js event for paint and erase + $.sketch = { tools: {}}; $('.btnCursor').removeClass('activebtncolor'); $(".btn-annotation").removeClass("activebtncolor"); $(".btn-annotation-arrow").addClass("activebtncolor"); @@ -3442,6 +3453,8 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data } } $rootScope.DrawText = function () { + //clear sketch js event for paint and erase + $.sketch = { tools: {}}; $('.btnCursor').removeClass('activebtncolor'); $(".btn-annotation").removeClass("activebtncolor"); $(".btn-annotation-Text").addClass("activebtncolor"); @@ -3484,6 +3497,8 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data } $rootScope.DrawPolygon = function () { + //clear sketch js event for paint and erase + $.sketch = { tools: {}}; $("#OnIdentify").removeClass('annotationtoolbartab'); $("#DrawMode").addClass('annotationtoolbartab'); @@ -4516,7 +4531,7 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data strokeStyle: shapestyleborderColor, strokeWidth: shapestyleborderWidth, rounded: true, - startArrow: true, + endArrow: true, arrowRadius: 7, arrowAngle: 90, x1: offsetX1, y1: offsetY1, @@ -4778,7 +4793,7 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data strokeStyle: 'grey', strokeWidth: shapestyleborderWidth, fillStyle: radial, - x: offsetX1, y: offsetY1, + x: x, y: y, radius: 5, add: function (layer) { layer.draggable = false; @@ -5641,7 +5656,7 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data //Birendra updated due to some issue $rootScope.OnPaintCanvasMouseDown = function (event) { - event.preventDefault(); + event.preventDefault(); if ($rootScope.isAnnotatiomToolBarPopupClosed == false) { if ($rootScope.shapeType==undefined || $rootScope.shapeType=='cursor'||$rootScope.shapeType=="") { return; @@ -5688,12 +5703,13 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data //Birendra updated due to some issue $rootScope.OnPaintCanvasMouseUp = function (event) { event.preventDefault(); + if ($rootScope.isAnnotatiomToolBarPopupClosed == false) { if ($rootScope.shapeType==undefined || $rootScope.shapeType=='cursor'||$rootScope.shapeType=="") { return; } $rootScope.clicked=false; - if (isDrawing === true) { + if (isDrawing === true) { isDrawing = false; $(".line").remove(); $(".arrow").remove(); @@ -5820,7 +5836,7 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data if ($rootScope.shapeType==undefined || $rootScope.shapeType=='cursor'||$rootScope.shapeType=="") { return; } - if ($rootScope.clicked == true) { + if ($rootScope.clicked == true) { var canvasElement=event.target; if (canvasElement!= null || canvasElement != undefined) { @@ -5828,7 +5844,7 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data if (canvasId != null ||canvasId != undefined) { if(canvasId.match("canvasDA")||canvasId.match("canvasAA")||canvasId.match("canvasCI")||canvasId.match("canvasAI")||canvasId.match("canvasPIC")) - { + { var canvasDiv = (event.target.parentElement); var canvasDivId = canvasDiv.id; isDrawing = true; @@ -5841,19 +5857,19 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data case "Line": $(".line").remove(); $rootScope.isLinePreviewCompleted = true; - $("#" + canvasDivId).append("
"); + $("#" + canvasDivId).append("
"); $rootScope.Annotationangle(); break; case "Arrow": $(".arrow").remove(); $rootScope.isArrowPreviewCompleted = true; - $("#" + canvasDivId).append("
"); + $("#" + canvasDivId).append("
"); $rootScope.Annotationangle(); break; case "Pin": $(".pin").remove(); $rootScope.isPinPreviewCompleted = true; - $("#" + canvasDivId).append("
"); + $("#" + canvasDivId).append("
"); $rootScope.Annotationangle(); break; case "Circle": @@ -5917,9 +5933,11 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data break; case "Arrow": $('.arrow').css({ 'transform': 'rotate(' + theta + 'deg)', '-moz-transform': 'rotate(' + theta + 'deg)', '-webkit-transform': 'rotate(' + theta + 'deg)', 'transform-origin': '0% 0%', 'width': dottedLineWidth + 'px' }); + $('.arrowPoint').css({ 'left': dottedLineWidth + 'px' }); break; case "Pin": $('.pin').css({ 'transform': 'rotate(' + theta + 'deg)', '-moz-transform': 'rotate(' + theta + 'deg)', '-webkit-transform': 'rotate(' + theta + 'deg)', 'transform-origin': '0% 0%', 'width': dottedLineWidth + 'px' }); + $('.pinPoint').css({ 'left': dottedLineWidth + 'px' }); break; case "Circle": var classname=".circle" diff --git a/400-SOURCECODE/AIAHTML5.Web/index.aspx b/400-SOURCECODE/AIAHTML5.Web/index.aspx index 0e66917..be47494 100644 --- a/400-SOURCECODE/AIAHTML5.Web/index.aspx +++ b/400-SOURCECODE/AIAHTML5.Web/index.aspx @@ -1807,12 +1807,12 @@