From c15dd72debe06088ad21adf7a8be6a9c3b8d2eea Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 13 Jan 2017 15:11:40 +0530 Subject: [PATCH] Commit Changes For History Code --- 400-SOURCECODE/AIAHTML5.Web/app/controllers/DAController.js | 141 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++--- 400-SOURCECODE/AIAHTML5.Web/app/controllers/HomeController.js | 1136 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 2 files changed, 792 insertions(+), 485 deletions(-) diff --git a/400-SOURCECODE/AIAHTML5.Web/app/controllers/DAController.js b/400-SOURCECODE/AIAHTML5.Web/app/controllers/DAController.js index 7043864..527803b 100644 --- a/400-SOURCECODE/AIAHTML5.Web/app/controllers/DAController.js +++ b/400-SOURCECODE/AIAHTML5.Web/app/controllers/DAController.js @@ -776,15 +776,27 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo $('#spinner').css('visibility', 'visible'); $scope.modestyImageInfo = []; // annotation toolbar canvas - if ($("#canvasDiv").find("canvas[id='canvasPaint']").length == 0) { - var $layerChange = $("#canvasDiv").append(''); - $compile($layerChange)($scope); + //history code + + if ($("#canvasDiv").find("canvas[id='canvasPaint']").length == 0) { + var annotationAppendedCanvas = $("#canvasDiv").append(''); + $compile(annotationAppendedCanvas)($scope); $scope.BindCanvasDrawingListners(); // $rootScope.FreeStylePaint(); } + //duplicate code + //if ($("#canvasDiv").find("canvas[id='canvasPaint']").length == 0) { + + // var $layerChange = $("#canvasDiv").append(''); + // $compile($layerChange)($scope); + // $scope.BindCanvasDrawingListners(); + // // $rootScope.FreeStylePaint(); + + //} + $scope.terminateCurrentlyRunningWPs(); @@ -2986,6 +2998,15 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo //$(".com").css("display", "none"); //$("#bord").css({ "width": "0px", "display": "none" }); + + //history maintained issue + if ($rootScope.isAnnotaionToolBarDrawingModeActive == true) { + $("#sppeachBubble").remove(); + $("#dot").remove(); + } + + + $(".com").remove(); $("#bord").remove(); @@ -3088,6 +3109,12 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo document.getElementById('sppeachBubble').style.left = (Globe[0].currentX) + 'px'; document.getElementById('sppeachBubble').style.top = (Globe[0].currentY) + 'px'; + + //history maintained issue + if ($rootScope.isAnnotaionToolBarDrawingModeActive == true) { document.getElementById('sppeachBubble').style.zIndex = "100000000000"; } + + + $('#sppeachBubble').draggable( { drag: function (evt) { @@ -4645,6 +4672,114 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo //} } + // History Maintained Issue// + + $rootScope.DrawingListners_Canvas = function (event) { + + + var canvasDiv = document.getElementById('canvasDiv'); + var verticalScrollPosition = canvasDiv.scrollTop; + var horizontlScrollPosition = canvasDiv.scrollLeft; + + + $rootScope.Xaxis = event.pageX - $('#canvasDiv').offset().left + horizontlScrollPosition; + $rootScope.Yaxis = event.pageY - $('#canvasDiv').offset().top + verticalScrollPosition; + + + $rootScope.getBodyRegionID(); + + if ($rootScope.MaskedCanvasMrImageForAnotation == "No") { + var maskCanvasIdForAnnotation = "imageCanvas" + $rootScope.MaskedCanvasIDForAnnotation + "_mci"; + var maskCanvas = document.getElementById(maskCanvasIdForAnnotation); + var maskCanvasContext = maskCanvas.getContext("2d"); + var canvasDiv = document.getElementById('canvasDiv'); + var verticalScrollPosition = canvasDiv.scrollTop; + var horizontlScrollPosition = canvasDiv.scrollLeft; + var actulalX = $rootScope.Xaxis; + var actualY = $rootScope.Yaxis; + var RGBColor = $scope.GetRGBColor(maskCanvasContext, actulalX, actualY, $rootScope.MaskedCanvasXForAnotation, $rootScope.MaskedCanvasYForAnotation); + var annotationText = $scope.GetAnnotationText(parseInt(RGBColor)); + + } + else { + + var maskCanvasIdForAnnotation = "imageCanvas" + $rootScope.MaskedCanvasIDForAnnotation + "_MR_mci"; + var maskoffsetval = $('#' + maskCanvasIdForAnnotation).offset(); + var mirrorCanvasX = maskoffsetval.left; + //alert(mirrorCanvasX); + var mirrorImageCanvas = document.getElementById(maskCanvasIdForAnnotation); + var mirrorCanvasWidth = mirrorImageCanvas.clientWidth; + // alert(mirrorCanvasWidth); + var maskCanvas = document.getElementById(maskCanvasIdForAnnotation); + var maskCanvasContext = maskCanvas.getContext("2d"); + + var distanceXOnMirrorImage = (parseInt(mirrorCanvasX) + parseInt(mirrorCanvasWidth)) - (parseInt(event.pageX) + horizontlScrollPosition);// - 135); + var mirrorXOnNormalImage = parseInt(maskCanvasContext.canvas.offsetLeft) + parseInt(distanceXOnMirrorImage); + var actulalX = mirrorXOnNormalImage; + var actualY = event.pageY + verticalScrollPosition; + var pixelData = maskCanvasContext.getImageData(Math.round(actulalX - parseInt(maskCanvasContext.canvas.offsetLeft)), Math.round(actualY - $rootScope.MaskedCanvasYForAnotation), 1, 1); + pixelData.data[0] = pixelData.data[0] - 9; + pixelData.data[1] = pixelData.data[1] - 9; + pixelData.data[2] = pixelData.data[2] - 9 + var Red; + var Green; + var Blue; + var zero = "0"; + if ((pixelData.data[0]).toString().length != 2) { + Red = zero.concat((pixelData.data[0]).toString()) + } + else { + Red = (pixelData.data[0]).toString() + } + if ((pixelData.data[1]).toString().length != 2) { + Green = zero.concat((pixelData.data[1]).toString()) + } + else { + Green = (pixelData.data[1]).toString() + } + if ((pixelData.data[2]).toString().length != 2) { + Blue = zero.concat((pixelData.data[2]).toString()) + } + else { + Blue = (pixelData.data[2]).toString() + } + var RGBColor = (Red + Green + Blue); + // alert(RGBColor); + //$rootScope.previousHighlightList.push(RGBColor); + + } + + // var maskCanvasIdForAnnotation = "imageCanvas" + $rootScope.MaskedCanvasIDForAnnotation + "_mci"; + + // alert(annotationText); + $scope.MultiLanguageAnnationArray = []; + $scope.MultiLanguageAnnationArray.push(annotationText); + if (annotationText == "undefined") { + } + else { + $scope.createDynamicSpeechBubble(event, event.pageX + horizontlScrollPosition - $('#canvasDiv').offset().left, event.pageY + verticalScrollPosition - $('#canvasDiv').offset().top, true) + } + + + } + + + $rootScope.getBodyRegionID = function () { + var BodyRegionDictionary = $rootScope.BodyRegionCordinatesData; + + $.each(BodyRegionDictionary, function (index, value) { + var bodyRegionRight = parseInt(value.X) + parseInt(value.Width); + var bodyRegionBottom = parseInt(value.Y) + parseInt(value.Height); + if ($rootScope.Xaxis <= bodyRegionRight && $rootScope.Yaxis <= bodyRegionBottom && value.X <= $rootScope.Xaxis && value.Y <= $rootScope.Yaxis) { + $rootScope.MaskedCanvasIDForAnnotation = value.bodyRegionId; + $rootScope.MaskedCanvasXForAnotation = value.X; + $rootScope.MaskedCanvasYForAnotation = value.Y; + $rootScope.MaskedCanvasMrImageForAnotation = value.IsMirror; + return false; + } + }); + } + function resizeCanvas() { diff --git a/400-SOURCECODE/AIAHTML5.Web/app/controllers/HomeController.js b/400-SOURCECODE/AIAHTML5.Web/app/controllers/HomeController.js index b560793..0ced8eb 100644 --- a/400-SOURCECODE/AIAHTML5.Web/app/controllers/HomeController.js +++ b/400-SOURCECODE/AIAHTML5.Web/app/controllers/HomeController.js @@ -198,8 +198,8 @@ AIA.controller("HomeController", ["$rootScope", "Modules", "$log", "$location", $rootScope.isAnnotationWindowOpen = true; $(".annotationTollbar").css("display", "block"); $rootScope.$broadcast('annotationToolEvent', true); - $("#canvasPaint").css("display", "none"); - $("#canvas").css("display", "none"); + // $("#canvasPaint").css("display", "none"); + // $("#canvas").css("display", "none"); var FontFamilyJson = '~/../content/data/json/settings/fontstyle.json'; if ($rootScope.isFontFamilyLoaded == false) { @@ -240,10 +240,11 @@ AIA.controller("HomeController", ["$rootScope", "Modules", "$log", "$location", $(".annotationTollbar").css("display", "none"); $rootScope.isAnnotationWindowClose = true; - $("#canvasPaint").css("display", "none"); - $("#canvas").css("display", "none"); + // $("#canvasPaint").css("display", "none"); + // $("#canvas").css("display", "none"); $('.btnCursor').removeClass('activebtncolor'); $(".btn-annotation").removeClass("activebtncolor"); + $rootScope.isAnnotaionToolBarDrawingModeActive = true; } $rootScope.CIAnotationIdentifyModeOff = false; $rootScope.OnIdentifyClick = function () { @@ -257,25 +258,31 @@ AIA.controller("HomeController", ["$rootScope", "Modules", "$log", "$location", $('.btnCursor').removeClass('activebtncolor'); } else { - $("#canvasPaint").css("display", "none"); - $("#canvas").css("display", "none"); + // $("#canvasPaint").css("display", "none"); + // $("#canvas").css("display", "none"); // $("#canvasPaint").css("z-index", "0"); // $("#canvas").css("z-index", "0"); $('.btnCursor').removeClass('activebtncolor'); } + + $rootScope.isAnnotaionToolBarDrawingModeActive = true; + $rootScope.switchCanvas(); } $rootScope.DrawingMode = function () { + //Annotation History + $rootScope.isAnnotaionToolBarDrawingModeActive = false; $("#OnIdentify").removeClass("annotationtoolbartab"); $("#DrawMode").addClass("annotationtoolbartab"); $('.btnCursor').addClass('activebtncolor'); $rootScope.switchCanvas(); - $("#canvasPaint").css("display", "block"); - $("#canvas").css("display", "block"); + + // $("#canvasPaint").css("display", "block"); + // $("#canvas").css("display", "block"); } @@ -345,6 +352,7 @@ AIA.controller("HomeController", ["$rootScope", "Modules", "$log", "$location", } $rootScope.paintBrush = function () { + $rootScope.isAnnotaionToolBarDrawingModeActive = false; if ($rootScope.disableAnnotationtoolOnListManager == true) { $rootScope.switchCanvas(); var canvasPaintZindex = $('#canvasPaint').css("z-index"); //x @@ -361,7 +369,7 @@ AIA.controller("HomeController", ["$rootScope", "Modules", "$log", "$location", } } else { - // debugger; + // $('.btnCursor').addClass('activebtncolor'); $rootScope.setListManagerZindex = true; $("#canvasPaint").css("display", "block"); @@ -456,6 +464,7 @@ AIA.controller("HomeController", ["$rootScope", "Modules", "$log", "$location", $('#canvas').css("z-index", y); } $rootScope.EraseDrawing = function () { + $rootScope.isAnnotaionToolBarDrawingModeActive = false; $rootScope.switchCanvas(); $rootScope.isEraseToolSelected = true; //$rootScope.switchCanvasToPaintCanvas(); @@ -563,47 +572,62 @@ AIA.controller("HomeController", ["$rootScope", "Modules", "$log", "$location", x2: x, y2: y, click: function (layer) { - $rootScope.canvasLayerNameCollection = []; - $rootScope.canvasLayerNameCollection.push(layer.name); - $(canvasId).setLayer(layer.name, { - handle: { - type: 'arc', - fillStyle: '#fff', - strokeStyle: '#c33', - strokeWidth: 2, - radius: 3 - } - }).drawLayers(); - - + if ($rootScope.isAnnotaionToolBarDrawingModeActive == false) { + layer.draggable = true; + $rootScope.canvasLayerNameCollection = []; + $rootScope.canvasLayerNameCollection.push(layer.name); + $(canvasId).setLayer(layer.name, { + handle: { + type: 'arc', + fillStyle: '#fff', + strokeStyle: '#c33', + strokeWidth: 2, + radius: 3 + } + }).drawLayers(); + + } + else { + layer.draggable = false; + } }, mouseout: function (layer) { - $rootScope.canvasLayerNameCollection = []; - $(canvasId).setLayer(layer.name, { - handle: { - type: 'arc', - fillStyle: '#fff', - strokeStyle: '#c33', - strokeWidth: 0, - radius: 0 - } - - }).drawLayers(); - + if ($rootScope.isAnnotaionToolBarDrawingModeActive == false) { + layer.draggable = true; + $rootScope.canvasLayerNameCollection = []; + $(canvasId).setLayer(layer.name, { + handle: { + type: 'arc', + fillStyle: '#fff', + strokeStyle: '#c33', + strokeWidth: 0, + radius: 0 + } + + }).drawLayers(); + } + else { + layer.draggable = false; + } }, mouseover: function (layer) { - - $(canvasId).setLayer(layer.name, { - handle: { - type: 'arc', - fillStyle: '#fff', - strokeStyle: '#c33', - strokeWidth: 2, - radius: 3 - } - }).drawLayers(); - + if ($rootScope.isAnnotaionToolBarDrawingModeActive == false) { + layer.draggable = true; + + $(canvasId).setLayer(layer.name, { + handle: { + type: 'arc', + fillStyle: '#fff', + strokeStyle: '#c33', + strokeWidth: 2, + radius: 3 + } + }).drawLayers(); + } + else { + layer.draggable = false; + } } }).drawLayers(); @@ -639,7 +663,9 @@ AIA.controller("HomeController", ["$rootScope", "Modules", "$log", "$location", }, - click: function (layer) { + click: function (layer) { + if ($rootScope.isAnnotaionToolBarDrawingModeActive == false) { + layer.draggable = true; $rootScope.canvasLayerNameCollection = []; $rootScope.canvasLayerNameCollection.push(layer.name); $(canvasId).setLayer(layer.name, { @@ -652,9 +678,14 @@ AIA.controller("HomeController", ["$rootScope", "Modules", "$log", "$location", cornerRadius: 3 } }).drawLayers(); - + } + else { + layer.draggable = false; + } }, - mouseout: function (layer) { + mouseout: function (layer) { + if ($rootScope.isAnnotaionToolBarDrawingModeActive == false) { + layer.draggable = true; $rootScope.canvasLayerNameCollection = []; $(canvasId).setLayer(layer.name, { handle: { @@ -667,22 +698,29 @@ AIA.controller("HomeController", ["$rootScope", "Modules", "$log", "$location", } }).drawLayers(); - + } + else { + layer.draggable = false; + } }, mouseover: function (layer) { - - - $(canvasId).setLayer(layer.name, { - handle: { - type: 'rectangle', - fillStyle: '#fff', - strokeStyle: '#c33', - strokeWidth: 2, - width: 5, height: 5, - cornerRadius: 3 - } - }).drawLayers(); - + if ($rootScope.isAnnotaionToolBarDrawingModeActive == false) { + layer.draggable = true; + + $(canvasId).setLayer(layer.name, { + handle: { + type: 'rectangle', + fillStyle: '#fff', + strokeStyle: '#c33', + strokeWidth: 2, + width: 5, height: 5, + cornerRadius: 3 + } + }).drawLayers(); + } + else { + layer.draggable = false; + } } }).drawLayers(); } @@ -712,49 +750,63 @@ AIA.controller("HomeController", ["$rootScope", "Modules", "$log", "$location", resizeFromCenter: false, handlePlacement: 'both', click: function (layer) { - $rootScope.canvasLayerNameCollection = []; - $rootScope.canvasLayerNameCollection.push(layer.name); - $(canvasId).setLayer(layer.name, { - handle: { - type: 'arc', - fillStyle: '#fff', - strokeStyle: '#c33', - strokeWidth: 2, - radius: 3 - } - }).drawLayers(); - + if ($rootScope.isAnnotaionToolBarDrawingModeActive == false) { + layer.draggable = true; + $rootScope.canvasLayerNameCollection = []; + $rootScope.canvasLayerNameCollection.push(layer.name); + $(canvasId).setLayer(layer.name, { + handle: { + type: 'arc', + fillStyle: '#fff', + strokeStyle: '#c33', + strokeWidth: 2, + radius: 3 + } + }).drawLayers(); + } + else { + layer.draggable = false; + } }, mouseout: function (layer) { - $rootScope.canvasLayerNameCollection = []; - - $(canvasId).setLayer(layer.name, { - handle: { - type: 'arc', - fillStyle: '#fff', - strokeStyle: '#c33', - strokeWidth: 0, - // width: 0, height: 0, - radius: 0 - } - - }).drawLayers(); - + if ($rootScope.isAnnotaionToolBarDrawingModeActive == false) { + layer.draggable = true; + $rootScope.canvasLayerNameCollection = []; + + $(canvasId).setLayer(layer.name, { + handle: { + type: 'arc', + fillStyle: '#fff', + strokeStyle: '#c33', + strokeWidth: 0, + // width: 0, height: 0, + radius: 0 + } + + }).drawLayers(); + } + else { + layer.draggable = false; + } }, mouseover: function (layer) { - - - $(canvasId).setLayer(layer.name, { - handle: { - type: 'arc', - fillStyle: '#fff', - strokeStyle: '#c33', - strokeWidth: 2, - // width: 5, height: 5, - radius: 3 - } - }).drawLayers(); - + if ($rootScope.isAnnotaionToolBarDrawingModeActive == false) { + layer.draggable = true; + + $(canvasId).setLayer(layer.name, { + handle: { + type: 'arc', + fillStyle: '#fff', + strokeStyle: '#c33', + strokeWidth: 2, + // width: 5, height: 5, + radius: 3 + } + }).drawLayers(); + } + else { + layer.draggable = false; + } } }).drawLayers(); } @@ -780,50 +832,65 @@ AIA.controller("HomeController", ["$rootScope", "Modules", "$log", "$location", x2: x, y2: y, click: function (layer) { - $rootScope.canvasLayerNameCollection = []; - $rootScope.canvasLayerNameCollection.push(layer.name); - $(canvasId).setLayer(layer.name, { - handle: { - type: 'arc', - fillStyle: '#fff', - strokeStyle: '#c33', - strokeWidth: 2, - // width: 5, height: 5, - radius: 3 - } - }).drawLayers(); - // $("#canvas").removeLayer(layer.name).drawLayers(); + if ($rootScope.isAnnotaionToolBarDrawingModeActive == false) { + layer.draggable = true; + $rootScope.canvasLayerNameCollection = []; + $rootScope.canvasLayerNameCollection.push(layer.name); + $(canvasId).setLayer(layer.name, { + handle: { + type: 'arc', + fillStyle: '#fff', + strokeStyle: '#c33', + strokeWidth: 2, + // width: 5, height: 5, + radius: 3 + } + }).drawLayers(); + // $("#canvas").removeLayer(layer.name).drawLayers(); + } + else { + layer.draggable = false; + } }, mouseout: function (layer) { - $rootScope.canvasLayerNameCollection = []; - $(canvasId).setLayer(layer.name, { - handle: { - type: 'arc', - fillStyle: '#fff', - strokeStyle: '#c33', - strokeWidth: 0, - // width: 0, height: 0, - radius: 0 - } - - }).drawLayers(); - + if ($rootScope.isAnnotaionToolBarDrawingModeActive == false) { + layer.draggable = true; + $rootScope.canvasLayerNameCollection = []; + $(canvasId).setLayer(layer.name, { + handle: { + type: 'arc', + fillStyle: '#fff', + strokeStyle: '#c33', + strokeWidth: 0, + // width: 0, height: 0, + radius: 0 + } + + }).drawLayers(); + } + else { + layer.draggable = false; + } }, mouseover: function (layer) { - - $(canvasId).setLayer(layer.name, { - handle: { - type: 'arc', - fillStyle: '#fff', - strokeStyle: '#c33', - strokeWidth: 2, - // width: 5, height: 5, - radius: 3 - } - }).drawLayers(); - + if ($rootScope.isAnnotaionToolBarDrawingModeActive == false) { + layer.draggable = true; + $(canvasId).setLayer(layer.name, { + handle: { + type: 'arc', + fillStyle: '#fff', + strokeStyle: '#c33', + strokeWidth: 2, + // width: 5, height: 5, + radius: 3 + } + }).drawLayers(); + } + else { + layer.draggable = false; + } } }); @@ -857,59 +924,71 @@ AIA.controller("HomeController", ["$rootScope", "Modules", "$log", "$location", x2: x, y2: y, click: function (layer) { - - $rootScope.shapeTypePin = "Pin"; - $rootScope.canvasLayerNameCollection = []; - var pinLine_layer = layer.name; - var pinLine_layer_split = pinLine_layer.split("_"); - var pinArcName = "ArcPin_"; - var pinResult = pinArcName.concat(pinLine_layer_split[1]); - - $rootScope.canvasLayerNameCollection.push({ pinName: layer.name, ArcName: pinResult }); - - $(canvasId).setLayer(layer.name, { - handle: { - type: 'arc', - fillStyle: '#fff', - strokeStyle: '#c33', - strokeWidth: 2, - // width: 5, height: 5, - radius: 3 - } - }).drawLayers(); - - + if ($rootScope.isAnnotaionToolBarDrawingModeActive == false) { + layer.draggable = true; + $rootScope.shapeTypePin = "Pin"; + $rootScope.canvasLayerNameCollection = []; + var pinLine_layer = layer.name; + var pinLine_layer_split = pinLine_layer.split("_"); + var pinArcName = "ArcPin_"; + var pinResult = pinArcName.concat(pinLine_layer_split[1]); + + $rootScope.canvasLayerNameCollection.push({ pinName: layer.name, ArcName: pinResult }); + + $(canvasId).setLayer(layer.name, { + handle: { + type: 'arc', + fillStyle: '#fff', + strokeStyle: '#c33', + strokeWidth: 2, + // width: 5, height: 5, + radius: 3 + } + }).drawLayers(); + + } + else { + layer.draggable = false; + } }, mouseout: function (layer) { - - $rootScope.canvasLayerNameCollection = []; - $(canvasId).setLayer(layer.name, { - handle: { - type: 'arc', - fillStyle: '#fff', - strokeStyle: '#c33', - strokeWidth: 0, - // width: 0, height: 0, - radius: 0 - } - - }).drawLayers(); - + if ($rootScope.isAnnotaionToolBarDrawingModeActive == false) { + layer.draggable = true; + $rootScope.canvasLayerNameCollection = []; + $(canvasId).setLayer(layer.name, { + handle: { + type: 'arc', + fillStyle: '#fff', + strokeStyle: '#c33', + strokeWidth: 0, + // width: 0, height: 0, + radius: 0 + } + + }).drawLayers(); + } + else { + layer.draggable = false; + } }, mouseover: function (layer) { - - $(canvasId).setLayer(layer.name, { - handle: { - type: 'arc', - fillStyle: '#fff', - strokeStyle: '#c33', - strokeWidth: 2, - // width: 5, height: 5, - radius: 3 - } - }).drawLayers(); - + if ($rootScope.isAnnotaionToolBarDrawingModeActive == false) { + layer.draggable = true; + $(canvasId).setLayer(layer.name, { + handle: { + type: 'arc', + fillStyle: '#fff', + strokeStyle: '#c33', + strokeWidth: 2, + // width: 5, height: 5, + radius: 3 + } + }).drawLayers(); + } + else { + layer.draggable = false; + } } }).drawArc({ draggable: true, @@ -990,85 +1069,103 @@ AIA.controller("HomeController", ["$rootScope", "Modules", "$log", "$location", }, click: function (layer) { - - $rootScope.canvasLayerNameCollection = []; - $rootScope.canvasLayerNameCollection.push(layer.name); - $('#canvas').setLayer(layer.name, { - handle: { - type: 'rectangle', - fillStyle: '#fff', - strokeStyle: '#c33', - strokeWidth: 2, - width: 5, height: 5, - cornerRadius: 3 - } - }).drawLayers(); - + if ($rootScope.isAnnotaionToolBarDrawingModeActive == false) { + layer.draggable = true; + $rootScope.canvasLayerNameCollection = []; + $rootScope.canvasLayerNameCollection.push(layer.name); + $('#canvas').setLayer(layer.name, { + handle: { + type: 'rectangle', + fillStyle: '#fff', + strokeStyle: '#c33', + strokeWidth: 2, + width: 5, height: 5, + cornerRadius: 3 + } + }).drawLayers(); + } + else { + layer.draggable = false; + } }, dblclick: function (layer) { + if ($rootScope.isAnnotaionToolBarDrawingModeActive == false) { + layer.draggable = true; + $rootScope.IsTextAlreadySave = false; + var RectNameArray = (layer.name).split("_"); - $rootScope.IsTextAlreadySave = false; - var RectNameArray = (layer.name).split("_"); - - var TextAreaRectangleName = "TextArea_"; - var TextAreaRectNameConcat = TextAreaRectangleName.concat(RectNameArray[1]); - $rootScope.TextAreaRectID = layer.name; - $rootScope.TextID = TextAreaRectNameConcat; - - $rootScope.rectDimension.push({ width: layer.width, height: layer.height, x: layer.x, y: layer.y }); - $("#annotationTextModal").css("padding-right", "0px"); - document.getElementById('modelbackground').style.display = "block"; - $("#annotationTextModal").modal("toggle"); + var TextAreaRectangleName = "TextArea_"; + var TextAreaRectNameConcat = TextAreaRectangleName.concat(RectNameArray[1]); + $rootScope.TextAreaRectID = layer.name; + $rootScope.TextID = TextAreaRectNameConcat; - $("#text_area").val(''); - $("#text_area").css({ "font-family": "Arial", "font-size": "14px", "font-weight": "normal", "font-style": "normal", "color": "#000", "text-align": "left", "text-decoration": "none" }); - $("#font-color .minicolors .minicolors-swatch .minicolors-swatch-color").css({ "background-color": "#000000" }); - // $("#font-color .minicolors .minicolors-swatch .minicolors-swatch-color").addClass("ActiveDefaultColorAnnotation"); + $rootScope.rectDimension.push({ width: layer.width, height: layer.height, x: layer.x, y: layer.y }); + $("#annotationTextModal").css("padding-right", "0px"); + document.getElementById('modelbackground').style.display = "block"; + $("#annotationTextModal").modal("toggle"); - $("#selected-font-family option:eq(0)").prop('selected', true); - $("#selected-font-size option:eq(0)").prop('selected', true); + $("#text_area").val(''); + $("#text_area").css({ "font-family": "Arial", "font-size": "14px", "font-weight": "normal", "font-style": "normal", "color": "#000", "text-align": "left", "text-decoration": "none" }); + $("#font-color .minicolors .minicolors-swatch .minicolors-swatch-color").css({ "background-color": "#000000" }); + // $("#font-color .minicolors .minicolors-swatch .minicolors-swatch-color").addClass("ActiveDefaultColorAnnotation"); - $("#text-italic").removeClass("ActiveFormattingButtonClass"); + $("#selected-font-family option:eq(0)").prop('selected', true); + $("#selected-font-size option:eq(0)").prop('selected', true); - $("#text-bold").removeClass("ActiveFormattingButtonClass"); + $("#text-italic").removeClass("ActiveFormattingButtonClass"); - $("#text-underline").removeClass("ActiveFormattingButtonClass"); + $("#text-bold").removeClass("ActiveFormattingButtonClass"); - $("#text-left").removeClass("ActiveFormattingButtonClass"); + $("#text-underline").removeClass("ActiveFormattingButtonClass"); - $("#text-right").removeClass("ActiveFormattingButtonClass"); + $("#text-left").removeClass("ActiveFormattingButtonClass"); - $("#text-center").removeClass("ActiveFormattingButtonClass"); + $("#text-right").removeClass("ActiveFormattingButtonClass"); + $("#text-center").removeClass("ActiveFormattingButtonClass"); + } + else { + layer.draggable = false; + } }, mouseout: function (layer) { - $rootScope.canvasLayerNameCollection = []; - $('#canvas').setLayer(layer.name, { - handle: { - type: 'rectangle', - fillStyle: 'pink', - strokeStyle: 'yellow', - strokeWidth: 0, - width: 0, height: 0, - cornerRadius: 0 - } - - }).drawLayers(); - + if ($rootScope.isAnnotaionToolBarDrawingModeActive == false) { + layer.draggable = true; + $rootScope.canvasLayerNameCollection = []; + $('#canvas').setLayer(layer.name, { + handle: { + type: 'rectangle', + fillStyle: 'pink', + strokeStyle: 'yellow', + strokeWidth: 0, + width: 0, height: 0, + cornerRadius: 0 + } + + }).drawLayers(); + } + else { + layer.draggable = false; + } }, mouseover: function (layer) { + if ($rootScope.isAnnotaionToolBarDrawingModeActive == false) { + layer.draggable = true; + $('#canvas').setLayer(layer.name, { + handle: { + type: 'rectangle', + fillStyle: '#fff', + strokeStyle: '#c33', + strokeWidth: 2, + width: 5, height: 5, + cornerRadius: 3 + } + }).drawLayers(); - $('#canvas').setLayer(layer.name, { - handle: { - type: 'rectangle', - fillStyle: '#fff', - strokeStyle: '#c33', - strokeWidth: 2, - width: 5, height: 5, - cornerRadius: 3 - } - }).drawLayers(); - + } + else { + layer.draggable = false; + } } }); @@ -1190,27 +1287,32 @@ AIA.controller("HomeController", ["$rootScope", "Modules", "$log", "$location", PaintCanvasctx.beginPath(); break; case "Line": + $rootScope.isAnnotaionToolBarDrawingModeActive = false; $rootScope.LineNumber = $rootScope.ObjectIndex++; // $rootScope.isLinePreviewCompleted = true; $rootScope.DrawLineOnModuleItem('#canvas', $rootScope.LineNumber, $rootScope.shapestyleborderColor, $rootScope.shapestyleborderWidth, $rootScope.offsetX1, $rootScope.offsetY1, $rootScope.x, $rootScope.y) break; case "Rectangle": + $rootScope.isAnnotaionToolBarDrawingModeActive = false; $rootScope.rectNumber = $rootScope.ObjectIndex++; // $rootScope.isRectanglePreviewCompleted = true; $rootScope.DrawRectangleOnModuleItem('#canvas', $rootScope.rectNumber, $rootScope.shapestyleFillColor, $rootScope.shapestyleborderColor, $rootScope.shapestyleOpacity, $rootScope.shapestyleborderWidth, $rootScope.offsetX1, $rootScope.offsetY1, $rootScope.x, $rootScope.y); break; case "Circle": + $rootScope.isAnnotaionToolBarDrawingModeActive = false; $rootScope.CircleNumber = $rootScope.ObjectIndex++; // $rootScope.isCirclePreviewCompleted = true; $rootScope.DrawCircleOnModuleItem('#canvas', $rootScope.CircleNumber, $rootScope.shapestyleOpacity, $rootScope.shapestyleborderColor, $rootScope.shapestyleborderWidth, $rootScope.shapestyleFillColor, $rootScope.offsetX1, $rootScope.offsetY1, $rootScope.x, $rootScope.y); break; case "Arrow": + $rootScope.isAnnotaionToolBarDrawingModeActive = false; $rootScope.ArrowNumber = $rootScope.ObjectIndex++; //$rootScope.isArrowPreviewCompleted = true; $rootScope.DrawArrowOnModuleItem('#canvas', $rootScope.ArrowNumber, $rootScope.shapestyleborderColor, $rootScope.shapestyleborderWidth, $rootScope.offsetX1, $rootScope.offsetY1, $rootScope.x, $rootScope.y); break; case "Pin": + $rootScope.isAnnotaionToolBarDrawingModeActive = false; $rootScope.PinNumber = $rootScope.PinObjectIndex++; $rootScope.PinArcNumber = $rootScope.ArcObjectIndex++; @@ -1219,6 +1321,7 @@ AIA.controller("HomeController", ["$rootScope", "Modules", "$log", "$location", $rootScope.DrawPinOnModuleItem('#canvas', $rootScope.PinNumber, $rootScope.offsetX1, $rootScope.offsetY1, $rootScope.x, $rootScope.y, $rootScope.PinArcNumber); break; case "TextArea": + $rootScope.isAnnotaionToolBarDrawingModeActive = false; $rootScope.IsTextAlreadySave = false; $("#text_area").val(''); // Draw text @@ -1365,186 +1468,207 @@ AIA.controller("HomeController", ["$rootScope", "Modules", "$log", "$location", height: $rootScope.rectDimension[$rootScope.rectDimension.length - 1].height, resizeFromCenter: false, click: function (layer) { - $rootScope.shapeTypeText = "textAreaRect"; - - var layerNameSplit = layer.name; - var splitedName = layerNameSplit.split("_"); - var textValName = "TextAreaNew_"; - var concatinateResult = textValName.concat(splitedName[1]); - $rootScope.canvasLayerNameCollection = []; - $rootScope.canvasLayerNameCollection.push({ textareaRectangle: layer.name, textareaString: concatinateResult }); - $('#canvas').setLayer(layer.name, { - handle: { - type: 'rectangle', - fillStyle: '#fff', - strokeStyle: '#c33', - strokeWidth: 2, - width: 5, height: 5, - cornerRadius: 3 + if ($rootScope.isAnnotaionToolBarDrawingModeActive == false) { + layer.draggable = true; + $rootScope.shapeTypeText = "textAreaRect"; + + var layerNameSplit = layer.name; + var splitedName = layerNameSplit.split("_"); + var textValName = "TextAreaNew_"; + var concatinateResult = textValName.concat(splitedName[1]); + $rootScope.canvasLayerNameCollection = []; + $rootScope.canvasLayerNameCollection.push({ textareaRectangle: layer.name, textareaString: concatinateResult }); + $('#canvas').setLayer(layer.name, { + handle: { + type: 'rectangle', + fillStyle: '#fff', + strokeStyle: '#c33', + strokeWidth: 2, + width: 5, height: 5, + cornerRadius: 3 + } + }).drawLayers(); + } + else { + layer.draggable = false; } - }).drawLayers(); }, dblclick: function (layer) { + if ($rootScope.isAnnotaionToolBarDrawingModeActive == false) { + layer.draggable = true; + $rootScope.isTextAreaClosedButtonActive = false; + $rootScope.IsTextAlreadySave = true; - $rootScope.isTextAreaClosedButtonActive = false; - $rootScope.IsTextAlreadySave = true; + var _rectLayerOnSave = layer.name; + var _rectLayerOnSaveSplit = _rectLayerOnSave.split("_"); + var TextAreaRectName = "TextAreaNew_"; + var TextAreaRectNameConcatenated = TextAreaRectName.concat(_rectLayerOnSaveSplit[1]); - var _rectLayerOnSave = layer.name; - var _rectLayerOnSaveSplit = _rectLayerOnSave.split("_"); - var TextAreaRectName = "TextAreaNew_"; - var TextAreaRectNameConcatenated = TextAreaRectName.concat(_rectLayerOnSaveSplit[1]); + $rootScope.layerNameArr = layer.name; + $rootScope.rectTextArr = TextAreaRectNameConcatenated; - $rootScope.layerNameArr = layer.name; - $rootScope.rectTextArr = TextAreaRectNameConcatenated; + $rootScope.rectDimension.push({ width: layer.width, height: layer.height, x: layer.x, y: layer.y }); - $rootScope.rectDimension.push({ width: layer.width, height: layer.height, x: layer.x, y: layer.y }); + for (var i = 0; i <= $rootScope.TextPropertyArray.length - 1; i++) { + if ($rootScope.TextPropertyArray[i].layerName == TextAreaRectNameConcatenated) { - for (var i = 0; i <= $rootScope.TextPropertyArray.length - 1; i++) { - if ($rootScope.TextPropertyArray[i].layerName == TextAreaRectNameConcatenated) { + var textArrVal = $rootScope.TextPropertyArray[i].Rect_Text; + $("#text_area").val(textArrVal); + var fontStyleProp = $rootScope.TextPropertyArray[i].FontStyle; + var fontWeightProp = fontStyleProp.split(" "); - var textArrVal = $rootScope.TextPropertyArray[i].Rect_Text; - $("#text_area").val(textArrVal); - var fontStyleProp = $rootScope.TextPropertyArray[i].FontStyle; - var fontWeightProp = fontStyleProp.split(" "); + $("#text_area").css("font-size", $rootScope.TextPropertyArray[i].FontSize); + $("#text_area").css("font-weight", fontWeightProp[0]); + $("#text_area").css("font-style", fontWeightProp[1]); + $("#text_area").css("text-align", $rootScope.TextPropertyArray[i].Align); + $("#text_area").css("color", $rootScope.TextPropertyArray[i].FontColor); + $("#text_area").css("font-family", $rootScope.TextPropertyArray[i].FontFamily); + $("#text_area").css("text-decoration", $rootScope.TextPropertyArray[i].TextDecoration); + $("#font-color .minicolors .minicolors-swatch .minicolors-swatch-color").css({ "background-color": $rootScope.TextPropertyArray[i].FontColor }); - $("#text_area").css("font-size", $rootScope.TextPropertyArray[i].FontSize); - $("#text_area").css("font-weight", fontWeightProp[0]); - $("#text_area").css("font-style", fontWeightProp[1]); - $("#text_area").css("text-align", $rootScope.TextPropertyArray[i].Align); - $("#text_area").css("color", $rootScope.TextPropertyArray[i].FontColor); - $("#text_area").css("font-family", $rootScope.TextPropertyArray[i].FontFamily); - $("#text_area").css("text-decoration", $rootScope.TextPropertyArray[i].TextDecoration); - $("#font-color .minicolors .minicolors-swatch .minicolors-swatch-color").css({ "background-color": $rootScope.TextPropertyArray[i].FontColor }); + var CurrentFontFamily = $rootScope.TextPropertyArray[i].FontFamily; + // alert(CurrentFontFamily); + // CurrentFontFamily = CurrentFontFamily.replace(/'/g, ""); + var CurrentFontSize = parseInt($rootScope.TextPropertyArray[i].FontSize); + $("#selected-font-family option[value=" + CurrentFontFamily + "]").prop('selected', true); + $("#selected-font-size option[value=" + CurrentFontSize + "]").prop('selected', true); - var CurrentFontFamily = $rootScope.TextPropertyArray[i].FontFamily; - // alert(CurrentFontFamily); - // CurrentFontFamily = CurrentFontFamily.replace(/'/g, ""); - var CurrentFontSize = parseInt($rootScope.TextPropertyArray[i].FontSize); - $("#selected-font-family option[value=" + CurrentFontFamily + "]").prop('selected', true); - $("#selected-font-size option[value=" + CurrentFontSize + "]").prop('selected', true); + CurrentFontFamily = ''; + CurrentFontSize = ''; - CurrentFontFamily = ''; - CurrentFontSize = ''; + if ($rootScope.TextPropertyArray[i].TextDecoration == "underline") { - if ($rootScope.TextPropertyArray[i].TextDecoration == "underline") { + $("#text-underline").addClass("ActiveFormattingButtonClass"); - $("#text-underline").addClass("ActiveFormattingButtonClass"); + } - } + else { - else { + $("#text-underline").removeClass("ActiveFormattingButtonClass"); - $("#text-underline").removeClass("ActiveFormattingButtonClass"); + } - } + //adding text font weight active class in text edit pop-up - //adding text font weight active class in text edit pop-up + if (fontWeightProp[0] == 700) { - if (fontWeightProp[0] == 700) { + $("#text-bold").addClass("ActiveFormattingButtonClass"); - $("#text-bold").addClass("ActiveFormattingButtonClass"); + } - } + else { - else { + $("#text-bold").removeClass("ActiveFormattingButtonClass"); - $("#text-bold").removeClass("ActiveFormattingButtonClass"); + } - } + //adding text font style active class in text edit pop-up - //adding text font style active class in text edit pop-up + if (fontWeightProp[1] == "italic") { - if (fontWeightProp[1] == "italic") { + $("#text-italic").addClass("ActiveFormattingButtonClass"); + } + else { + $("#text-italic").removeClass("ActiveFormattingButtonClass"); - $("#text-italic").addClass("ActiveFormattingButtonClass"); - } - else { - $("#text-italic").removeClass("ActiveFormattingButtonClass"); + } - } + //adding text alignment active class in text edit pop-up - //adding text alignment active class in text edit pop-up + if ($rootScope.TextPropertyArray[i].Align == "left") { - if ($rootScope.TextPropertyArray[i].Align == "left") { + $("#text-right").removeClass("ActiveFormattingButtonClass"); - $("#text-right").removeClass("ActiveFormattingButtonClass"); + $("#text-center").removeClass("ActiveFormattingButtonClass") - $("#text-center").removeClass("ActiveFormattingButtonClass") + $("#text-left").addClass("ActiveFormattingButtonClass"); - $("#text-left").addClass("ActiveFormattingButtonClass"); + } - } + else if ($rootScope.TextPropertyArray[i].Align == "right") { - else if ($rootScope.TextPropertyArray[i].Align == "right") { + $("#text-center").removeClass("ActiveFormattingButtonClass") - $("#text-center").removeClass("ActiveFormattingButtonClass") + $("#text-left").removeClass("ActiveFormattingButtonClass"); - $("#text-left").removeClass("ActiveFormattingButtonClass"); + $("#text-right").addClass("ActiveFormattingButtonClass"); + } - $("#text-right").addClass("ActiveFormattingButtonClass"); - } + else if ($rootScope.TextPropertyArray[i].Align == "center") { - else if ($rootScope.TextPropertyArray[i].Align == "center") { + $("#text-left").removeClass("ActiveFormattingButtonClass"); - $("#text-left").removeClass("ActiveFormattingButtonClass"); + $("#text-right").removeClass("ActiveFormattingButtonClass"); - $("#text-right").removeClass("ActiveFormattingButtonClass"); + $("#text-center").addClass("ActiveFormattingButtonClass"); - $("#text-center").addClass("ActiveFormattingButtonClass"); + } } + else { + // alert("no"); - } - else { - // alert("no"); + } } - } - - - // _rectLayerOnSaveSplitInt = ''; - textArrVal = ''; - $("#annotationTextModal").css("padding-right", "0px"); - document.getElementById('modelbackground').style.display = "block"; - $("#annotationTextModal").modal("toggle"); - // $("#selected-font-family").val(CurrentFontFamily); - // $("#selected-font-size").val(CurrentFontSize); + // _rectLayerOnSaveSplitInt = ''; + textArrVal = ''; + $("#annotationTextModal").css("padding-right", "0px"); + document.getElementById('modelbackground').style.display = "block"; + $("#annotationTextModal").modal("toggle"); + // $("#selected-font-family").val(CurrentFontFamily); + // $("#selected-font-size").val(CurrentFontSize); + } + else { + layer.draggable = false; + } }, mouseout: function (layer) { - $rootScope.canvasLayerNameCollection = []; - $('#canvas').setLayer(layer.name, { - handle: { - type: 'rectangle', - fillStyle: 'pink', - strokeStyle: 'yellow', - strokeWidth: 0, - width: 0, height: 0, - cornerRadius: 0 - } - }).drawLayers(); + if ($rootScope.isAnnotaionToolBarDrawingModeActive == false) { + layer.draggable = true; + $rootScope.canvasLayerNameCollection = []; + $('#canvas').setLayer(layer.name, { + handle: { + type: 'rectangle', + fillStyle: 'pink', + strokeStyle: 'yellow', + strokeWidth: 0, + width: 0, height: 0, + cornerRadius: 0 + } + }).drawLayers(); + } + else { + layer.draggable = false; + } }, mouseover: function (layer) { - $('#canvas').setLayer(layer.name, { - handle: { - type: 'rectangle', - fillStyle: '#fff', - strokeStyle: '#c33', - strokeWidth: 2, - width: 5, height: 5, - cornerRadius: 3 - } - }).drawLayers(); - + if ($rootScope.isAnnotaionToolBarDrawingModeActive == false) { + layer.draggable = true; + $('#canvas').setLayer(layer.name, { + handle: { + type: 'rectangle', + fillStyle: '#fff', + strokeStyle: '#c33', + strokeWidth: 2, + width: 5, height: 5, + cornerRadius: 3 + } + }).drawLayers(); + } + else { + layer.draggable = false; + } } }); $("#text_area").val(''); @@ -1633,141 +1757,166 @@ AIA.controller("HomeController", ["$rootScope", "Modules", "$log", "$location", height: $rootScope.rectDimension[$rootScope.rectDimension.length - 1].height, resizeFromCenter: false, click: function (layer) { - $rootScope.shapeTypeText = "textAreaRect"; - var layerNameSplit = layer.name; - var splitedName = layerNameSplit.split("_"); - var textValName = "TextAreaAfterEdit_"; - var concatinateResult = textValName.concat(splitedName[1]); - $rootScope.canvasLayerNameCollection = []; - $rootScope.canvasLayerNameCollection.push({ textareaRectangle: layer.name, textareaString: concatinateResult }); - - $('#canvas').setLayer(layer.name, { - handle: { - type: 'rectangle', - fillStyle: '#fff', - strokeStyle: '#c33', - strokeWidth: 2, - width: 5, height: 5, - cornerRadius: 3 - } - }).drawLayers(); + if ($rootScope.isAnnotaionToolBarDrawingModeActive == false) { + layer.draggable = true; + $rootScope.shapeTypeText = "textAreaRect"; + var layerNameSplit = layer.name; + var splitedName = layerNameSplit.split("_"); + var textValName = "TextAreaAfterEdit_"; + var concatinateResult = textValName.concat(splitedName[1]); + $rootScope.canvasLayerNameCollection = []; + $rootScope.canvasLayerNameCollection.push({ textareaRectangle: layer.name, textareaString: concatinateResult }); + + $('#canvas').setLayer(layer.name, { + handle: { + type: 'rectangle', + fillStyle: '#fff', + strokeStyle: '#c33', + strokeWidth: 2, + width: 5, height: 5, + cornerRadius: 3 + } + }).drawLayers(); + } + else { + layer.draggable = false; + } }, dblclick: function (layer) { + if ($rootScope.isAnnotaionToolBarDrawingModeActive == false) { + layer.draggable = true; + $rootScope.isTextAreaClosedButtonActive = false; + $rootScope.IsTextAlreadySave = true; + var _rectLayerOnSave = layer.name; + var _rectLayerOnSaveSplit = _rectLayerOnSave.split("_"); + var RectNameAfterEdit = "TextAreaAfterEdit_"; + var RectNameAfterEditResult = RectNameAfterEdit.concat(_rectLayerOnSaveSplit[1]); + $rootScope.modifySavedTextIndexNumber = _rectLayerOnSaveSplit[1]; + + $rootScope.layerNameArr = layer.name; + $rootScope.rectTextArr = RectNameAfterEditResult; + + $rootScope.rectDimension.push({ width: layer.width, height: layer.height, x: layer.x, y: layer.y }); + $("#text_area").val(_modifiedText); + $("#text_area").css("font-size", _modifiedFontSize); + $("#text_area").css("font-weight", _modifiedFontWeight); + $("#text_area").css("font-style", _modifiedFontStyle); + $("#text_area").css("text-align", _modifiedTextAlign); + $("#text_area").css("color", _modifiedFontColor); + $("#text_area").css("font-family", _modifiedFontFamily); + $("#text_area").css("text-decoration", _modifiedFontDecoration); + $("#font-color .minicolors .minicolors-swatch .minicolors-swatch-color").css({ "background-color": _modifiedFontColor }); + + // $(".ActiveDefaultColorAnnotation").css({ "background-color": _modifiedFontColor + "!important" }); + // $("#font-color .minicolors .minicolors-swatch .minicolors-swatch-color").addClass("ActiveDefaultColorAnnotation"); + + //khushbu + var CurrentFontFamily = _modifiedFontFamily; + // alert(CurrentFontFamily); + // CurrentFontFamily = CurrentFontFamily.replace(/'/g, ""); + var CurrentFontSize = parseInt(_modifiedFontSize); + $("#selected-font-family option[value=" + CurrentFontFamily + "]").prop('selected', true); + $("#selected-font-size option[value=" + CurrentFontSize + "]").prop('selected', true); + CurrentFontFamily = ''; + CurrentFontSize = ''; + //adding text text decoration active class in text edit pop-up + if (_modifiedFontDecoration == "underline") { + $("#text-underline").addClass("ActiveFormattingButtonClass"); + } + else { + $("#text-underline").removeClass("ActiveFormattingButtonClass"); + } - $rootScope.isTextAreaClosedButtonActive = false; - $rootScope.IsTextAlreadySave = true; - var _rectLayerOnSave = layer.name; - var _rectLayerOnSaveSplit = _rectLayerOnSave.split("_"); - var RectNameAfterEdit = "TextAreaAfterEdit_"; - var RectNameAfterEditResult = RectNameAfterEdit.concat(_rectLayerOnSaveSplit[1]); - $rootScope.modifySavedTextIndexNumber = _rectLayerOnSaveSplit[1]; - - $rootScope.layerNameArr = layer.name; - $rootScope.rectTextArr = RectNameAfterEditResult; - - $rootScope.rectDimension.push({ width: layer.width, height: layer.height, x: layer.x, y: layer.y }); - $("#text_area").val(_modifiedText); - $("#text_area").css("font-size", _modifiedFontSize); - $("#text_area").css("font-weight", _modifiedFontWeight); - $("#text_area").css("font-style", _modifiedFontStyle); - $("#text_area").css("text-align", _modifiedTextAlign); - $("#text_area").css("color", _modifiedFontColor); - $("#text_area").css("font-family", _modifiedFontFamily); - $("#text_area").css("text-decoration", _modifiedFontDecoration); - $("#font-color .minicolors .minicolors-swatch .minicolors-swatch-color").css({ "background-color": _modifiedFontColor }); - - // $(".ActiveDefaultColorAnnotation").css({ "background-color": _modifiedFontColor + "!important" }); - // $("#font-color .minicolors .minicolors-swatch .minicolors-swatch-color").addClass("ActiveDefaultColorAnnotation"); - - //khushbu - var CurrentFontFamily = _modifiedFontFamily; - // alert(CurrentFontFamily); - // CurrentFontFamily = CurrentFontFamily.replace(/'/g, ""); - var CurrentFontSize = parseInt(_modifiedFontSize); - $("#selected-font-family option[value=" + CurrentFontFamily + "]").prop('selected', true); - $("#selected-font-size option[value=" + CurrentFontSize + "]").prop('selected', true); - CurrentFontFamily = ''; - CurrentFontSize = ''; - //adding text text decoration active class in text edit pop-up - if (_modifiedFontDecoration == "underline") { - $("#text-underline").addClass("ActiveFormattingButtonClass"); - } - else { - $("#text-underline").removeClass("ActiveFormattingButtonClass"); - } + //adding text font weight active class in text edit pop-up + if (_modifiedFontWeight == 700) { - //adding text font weight active class in text edit pop-up - if (_modifiedFontWeight == 700) { + $("#text-bold").addClass("ActiveFormattingButtonClass"); + } + else { - $("#text-bold").addClass("ActiveFormattingButtonClass"); - } - else { + $("#text-bold").removeClass("ActiveFormattingButtonClass"); - $("#text-bold").removeClass("ActiveFormattingButtonClass"); + } - } + //adding text font style active class in text edit pop-up + if (_modifiedFontStyle == "italic") { - //adding text font style active class in text edit pop-up - if (_modifiedFontStyle == "italic") { + $("#text-italic").addClass("ActiveFormattingButtonClass"); + } + else { + $("#text-italic").removeClass("ActiveFormattingButtonClass"); - $("#text-italic").addClass("ActiveFormattingButtonClass"); - } - else { - $("#text-italic").removeClass("ActiveFormattingButtonClass"); + } - } + //adding text alignment active class in text edit pop-up + if (_modifiedTextAlign == "left") { + $("#text-right").removeClass("ActiveFormattingButtonClass"); + $("#text-center").removeClass("ActiveFormattingButtonClass") + $("#text-left").addClass("ActiveFormattingButtonClass"); + } + else if (_modifiedTextAlign == "right") { - //adding text alignment active class in text edit pop-up - if (_modifiedTextAlign == "left") { - $("#text-right").removeClass("ActiveFormattingButtonClass"); - $("#text-center").removeClass("ActiveFormattingButtonClass") - $("#text-left").addClass("ActiveFormattingButtonClass"); - } - else if (_modifiedTextAlign == "right") { + $("#text-center").removeClass("ActiveFormattingButtonClass") + $("#text-left").removeClass("ActiveFormattingButtonClass"); + $("#text-right").addClass("ActiveFormattingButtonClass"); - $("#text-center").removeClass("ActiveFormattingButtonClass") - $("#text-left").removeClass("ActiveFormattingButtonClass"); - $("#text-right").addClass("ActiveFormattingButtonClass"); + } + else if (_modifiedTextAlign == "center") { + $("#text-left").removeClass("ActiveFormattingButtonClass"); + $("#text-right").removeClass("ActiveFormattingButtonClass"); + $("#text-center").addClass("ActiveFormattingButtonClass"); - } - else if (_modifiedTextAlign == "center") { - $("#text-left").removeClass("ActiveFormattingButtonClass"); - $("#text-right").removeClass("ActiveFormattingButtonClass"); - $("#text-center").addClass("ActiveFormattingButtonClass"); + } + document.getElementById('modelbackground').style.display = "block"; + $("#annotationTextModal").modal("toggle"); } - - document.getElementById('modelbackground').style.display = "block"; - $("#annotationTextModal").modal("toggle"); + else { + layer.draggable = false; + } }, mouseout: function (layer) { - $rootScope.canvasLayerNameCollection = []; - $('#canvas').setLayer(layer.name, { - handle: { - type: 'rectangle', - fillStyle: 'pink', - strokeStyle: 'yellow', - strokeWidth: 0, - width: 0, height: 0, - cornerRadius: 0 - } - }).drawLayers(); + if ($rootScope.isAnnotaionToolBarDrawingModeActive == false) { + layer.draggable = true; + $rootScope.canvasLayerNameCollection = []; + $('#canvas').setLayer(layer.name, { + handle: { + type: 'rectangle', + fillStyle: 'pink', + strokeStyle: 'yellow', + strokeWidth: 0, + width: 0, height: 0, + cornerRadius: 0 + } + }).drawLayers(); + } + else { + layer.draggable = false; + } }, mouseover: function (layer) { - $('#canvas').setLayer(layer.name, { - handle: { - type: 'rectangle', - fillStyle: '#fff', - strokeStyle: '#c33', - strokeWidth: 2, - width: 5, height: 5, - cornerRadius: 3 - } - }).drawLayers(); + if ($rootScope.isAnnotaionToolBarDrawingModeActive == false) { + layer.draggable = true; + $('#canvas').setLayer(layer.name, { + handle: { + type: 'rectangle', + fillStyle: '#fff', + strokeStyle: '#c33', + strokeWidth: 2, + width: 5, height: 5, + cornerRadius: 3 + } + }).drawLayers(); + + } + else { + layer.draggable = false; + } } + }); } @@ -1785,6 +1934,16 @@ AIA.controller("HomeController", ["$rootScope", "Modules", "$log", "$location", annotationCanvas.addEventListener('mouseup', $rootScope.OnPaintCanvasMouseUp, false); } // alert("doclick"); + // annotation history + if (event != undefined) { + if ($rootScope.isAnnotaionToolBarDrawingModeActive == true) { + + $rootScope.DrawingListners_Canvas(event); + + } + } + + }; @@ -2156,12 +2315,25 @@ AIA.controller("HomeController", ["$rootScope", "Modules", "$log", "$location", $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); + //alert($rootScope.isAnnotaionToolBarDrawingModeActive); + //if ($rootScope.isAnnotaionToolBarDrawingModeActive == true) { - annotationCanvas.addEventListener('mousedown', $rootScope.OnPaintBrushCanvasMouseDown, false); + // alert($rootScope.isAnnotaionToolBarDrawingModeActive); + // $rootScope.DrawingListners_Canvas(e); - annotationCanvas.addEventListener('mouseup', $rootScope.OnPaintBrushCanvasMouseUp, false); - } + //} + //else { + + + + //} + } + + + -- libgit2 0.21.4