From eddec163281aeab95001be94ec5d44ea89b52496 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 17 Nov 2016 17:58:26 +0530 Subject: [PATCH] Commit changes for #9842:Annotation > Font- size problem. --- 400-SOURCECODE/AIAHTML5.Web/app/controllers/HomeController.js | 176 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++------------------------------------------------------------------------ 1 file changed, 104 insertions(+), 72 deletions(-) diff --git a/400-SOURCECODE/AIAHTML5.Web/app/controllers/HomeController.js b/400-SOURCECODE/AIAHTML5.Web/app/controllers/HomeController.js index 6b6858a..6e51ddf 100644 --- a/400-SOURCECODE/AIAHTML5.Web/app/controllers/HomeController.js +++ b/400-SOURCECODE/AIAHTML5.Web/app/controllers/HomeController.js @@ -80,14 +80,13 @@ AIA.controller("HomeController", ["$rootScope", "Modules", "$log", "$location", $rootScope.CloseListManager(); angular.element('#modal-settings').modal('hide'); if ($location.url() == "/lab-exercises") { - + $rootScope.menuLabExer = 0; } - if($rootScope.menuLabExer==1) - { + if ($rootScope.menuLabExer == 1) { $rootScope.disableMenuoption = " "; } - + } }); @@ -140,15 +139,15 @@ AIA.controller("HomeController", ["$rootScope", "Modules", "$log", "$location", } } - // $rootScope.DrawLine = function () { - //$rootScope.isIdetifyClicked = false; - //$rootScope.isDrawingToolSelected = true; - //$rootScope.isLineDrawSelecyed = true; - // $rootScope.shapeType = "Line"; - // alert($rootScope.shapeType); + // $rootScope.DrawLine = function () { + //$rootScope.isIdetifyClicked = false; + //$rootScope.isDrawingToolSelected = true; + //$rootScope.isLineDrawSelecyed = true; + // $rootScope.shapeType = "Line"; + // alert($rootScope.shapeType); - // } + // } $rootScope.ClearIframe = function () { if ($('#daImagePanel') != null) @@ -173,16 +172,15 @@ AIA.controller("HomeController", ["$rootScope", "Modules", "$log", "$location", if ($rootScope.disableAnnotationtoolOnListManager == true) { $('#AnnotaionPopupDiv').find('input, textarea, button, select,img,div').attr('disabled', 'disabled'); $('#slider-range-min-2').slider('disable'); - - // $rootScope.disableAnnotationTB = false; - }else - { + + // $rootScope.disableAnnotationTB = false; + } else { $('#AnnotaionPopupDiv').find('input, textarea, button, select,img,div').removeAttr('disabled', 'disabled'); $('#slider-range-min-2').slider('enable'); } - // document.getElementById('modelbackground').style.display = "block"; - // document.getElementById('modeleditstyle').style.display = "block"; - + // document.getElementById('modelbackground').style.display = "block"; + // document.getElementById('modeleditstyle').style.display = "block"; + } $("#OnIdentify").addClass("annotationtoolbartab"); $("#annotationToolBarOptions").addClass("active"); @@ -193,7 +191,7 @@ AIA.controller("HomeController", ["$rootScope", "Modules", "$log", "$location", $rootScope.$broadcast('annotationToolEvent', true); $("#canvasPaint").css("display", "none"); $("#canvas").css("display", "none"); - + var FontFamilyJson = '~/../content/data/json/settings/fontstyle.json'; if ($rootScope.isFontFamilyLoaded == false) { @@ -207,8 +205,8 @@ AIA.controller("HomeController", ["$rootScope", "Modules", "$log", "$location", for (var i = 0; i <= $rootScope.AnnotationFontFamily.FontFamily.length - 1; i++) { - $("#selected-font-family").append(""); - + $("#selected-font-family").append(""); + } $rootScope.isFontFamilyLoaded = true; @@ -245,7 +243,7 @@ AIA.controller("HomeController", ["$rootScope", "Modules", "$log", "$location", $("#DrawMode").removeClass("annotationtoolbartab"); // $rootScope.isIdetifyClicked = true; // $rootScope.isDrawingToolSelected = false; - // debugger; + // debugger; if ($rootScope.CIAnotationIdentifyModeOff == true) { $('.btnCursor').removeClass('activebtncolor'); @@ -287,19 +285,19 @@ AIA.controller("HomeController", ["$rootScope", "Modules", "$log", "$location", //----Annotation Toolbar: Jcanvas----- - + $rootScope.DrLine = function (e) { $rootScope.setListManagerZindex = true; $("#canvasPaint").css("display", "block"); $("#canvas").css("display", "block"); - + $rootScope.switchCanvas(); $rootScope.shapeType = "Line"; - + $('.btnCursor').removeClass('activebtncolor'); - $(".btn-annotation").removeClass("activebtncolor"); - $(".btn-annotation-line").addClass("activebtncolor"); + $(".btn-annotation").removeClass("activebtncolor"); + $(".btn-annotation-line").addClass("activebtncolor"); } @@ -328,7 +326,7 @@ AIA.controller("HomeController", ["$rootScope", "Modules", "$log", "$location", $('.btnCursor').addClass('activebtncolor'); } - + $rootScope.DrawRectangle = function (e) { $rootScope.setListManagerZindex = true; $("#canvasPaint").css("display", "block"); @@ -399,7 +397,7 @@ AIA.controller("HomeController", ["$rootScope", "Modules", "$log", "$location", $(".btn-annotation-arrow").addClass("activebtncolor"); } $rootScope.DrawText = function () { - + $rootScope.setListManagerZindex = true; $("#canvasPaint").css("display", "block"); $("#canvas").css("display", "block"); @@ -456,7 +454,7 @@ AIA.controller("HomeController", ["$rootScope", "Modules", "$log", "$location", $rootScope.shapestyleborderWidth = 2; $rootScope.shapestyleborderStyles = "solid"; $rootScope.shapestyle = function (id) { - // debugger; + // debugger; document.getElementById('modelbackground').style.display = "none"; document.getElementById('modeleditstyle').style.display = "none"; @@ -482,7 +480,7 @@ AIA.controller("HomeController", ["$rootScope", "Modules", "$log", "$location", // $("#canvas").removeLayer("TextRect_" + $rootScope.resetTextRect).drawLayers(); //Edit Shape Style popup should open at it's default position - $("#modeleditstyle").css({ "left": "40%", "right": "0", "top":"70px"}); + $("#modeleditstyle").css({ "left": "40%", "right": "0", "top": "70px" }); } @@ -527,7 +525,7 @@ AIA.controller("HomeController", ["$rootScope", "Modules", "$log", "$location", document.getElementById('modelbackground').style.display = "none"; document.getElementById('modeleditstyle').style.display = "none"; //Edit Shape Style popup should open at it's default position - $("#modeleditstyle").css({"left":"40%", "right":"0", "top":"70px"}); + $("#modeleditstyle").css({ "left": "40%", "right": "0", "top": "70px" }); } @@ -536,8 +534,7 @@ AIA.controller("HomeController", ["$rootScope", "Modules", "$log", "$location", //----End------------- //--Common code of Annotation Toolbar for CI and DA------- - $rootScope.LineFn = function (canvasId, LineNumber, shapestyleborderColor, shapestyleborderWidth, offsetX1, offsetY1, x, y) - { + $rootScope.LineFn = function (canvasId, LineNumber, shapestyleborderColor, shapestyleborderWidth, offsetX1, offsetY1, x, y) { $(canvasId).addLayer({ name: 'Line_' + LineNumber, layer: true, @@ -546,8 +543,8 @@ AIA.controller("HomeController", ["$rootScope", "Modules", "$log", "$location", strokeStyle: shapestyleborderColor, strokeWidth: shapestyleborderWidth, rounded: true, - x1: offsetX1, y1:offsetY1, - x2: x, y2:y, + x1: offsetX1, y1: offsetY1, + x2: x, y2: y, click: function (layer) { $rootScope.canvasLayerNameCollection = []; @@ -600,7 +597,7 @@ AIA.controller("HomeController", ["$rootScope", "Modules", "$log", "$location", $('.btnCursor').addClass('activebtncolor'); } - $rootScope.RectangleFn = function (canvasId, RectNumber, shapestyleFillColor, shapestyleborderColor, shapestyleOpacity, shapestyleborderWidth, offsetX1, offsetY1, x,y) { + $rootScope.RectangleFn = function (canvasId, RectNumber, shapestyleFillColor, shapestyleborderColor, shapestyleOpacity, shapestyleborderWidth, offsetX1, offsetY1, x, y) { $(canvasId).addLayer({ layer: true, name: 'Rect_' + RectNumber, @@ -687,7 +684,7 @@ AIA.controller("HomeController", ["$rootScope", "Modules", "$log", "$location", strokeStyle: shapestyleborderColor, strokeWidth: shapestyleborderWidth, fillStyle: shapestyleFillColor, - x: offsetX1, y:offsetY1, + x: offsetX1, y: offsetY1, width: (x - offsetX1) * 2, height: (y - offsetY1) * 2, // Place a handle at each side and each corner handlePlacement: 'both', @@ -922,11 +919,11 @@ AIA.controller("HomeController", ["$rootScope", "Modules", "$log", "$location", $('.btnCursor').addClass('activebtncolor'); } - $rootScope.TextAreaFn = function (canvasId, TextNumber, offsetX1, offsetY1, resetTextRect, shapestyleOpacity, shapestyleborderColor, shapestyleborderWidth, shapestyleFillColor,x,y) { + $rootScope.TextAreaFn = function (canvasId, TextNumber, offsetX1, offsetY1, resetTextRect, shapestyleOpacity, shapestyleborderColor, shapestyleborderWidth, shapestyleFillColor, x, y) { - - + debugger; + $('#canvas').drawText({ layer: true, draggable: true, @@ -985,7 +982,7 @@ AIA.controller("HomeController", ["$rootScope", "Modules", "$log", "$location", }, dblclick: function (layer) { - + $rootScope.IsTextAlreadySave = false; var RectNameArray = (layer.name).split("_"); @@ -1000,10 +997,13 @@ AIA.controller("HomeController", ["$rootScope", "Modules", "$log", "$location", $("#annotationTextModal").modal("toggle"); $("#text_area").val(''); - $("#text_area").css({ " font-family": "'Verdana, sans-serif'", "font-size": "14px", "font-weight": "normal", "font-style": "normal", "color": "#000", "text-align": "left", "text-decoration": "none" }); + $("#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"); + $("#selected-font-family option:eq(0)").prop('selected', true); + $("#selected-font-size option:eq(0)").prop('selected', true); + $("#text-italic").removeClass("ActiveFormattingButtonClass"); $("#text-bold").removeClass("ActiveFormattingButtonClass"); @@ -1047,9 +1047,9 @@ AIA.controller("HomeController", ["$rootScope", "Modules", "$log", "$location", } }); - // Annotation: Edit Text option is missing. - // alert($rootScope.CurrentWidth); - // alert($rootScope.CurrentHeight); + // Annotation: Edit Text option is missing. + // alert($rootScope.CurrentWidth); + // alert($rootScope.CurrentHeight); $("#annotationTextModal").css("padding-right", "0px"); if (($rootScope.CurrentWidth > 0 && $rootScope.CurrentHeight > 0) || ($rootScope.CurrentWidth > 0 && $rootScope.CurrentHeight <= 0) || ($rootScope.CurrentWidth <= 0 && $rootScope.CurrentHeight > 0)) { $("#annotationTextModal").modal("toggle"); @@ -1060,7 +1060,12 @@ AIA.controller("HomeController", ["$rootScope", "Modules", "$log", "$location", $("#text_area").val(''); - $("#text_area").css({ " font-family": 'Verdana, sans-serif', "font-size": "14px", "font-weight": "normal", "font-style": "normal", "color": "#000", "text-align": "left", "text-decoration": "none" }); + $("#text_area").css({ "font-family": "Arial", "font-size": "14px", "font-weight": "normal", "font-style": "normal", "color": "#000", "text-align": "left", "text-decoration": "none" }); + + $("#selected-font-family option:eq(0)").prop('selected', true); + $("#selected-font-size option:eq(0)").prop('selected', true); + + // $("#text_area").css({ " font-family": 'Verdana, sans-serif', "font-size": "14px", "font-weight": "normal", "font-style": "normal", "color": "#000", "text-align": "left", "text-decoration": "none" }); $("#text-italic").removeClass("ActiveFormattingButtonClass"); @@ -1079,7 +1084,7 @@ AIA.controller("HomeController", ["$rootScope", "Modules", "$log", "$location", $('.btnCursor').addClass('activebtncolor'); - + } @@ -1107,7 +1112,7 @@ AIA.controller("HomeController", ["$rootScope", "Modules", "$log", "$location", ctx.clearRect(0, 0, 2277, 3248); $rootScope.clicked = true; - // alert("x:"+$rootScope.offsetX1 + " y:" + $rootScope.offsetY1); + // alert("x:"+$rootScope.offsetX1 + " y:" + $rootScope.offsetY1); } $rootScope.rectNumber = 0; @@ -1189,7 +1194,7 @@ AIA.controller("HomeController", ["$rootScope", "Modules", "$log", "$location", break; case "TextArea": - + $rootScope.IsTextAlreadySave = false; $("#text_area").val(''); // Draw text @@ -1208,13 +1213,14 @@ AIA.controller("HomeController", ["$rootScope", "Modules", "$log", "$location", } - + ///----- $rootScope.saveText = function () { + debugger; document.getElementById('modelbackground').style.display = "none"; // this part will work first time when save button will be clicked if ($rootScope.IsTextAlreadySave == false) { @@ -1296,7 +1302,7 @@ AIA.controller("HomeController", ["$rootScope", "Modules", "$log", "$location", }).drawLayers(); }, dblclick: function (layer) { - + $rootScope.isTextAreaClosedButtonActive = false; $rootScope.IsTextAlreadySave = true; @@ -1347,7 +1353,15 @@ AIA.controller("HomeController", ["$rootScope", "Modules", "$log", "$location", $("#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); + CurrentFontFamily = ''; + CurrentFontSize = ''; // $(".ActiveDefaultColorAnnotation").css({ "background-color": $rootScope.TextPropertyArray[_rectLayerOnSaveSplitInt].FontColor + "!important" }); // $("#font-color .minicolors .minicolors-swatch .minicolors-swatch-color").addClass("ActiveDefaultColorAnnotation"); @@ -1456,7 +1470,8 @@ AIA.controller("HomeController", ["$rootScope", "Modules", "$log", "$location", document.getElementById('modelbackground').style.display = "block"; $("#annotationTextModal").modal("toggle"); - + // $("#selected-font-family").val(CurrentFontFamily); + // $("#selected-font-size").val(CurrentFontSize); }, @@ -1488,7 +1503,16 @@ AIA.controller("HomeController", ["$rootScope", "Modules", "$log", "$location", } }); $("#text_area").val(''); - $("#text_area").css({ " font-family": "'Verdana, sans-serif'", "font-size": "14px", "font-weight": "normal", "font-style": "normal", "color": "#000", "text-align": "left", "text-decoration": "none" }); + $("#text_area").css({ " font-family": "Arial", "font-size": "14px", "font-weight": "normal", "font-style": "normal", "color": "#000", "text-align": "left", "text-decoration": "none" }); + + $("#selected-font-family option:eq(0)").prop('selected', true); + $("#selected-font-size option:eq(0)").prop('selected', true); + + // $("#selected-font-family option:eq(0)").prop('selected', true); + // $("#selected-font-size option:eq(0)").prop('selected', true); + + // $("#selected-font-family option[value='Arial']").prop('selected', true); + // $("#selected-font-size option[value=14]").prop('selected', true); $("#font-color .minicolors .minicolors-swatch .minicolors-swatch-color").css({ "background-color": "#000000" }); $("#text-italic").removeClass("ActiveFormattingButtonClass"); @@ -1582,8 +1606,8 @@ AIA.controller("HomeController", ["$rootScope", "Modules", "$log", "$location", }, dblclick: function (layer) { - - + + $rootScope.isTextAreaClosedButtonActive = false; $rootScope.IsTextAlreadySave = true; var _rectLayerOnSave = layer.name; @@ -1605,9 +1629,19 @@ AIA.controller("HomeController", ["$rootScope", "Modules", "$log", "$location", $("#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"); @@ -1694,16 +1728,16 @@ AIA.controller("HomeController", ["$rootScope", "Modules", "$log", "$location", $rootScope.BindCanvasDrawingListners = function (event) { - $rootScope.clicked = true; - // OnPaintCanvasMouseDown(event); + $rootScope.clicked = true; + // OnPaintCanvasMouseDown(event); - var annotationCanvas = document.getElementById('canvas'); - if (annotationCanvas != null || annotationCanvas != undefined) { - annotationCanvas.addEventListener('mousedown', $rootScope.OnPaintCanvasMouseDown, false); - annotationCanvas.addEventListener('mouseup', $rootScope.OnPaintCanvasMouseUp, false); - } - // alert("doclick"); - }; + var annotationCanvas = document.getElementById('canvas'); + if (annotationCanvas != null || annotationCanvas != undefined) { + annotationCanvas.addEventListener('mousedown', $rootScope.OnPaintCanvasMouseDown, false); + annotationCanvas.addEventListener('mouseup', $rootScope.OnPaintCanvasMouseUp, false); + } + // alert("doclick"); + }; $(document).keydown(function (event) { @@ -1743,7 +1777,7 @@ AIA.controller("HomeController", ["$rootScope", "Modules", "$log", "$location", $rootScope.closeModal = function () { document.getElementById('modelbackground').style.display = "none"; - + //if ($rootScope.isTextAreaClosedButtonActive == true) { // $("#canvas").removeLayer('TextArea_' + $rootScope.TextNumber).drawLayers(); // $("#canvas").removeLayer("TextRect_" + $rootScope.resetTextRect).drawLayers(); @@ -1831,15 +1865,14 @@ AIA.controller("HomeController", ["$rootScope", "Modules", "$log", "$location", } $rootScope.disableAnnotationTB = false; - $rootScope.disableAnnotationTBFn = function() - { + $rootScope.disableAnnotationTBFn = function () { $rootScope.disableAnnotationTB = true; } //list manager function //list manager function - + $rootScope.disableAnnotationtoolOnListManager = false; $rootScope.ShowListManager = function () { console.log('ShowListManager') @@ -1864,7 +1897,7 @@ AIA.controller("HomeController", ["$rootScope", "Modules", "$log", "$location", console.log('close') $rootScope.disableAnnotationtoolOnListManager = false; if ($rootScope.MenuModuleName == "DA") { - + if ($rootScope.disableAnnotationtoolOnListManager == false) { $('#AnnotaionPopupDiv').find('input, textarea, button, select,img,div').removeAttr('disabled', 'disabled'); $('#slider-range-min-2').slider('enable'); @@ -2038,8 +2071,7 @@ AIA.controller("HomeController", ["$rootScope", "Modules", "$log", "$location", if (len > 0) { $rootScope.reloadChildController(); } - else - { + else { $('#modal-settings').modal('hide'); } -- libgit2 0.21.4