diff --git a/400-SOURCECODE/AIAHTML5.Web/app/controllers/DAController.js b/400-SOURCECODE/AIAHTML5.Web/app/controllers/DAController.js index fd937a0..90f0eb2 100644 --- a/400-SOURCECODE/AIAHTML5.Web/app/controllers/DAController.js +++ b/400-SOURCECODE/AIAHTML5.Web/app/controllers/DAController.js @@ -6705,6 +6705,11 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo x: $scope.offsetX1, y: $scope.offsetY1, width: $scope.x - $scope.offsetX1, height: $scope.y - $scope.offsetY1, + add: function (layer) { + + $rootScope.rectDimension.push({ width: layer.width, height: layer.height, x: layer.x, y: layer.y }); + + }, click: function (layer) { $rootScope.canvasLayerNameCollection = []; @@ -6721,6 +6726,29 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo }).drawLayers(); }, + dblclick: function (layer) { + + + $rootScope.rectDimension.push({ width: layer.width, height: layer.height, x: layer.x, y: layer.y }); + $("#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-italic").removeClass("ActiveFormattingButtonClass"); + + $("#text-bold").removeClass("ActiveFormattingButtonClass"); + + $("#text-underline").removeClass("ActiveFormattingButtonClass"); + + $("#text-left").removeClass("ActiveFormattingButtonClass"); + + $("#text-right").removeClass("ActiveFormattingButtonClass"); + + $("#text-center").removeClass("ActiveFormattingButtonClass"); + + }, mouseout: function (layer) { $rootScope.canvasLayerNameCollection = []; $('#canvas').setLayer(layer.name, { @@ -6755,25 +6783,25 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo $("#annotationTextModal").modal("toggle"); $('.btnCursor').trigger('click'); - + $("#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-italic").removeClass("ActiveFormattingButtonClass"); - - $("#text-bold").removeClass("ActiveFormattingButtonClass"); - - $("#text-underline").removeClass("ActiveFormattingButtonClass"); - - $("#text-left").removeClass("ActiveFormattingButtonClass"); - - $("#text-right").removeClass("ActiveFormattingButtonClass"); - - $("#text-center").removeClass("ActiveFormattingButtonClass"); - + + $("#text-italic").removeClass("ActiveFormattingButtonClass"); + + $("#text-bold").removeClass("ActiveFormattingButtonClass"); + + $("#text-underline").removeClass("ActiveFormattingButtonClass"); + + $("#text-left").removeClass("ActiveFormattingButtonClass"); + + $("#text-right").removeClass("ActiveFormattingButtonClass"); + + $("#text-center").removeClass("ActiveFormattingButtonClass"); + $(".btn-annotation").removeClass("activebtncolor"); - + $('.btnCursor').addClass('activebtncolor'); break; @@ -6807,6 +6835,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo $rootScope.saveText = function () { + // this part will work first time when save button will be clicked if ($rootScope.IsTextAlreadySave == false) { // getting textarea style properties @@ -6828,9 +6857,9 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo $('#canvas').drawText({ layer: true, draggable: true, - name: 'TextArea_' + $rootScope.resetText, - groups: ['TextArea_' + $rootScope.resetText], - dragGroups: ['TextArea_' + $rootScope.resetText], + name: 'TextAreaNew_' + $rootScope.resetText, + groups: ['TextAreaNew_' + $rootScope.resetText], + dragGroups: ['TextAreaNew_' + $rootScope.resetText], fillStyle: $rootScope.fontColor, fontStyle: $rootScope.fontWeight + " " + $rootScope.fontStyle, fontSize: $rootScope.fontSizes, @@ -6838,10 +6867,11 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo align: $rootScope.textAlignmt, strokeWidth: 0, text: $rootScope.textArea, - x: $scope.offsetX1, y: $scope.offsetY1, - maxWidth: $scope.x - $scope.offsetX1, - maxHeight: $scope.y - $scope.offsetY1, + x: $rootScope.rectDimension[$rootScope.rectDimension.length - 1].x, y: $rootScope.rectDimension[$rootScope.rectDimension.length - 1].y, + maxWidth: $rootScope.rectDimension[$rootScope.rectDimension.length - 1].width, + maxHeight: $rootScope.rectDimension[$rootScope.rectDimension.length - 1].height, add: function (layer) { + // alert(layer.maxWidth); $rootScope.TextPropertyArray.push({ Text1: '', Align: '', FontColor: '', FontSize: '', FontStyle: '', FontFamily: '' }); $rootScope.TextPropertyArray.push({ Text1: layer.text, Align: layer.align, FontColor: layer.fillStyle, FontSize: layer.fontSize, FontStyle: layer.fontStyle, FontFamily: layer.fontFamily, TextDecoration: $rootScope.underlineText }); } @@ -6851,20 +6881,20 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo name: 'TextArea1_' + $rootScope.resetText, layer: true, draggable: true, - groups: ['TextArea_' + $rootScope.resetText], - dragGroups: ['TextArea_' + $rootScope.resetText], + groups: ['TextAreaNew_' + $rootScope.resetText], + dragGroups: ['TextAreaNew_' + $rootScope.resetText], opacity: $rootScope.shapestyleOpacity, strokeStyle: $rootScope.shapestyleborderColor, strokeWidth: $rootScope.shapestyleborderWidth, - x: $scope.offsetX1, y: $scope.offsetY1, - width: $scope.x - $scope.offsetX1, - height: $scope.y - $scope.offsetY1, + x: $rootScope.rectDimension[$rootScope.rectDimension.length - 1].x, y: $rootScope.rectDimension[$rootScope.rectDimension.length - 1].y, + width: $rootScope.rectDimension[$rootScope.rectDimension.length - 1].width, + height: $rootScope.rectDimension[$rootScope.rectDimension.length - 1].height, click: function (layer) { $rootScope.shapeTypeText = "textAreaRect"; var layerNameSplit = layer.name; var splitedName = layerNameSplit.split("_"); - var textValName = "TextArea_"; + var textValName = "TextAreaNew_"; var concatinateResult = textValName.concat(splitedName[1]); $rootScope.canvasLayerNameCollection = []; $rootScope.canvasLayerNameCollection.push({ textareaRectangle: layer.name, textareaString: concatinateResult }); @@ -6880,13 +6910,20 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo }).drawLayers(); }, dblclick: function (layer) { + + $rootScope.isTextAreaClosedButtonActive = false; $rootScope.IsTextAlreadySave = true; var _rectLayerOnSave = layer.name; var _rectLayerOnSaveSplit = _rectLayerOnSave.split("_"); - var TextAreaRectName = "TextArea_"; + var TextAreaRectName = "TextAreaNew_"; var TextAreaRectNameConcatenated = TextAreaRectName.concat(_rectLayerOnSaveSplit[1]); - $rootScope.modifySavedText.push({ TextName: layer.name, RectText: TextAreaRectNameConcatenated }); + + $rootScope.layerNameArr = layer.name; + $rootScope.rectTextArr = TextAreaRectNameConcatenated; + // $rootScope.modifySavedText.push({ TextName: '', RectText: ''}); + // $rootScope.modifySavedText.push({ TextName: layer.name, RectText: TextAreaRectNameConcatenated }); + $rootScope.rectDimension.push({ width: layer.width, height: layer.height, x: layer.x, y: layer.y }); var _rectLayerOnSaveSplitInt; //if (_rectLayerOnSaveSplit[1] >= 3) @@ -6895,11 +6932,12 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo // _rectLayerOnSaveSplitInt = parseInt(_rectLayerOnSaveSplit[1]); _rectLayerOnSaveSplitInt = parseInt(_rectLayerOnSaveSplit[1]); + var b = $rootScope.TextPropertyArray[_rectLayerOnSaveSplitInt].Text1; $("#text_area").val(b); var fontStyleProp = $rootScope.TextPropertyArray[_rectLayerOnSaveSplitInt].FontStyle; - var fontWeightProp = fontStyleProp.split(" "); - + var fontWeightProp = fontStyleProp.split(" "); + $("#text_area").css("font-size", $rootScope.TextPropertyArray[_rectLayerOnSaveSplitInt].FontSize); $("#text_area").css("font-weight", fontWeightProp[0]); $("#text_area").css("font-style", fontWeightProp[1]); @@ -6912,96 +6950,89 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo //adding text text decoration active class in text edit pop-up - - if ($rootScope.TextPropertyArray[_rectLayerOnSaveSplitInt].TextDecoration == "underline") { - - $("#text-underline").addClass("ActiveFormattingButtonClass"); - - } - - else { - - $("#text-underline").removeClass("ActiveFormattingButtonClass"); - - } - - - //adding text font weight active class in text edit pop-up - - if (fontWeightProp[0] == 700) { - - - - $("#text-bold").addClass("ActiveFormattingButtonClass"); - - } - - else - - { - - $("#text-bold").removeClass("ActiveFormattingButtonClass"); - + if ($rootScope.TextPropertyArray[_rectLayerOnSaveSplitInt].TextDecoration == "underline") { + + $("#text-underline").addClass("ActiveFormattingButtonClass"); + } - - //adding text font style active class in text edit pop-up - - if (fontWeightProp[1] == "italic") { - - - $("#text-italic").addClass("ActiveFormattingButtonClass"); - } - else - - { - $("#text-italic").removeClass("ActiveFormattingButtonClass"); - - - } - + else { - - //adding text alignment active class in text edit pop-up - - if ($rootScope.TextPropertyArray[_rectLayerOnSaveSplitInt].Align == "left") { - - $("#text-right").removeClass("ActiveFormattingButtonClass"); - - $("#text-center").removeClass("ActiveFormattingButtonClass") - - $("#text-left").addClass("ActiveFormattingButtonClass"); - - } - - else if ($rootScope.TextPropertyArray[_rectLayerOnSaveSplitInt].Align == "right") { + $("#text-underline").removeClass("ActiveFormattingButtonClass"); + + } - $("#text-center").removeClass("ActiveFormattingButtonClass") + //adding text font weight active class in text edit pop-up - $("#text-left").removeClass("ActiveFormattingButtonClass"); + if (fontWeightProp[0] == 700) { - $("#text-right").addClass("ActiveFormattingButtonClass"); + $("#text-bold").addClass("ActiveFormattingButtonClass"); - } + } - else if ($rootScope.TextPropertyArray[_rectLayerOnSaveSplitInt].Align == "center") { + else { - $("#text-left").removeClass("ActiveFormattingButtonClass"); + $("#text-bold").removeClass("ActiveFormattingButtonClass"); - $("#text-right").removeClass("ActiveFormattingButtonClass"); + } - $("#text-center").addClass("ActiveFormattingButtonClass"); + //adding text font style active class in text edit pop-up + if (fontWeightProp[1] == "italic") { - } + $("#text-italic").addClass("ActiveFormattingButtonClass"); + } + else { + $("#text-italic").removeClass("ActiveFormattingButtonClass"); + + + } + + //adding text alignment active class in text edit pop-up + + if ($rootScope.TextPropertyArray[_rectLayerOnSaveSplitInt].Align == "left") { + + $("#text-right").removeClass("ActiveFormattingButtonClass"); + + $("#text-center").removeClass("ActiveFormattingButtonClass") + + $("#text-left").addClass("ActiveFormattingButtonClass"); + + } + + else if ($rootScope.TextPropertyArray[_rectLayerOnSaveSplitInt].Align == "right") { + + + + $("#text-center").removeClass("ActiveFormattingButtonClass") + + $("#text-left").removeClass("ActiveFormattingButtonClass"); + + $("#text-right").addClass("ActiveFormattingButtonClass"); + + + + } + + else if ($rootScope.TextPropertyArray[_rectLayerOnSaveSplitInt].Align == "center") { + + $("#text-left").removeClass("ActiveFormattingButtonClass"); + + $("#text-right").removeClass("ActiveFormattingButtonClass"); + + $("#text-center").addClass("ActiveFormattingButtonClass"); + + + + } + - _rectLayerOnSaveSplitInt = ''; b = ''; $("#annotationTextModal").modal("toggle"); }, @@ -7037,22 +7068,23 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo $("#text-italic").removeClass("ActiveFormattingButtonClass"); - - $("#text-bold").removeClass("ActiveFormattingButtonClass"); - - $("#text-underline").removeClass("ActiveFormattingButtonClass"); - - $("#text-left").removeClass("ActiveFormattingButtonClass"); - - $("#text-right").removeClass("ActiveFormattingButtonClass"); - - $("#text-center").removeClass("ActiveFormattingButtonClass"); + + $("#text-bold").removeClass("ActiveFormattingButtonClass"); + + $("#text-underline").removeClass("ActiveFormattingButtonClass"); + + $("#text-left").removeClass("ActiveFormattingButtonClass"); + + $("#text-right").removeClass("ActiveFormattingButtonClass"); + + $("#text-center").removeClass("ActiveFormattingButtonClass"); } // this part will work second time when save button will be clicked else { + // getting textarea style properties var _modifiedText = $("#text_area").val(); var _modifiedFontSize = $("#text_area").css("font-size"); @@ -7064,8 +7096,15 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo var _modifiedFontDecoration = $("#text_area").css("text-decoration"); // deleting previous textarea - $("#canvas").removeLayer($rootScope.modifySavedText[0].RectText).drawLayers(); - $("#canvas").removeLayer($rootScope.modifySavedText[0].TextName).drawLayers(); + + // var a = $rootScope.modifySavedTextIndexNumber; + // alert(a); + // alert($rootScope.modifySavedText.length); + // alert($rootScope.modifySavedText[a].RectText); + + $("#canvas").removeLayer($rootScope.layerNameArr).drawLayers(); + $("#canvas").removeLayer($rootScope.rectTextArr).drawLayers(); + $rootScope.resetTextRectSave = $rootScope.ObjectIndexSave++; $rootScope.resetTextSave = $rootScope.ObjectIndexSave++; @@ -7124,12 +7163,23 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo }, dblclick: function (layer) { + $rootScope.isTextAreaClosedButtonActive = false; $rootScope.IsTextAlreadySave = true; var _rectLayerOnSave = layer.name; var _rectLayerOnSaveSplit = _rectLayerOnSave.split("_"); var RectNameAfterEdit = "TextAreaAfterEdit_"; var RectNameAfterEditResult = RectNameAfterEdit.concat(_rectLayerOnSaveSplit[1]); - $rootScope.modifySavedText.push({ TextName: layer.name, RectText: RectNameAfterEditResult }); + $rootScope.modifySavedTextIndexNumber = _rectLayerOnSaveSplit[1]; + + + + // $rootScope.modifySavedText.push({ TextName: '', RectText: '' }); + // $rootScope.modifySavedText.push({ TextName: layer.name, RectText: RectNameAfterEditResult }); + + $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); @@ -7192,9 +7242,6 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo } - - - $("#annotationTextModal").modal("toggle"); }, mouseout: function (layer) { @@ -7224,7 +7271,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo } }); - $rootScope.modifySavedText = []; + // $rootScope.modifySavedText = []; } } @@ -7232,8 +7279,12 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo // deleting text area on close button $rootScope.closeModal = function () { - $("#canvas").removeLayer('TextArea_' + $rootScope.resetText).drawLayers(); - $("#canvas").removeLayer("TextRect_" + $rootScope.resetTextRect).drawLayers(); + + if ($rootScope.isTextAreaClosedButtonActive == true) { + $("#canvas").removeLayer('TextArea_' + $rootScope.resetText).drawLayers(); + $("#canvas").removeLayer("TextRect_" + $rootScope.resetTextRect).drawLayers(); + + } } diff --git a/400-SOURCECODE/AIAHTML5.Web/index.html b/400-SOURCECODE/AIAHTML5.Web/index.html index 5902108..d0ebf19 100644 --- a/400-SOURCECODE/AIAHTML5.Web/index.html +++ b/400-SOURCECODE/AIAHTML5.Web/index.html @@ -605,8 +605,9 @@