diff --git a/400-SOURCECODE/AIAHTML5.Web/app/controllers/CIController.js b/400-SOURCECODE/AIAHTML5.Web/app/controllers/CIController.js index a1952cc..113e6ad 100644 --- a/400-SOURCECODE/AIAHTML5.Web/app/controllers/CIController.js +++ b/400-SOURCECODE/AIAHTML5.Web/app/controllers/CIController.js @@ -704,93 +704,93 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout break; case "TextArea": - $rootScope.IsTextAlreadySaveCI = false; - $("#text_area").val(''); - // Draw text - $rootScope.resetTextRectCI = $rootScope.ObjectIndexCI++; - $rootScope.resetTextCI = $rootScope.ObjectIndexCI++; - $('#canvas').drawText({ - layer: true, - draggable: true, - // opacity: $rootScope.shapestyleOpacity, - name: 'TextArea_' + $rootScope.resetTextCI, - groups: ['TextArea_' + $rootScope.resetTextCI], - dragGroups: ['TextArea_' + $rootScope.resetTextCI], - fillStyle: '#36c', - strokeWidth: 0, - x: $scope.offsetX1, y: $scope.offsetY1, - fontSize: '14pt', - align: "left", - fontFamily: 'Verdana, sans-serif', - text: '' - - }) - // Draw rect as wide as the text - .drawRect({ - layer: true, - name: "TextRect_" + $rootScope.resetTextRectCI, - dragGroups: ['shapes'], - opacity: $rootScope.shapestyleOpacity, - strokeStyle: $rootScope.shapestyleborderColor, - strokeWidth: $rootScope.shapestyleborderWidth, - fillStyle: $rootScope.shapestyleFillColor, - x: $scope.offsetX1, y: $scope.offsetY1, - width: $scope.x - $scope.offsetX1, - height: $scope.y - $scope.offsetY1, - click: function (layer) { - - $rootScope.canvasLayerNameCollectionCI = []; - $rootScope.canvasLayerNameCollectionCI.push(layer.name); - $('#canvas').setLayer(layer.name, { - handle: { - type: 'rectangle', - fillStyle: '#fff', - strokeStyle: '#c33', - strokeWidth: 2, - width: 5, height: 5, - cornerRadius: 3 - } - }).drawLayers(); - - }, - mouseout: function (layer) { - $rootScope.canvasLayerNameCollectionCI = []; - $('#canvas').setLayer(layer.name, { - handle: { - type: 'rectangle', - fillStyle: 'pink', - strokeStyle: 'yellow', - strokeWidth: 0, - width: 0, height: 0, - cornerRadius: 0 - } - - }).drawLayers(); - - }, - mouseover: function (layer) { - - $('#canvas').setLayer(layer.name, { - handle: { - type: 'rectangle', - fillStyle: '#fff', - strokeStyle: '#c33', - strokeWidth: 2, - width: 5, height: 5, - cornerRadius: 3 - } - }).drawLayers(); - - } - }); - - - $("#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" }); - $(".btn-annotation").removeClass("activebtncolor"); - $('.btnCursor').addClass('activebtncolor'); + //$rootScope.IsTextAlreadySaveCI = false; + //$("#text_area").val(''); + //// Draw text + //$rootScope.resetTextRectCI = $rootScope.ObjectIndexCI++; + //$rootScope.resetTextCI = $rootScope.ObjectIndexCI++; + //$('#canvas').drawText({ + // layer: true, + // draggable: true, + // // opacity: $rootScope.shapestyleOpacity, + // name: 'TextArea_' + $rootScope.resetTextCI, + // groups: ['TextArea_' + $rootScope.resetTextCI], + // dragGroups: ['TextArea_' + $rootScope.resetTextCI], + // fillStyle: '#36c', + // strokeWidth: 0, + // x: $scope.offsetX1, y: $scope.offsetY1, + // fontSize: '14pt', + // align: "left", + // fontFamily: 'Verdana, sans-serif', + // text: '' + + //}) + //// Draw rect as wide as the text + //.drawRect({ + // layer: true, + // name: "TextRect_" + $rootScope.resetTextRectCI, + // dragGroups: ['shapes'], + // opacity: $rootScope.shapestyleOpacity, + // strokeStyle: $rootScope.shapestyleborderColor, + // strokeWidth: $rootScope.shapestyleborderWidth, + // fillStyle: $rootScope.shapestyleFillColor, + // x: $scope.offsetX1, y: $scope.offsetY1, + // width: $scope.x - $scope.offsetX1, + // height: $scope.y - $scope.offsetY1, + // click: function (layer) { + + // $rootScope.canvasLayerNameCollectionCI = []; + // $rootScope.canvasLayerNameCollectionCI.push(layer.name); + // $('#canvas').setLayer(layer.name, { + // handle: { + // type: 'rectangle', + // fillStyle: '#fff', + // strokeStyle: '#c33', + // strokeWidth: 2, + // width: 5, height: 5, + // cornerRadius: 3 + // } + // }).drawLayers(); + + // }, + // mouseout: function (layer) { + // $rootScope.canvasLayerNameCollectionCI = []; + // $('#canvas').setLayer(layer.name, { + // handle: { + // type: 'rectangle', + // fillStyle: 'pink', + // strokeStyle: 'yellow', + // strokeWidth: 0, + // width: 0, height: 0, + // cornerRadius: 0 + // } + + // }).drawLayers(); + + // }, + // mouseover: function (layer) { + + // $('#canvas').setLayer(layer.name, { + // handle: { + // type: 'rectangle', + // fillStyle: '#fff', + // strokeStyle: '#c33', + // strokeWidth: 2, + // width: 5, height: 5, + // cornerRadius: 3 + // } + // }).drawLayers(); + + // } + //}); + + + //$("#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" }); + //$(".btn-annotation").removeClass("activebtncolor"); + //$('.btnCursor').addClass('activebtncolor'); break; case "DrawPolygon": @@ -821,369 +821,369 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout // will refactor this code later - $rootScope.saveText = function () { - // this part will work first time when save button will be clicked - if ($rootScope.IsTextAlreadySaveCI == false) { - // getting textarea style properties - $rootScope.fontSizesCI = $("#text_area").css("font-size"); - $rootScope.fontWeightCI = $("#text_area").css("font-weight"); - $rootScope.fontStyleCI = $("#text_area").css("font-style"); - $rootScope.textAlignmtCI = $("#text_area").css("text-align"); - $rootScope.fontColorCI = $("#text_area").css("color"); - $rootScope.fontFamilyCI = $("#text_area").css("font-family"); - $rootScope.underlineTextCI = $("#text_area").css("text-decoration"); - $rootScope.textAreaCI = $("#text_area").val(); - - // deleting previous text area - - $("#canvas").removeLayer('TextArea_' + $rootScope.resetTextCI).drawLayers(); - $("#canvas").removeLayer("TextRect_" + $rootScope.resetTextRectCI).drawLayers(); - - // Text After Saving in Rectangle - $('#canvas').drawText({ - layer: true, - draggable: true, - name: 'TextArea_' + $rootScope.resetTextCI, - groups: ['TextArea_' + $rootScope.resetTextCI], - dragGroups: ['TextArea_' + $rootScope.resetTextCI], - fillStyle: $rootScope.fontColorCI, - fontStyle: $rootScope.fontWeightCI + " " + $rootScope.fontStyleCI, - fontSize: $rootScope.fontSizesCI, - fontFamily: $rootScope.fontFamilyCI, - align: $rootScope.textAlignmtCI, - strokeWidth: 0, - text: $rootScope.textAreaCI, - x: $scope.offsetX1, y: $scope.offsetY1, - maxWidth: $scope.x - $scope.offsetX1, - maxHeight: $scope.y - $scope.offsetY1, - add: function (layer) { - $rootScope.TextPropertyArrayCI.push({ Text1: '', Align: '', FontColor: '', FontSize: '', FontStyle: '', FontFamily: '' }); - $rootScope.TextPropertyArrayCI.push({ Text1: layer.text, Align: layer.align, FontColor: layer.fillStyle, FontSize: layer.fontSize, FontStyle: layer.fontStyle, FontFamily: layer.fontFamily, TextDecoration: $rootScope.underlineTextCI }); - } - }) - // Draw rectangle - .drawRect({ - name: 'TextArea1_' + $rootScope.resetTextCI, - layer: true, - draggable: true, - groups: ['TextArea_' + $rootScope.resetTextCI], - dragGroups: ['TextArea_' + $rootScope.resetTextCI], - 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, - click: function (layer) { - $rootScope.shapeTypeTextCI = "textAreaRect"; - - var layerNameSplit = layer.name; - var splitedName = layerNameSplit.split("_"); - var textValName = "TextArea_"; - var concatinateResult = textValName.concat(splitedName[1]); - $rootScope.canvasLayerNameCollectionCI = []; - $rootScope.canvasLayerNameCollectionCI.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(); - }, - dblclick: function (layer) { - $rootScope.IsTextAlreadySaveCI = true; - $rootScope.isTextAreaClosedButtonActiveCI = false; - var _rectLayerOnSave = layer.name; - var _rectLayerOnSaveSplit = _rectLayerOnSave.split("_"); - var TextAreaRectName = "TextArea_"; - var TextAreaRectNameConcatenated = TextAreaRectName.concat(_rectLayerOnSaveSplit[1]); - $rootScope.modifySavedTextCI.push({ TextName: layer.name, RectText: TextAreaRectNameConcatenated }); - $rootScope.rectDimensionCI.push({ width: layer.width, height: layer.height, x: layer.x, y: layer.y }); - var _rectLayerOnSaveSplitInt; - //if (_rectLayerOnSaveSplit[1] >= 3) - // _rectLayerOnSaveSplitInt = parseInt(_rectLayerOnSaveSplit[1] - 2); - //else - _rectLayerOnSaveSplitInt = parseInt(_rectLayerOnSaveSplit[1]); - var b = $rootScope.TextPropertyArrayCI[_rectLayerOnSaveSplitInt].Text1; - $("#text_area").val(b); - var fontStyleProp = $rootScope.TextPropertyArrayCI[_rectLayerOnSaveSplitInt].FontStyle; - var fontWeightProp = fontStyleProp.split(" "); - - $("#text_area").css("font-size", $rootScope.TextPropertyArrayCI[_rectLayerOnSaveSplitInt].FontSize); - $("#text_area").css("font-weight", fontWeightProp[0]); - $("#text_area").css("font-style", fontWeightProp[1]); - $("#text_area").css("text-align", $rootScope.TextPropertyArrayCI[_rectLayerOnSaveSplitInt].Align); - $("#text_area").css("color", $rootScope.TextPropertyArrayCI[_rectLayerOnSaveSplitInt].FontColor); - $("#text_area").css("font-family", $rootScope.TextPropertyArrayCI[_rectLayerOnSaveSplitInt].FontFamily); - $("#text_area").css("text-decoration", $rootScope.TextPropertyArrayCI[_rectLayerOnSaveSplitInt].TextDecoration); - - - //adding text text decoration active class in text edit pop-up - - if ($rootScope.TextPropertyArrayCI[_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"); - } - - //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.TextPropertyArrayCI[_rectLayerOnSaveSplitInt].Align == "left") { - $("#text-right").removeClass("ActiveFormattingButtonClass"); - $("#text-center").removeClass("ActiveFormattingButtonClass") - $("#text-left").addClass("ActiveFormattingButtonClass"); - } - - else if ($rootScope.TextPropertyArrayCI[_rectLayerOnSaveSplitInt].Align == "right") { - $("#text-center").removeClass("ActiveFormattingButtonClass") - $("#text-left").removeClass("ActiveFormattingButtonClass"); - $("#text-right").addClass("ActiveFormattingButtonClass"); - } - - else if ($rootScope.TextPropertyArrayCI[_rectLayerOnSaveSplitInt].Align == "center") { - $("#text-left").removeClass("ActiveFormattingButtonClass"); - $("#text-right").removeClass("ActiveFormattingButtonClass"); - $("#text-center").addClass("ActiveFormattingButtonClass"); - } - - - _rectLayerOnSaveSplitInt = ''; b = ''; - $("#annotationTextModal").modal("toggle"); - }, - mouseout: function (layer) { - $rootScope.canvasLayerNameCollectionCI = []; - $('#canvas').setLayer(layer.name, { - handle: { - type: 'rectangle', - fillStyle: 'pink', - strokeStyle: 'yellow', - strokeWidth: 0, - width: 0, height: 0, - cornerRadius: 0 - } - }).drawLayers(); - }, - mouseover: function (layer) { - $('#canvas').setLayer(layer.name, { - handle: { - type: 'rectangle', - fillStyle: '#fff', - strokeStyle: '#c33', - strokeWidth: 2, - width: 5, height: 5, - cornerRadius: 3 - } - }).drawLayers(); - - } - }); - $("#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"); - } - - // 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"); - var _modifiedFontWeight = $("#text_area").css("font-weight"); - var _modifiedFontStyle = $("#text_area").css("font-style"); - var _modifiedTextAlign = $("#text_area").css("text-align"); - var _modifiedFontColor = $("#text_area").css("color"); - var _modifiedFontFamily = $("#text_area").css("font-family"); - var _modifiedFontDecoration = $("#text_area").css("text-decoration"); - - // deleting previous textarea - $("#canvas").removeLayer($rootScope.modifySavedTextCI[0].RectText).drawLayers(); - $("#canvas").removeLayer($rootScope.modifySavedTextCI[0].TextName).drawLayers(); - $rootScope.resetTextRectSaveCI = $rootScope.ObjectIndexSaveCI++; - $rootScope.resetTextSaveCI = $rootScope.ObjectIndexSaveCI++; - - // generating new text area - $('#canvas').drawText({ - layer: true, - draggable: true, - name: 'TextAreaAfterEdit_' + $rootScope.resetTextSaveCI, - groups: ['TextAreaAfterEdit_' + $rootScope.resetTextSaveCI], - dragGroups: ['TextAreaAfterEdit_' + $rootScope.resetTextSaveCI], - fillStyle: _modifiedFontColor, - fontStyle: _modifiedFontWeight + " " + _modifiedFontStyle, - fontSize: _modifiedFontSize, - fontFamily: _modifiedFontFamily, - align: _modifiedTextAlign, - strokeWidth: 0, - text: _modifiedText, - x: $rootScope.rectDimensionCI[$rootScope.rectDimensionCI.length - 1].x, y: $rootScope.rectDimensionCI[$rootScope.rectDimensionCI.length - 1].y, - maxWidth: $rootScope.rectDimensionCI[$rootScope.rectDimensionCI.length - 1].width, - maxHeight: $rootScope.rectDimensionCI[$rootScope.rectDimensionCI.length - 1].height - - }) - // Draw rect as wide as the text - .drawRect({ - name: 'TextAreaAfterEditRect_' + $rootScope.resetTextSaveCI, - layer: true, - draggable: true, - groups: ['TextAreaAfterEdit_' + $rootScope.resetTextSaveCI], - dragGroups: ['TextAreaAfterEdit_' + $rootScope.resetTextSaveCI], - opacity: $rootScope.shapestyleOpacity, - strokeStyle: $rootScope.shapestyleborderColor, - strokeWidth: $rootScope.shapestyleborderWidth, - x: $rootScope.rectDimensionCI[$rootScope.rectDimensionCI.length - 1].x, y: $rootScope.rectDimensionCI[$rootScope.rectDimensionCI.length - 1].y, - width: $rootScope.rectDimensionCI[$rootScope.rectDimensionCI.length - 1].width, - height: $rootScope.rectDimensionCI[$rootScope.rectDimensionCI.length - 1].height, - click: function (layer) { - $rootScope.shapeTypeTextCI = "textAreaRect"; - var layerNameSplit = layer.name; - var splitedName = layerNameSplit.split("_"); - var textValName = "TextAreaAfterEdit_"; - var concatinateResult = textValName.concat(splitedName[1]); - $rootScope.canvasLayerNameCollectionCI = []; - $rootScope.canvasLayerNameCollectionCI.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(); - - }, - dblclick: function (layer) { - //debugger; - $rootScope.isTextAreaClosedButtonActiveCI = false; - $rootScope.IsTextAlreadySaveCI = true; - var _rectLayerOnSave = layer.name; - var _rectLayerOnSaveSplit = _rectLayerOnSave.split("_"); - var RectNameAfterEdit = "TextAreaAfterEdit_"; - var RectNameAfterEditResult = RectNameAfterEdit.concat(_rectLayerOnSaveSplit[1]); - $rootScope.modifySavedTextCI.push({ TextName: layer.name, RectText: RectNameAfterEditResult }); - $rootScope.rectDimensionCI.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); - - //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) { - - $("#text-bold").addClass("ActiveFormattingButtonClass"); - } - else { - - $("#text-bold").removeClass("ActiveFormattingButtonClass"); - - } - - //adding text font style active class in text edit pop-up - if (_modifiedFontStyle == "italic") { - - $("#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") { - - $("#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"); - - } - - $("#annotationTextModal").modal("toggle"); - }, - mouseout: function (layer) { - $rootScope.canvasLayerNameCollectionCI = []; - $('#canvas').setLayer(layer.name, { - handle: { - type: 'rectangle', - fillStyle: 'pink', - strokeStyle: 'yellow', - strokeWidth: 0, - width: 0, height: 0, - cornerRadius: 0 - } - }).drawLayers(); - }, - mouseover: function (layer) { - $('#canvas').setLayer(layer.name, { - handle: { - type: 'rectangle', - fillStyle: '#fff', - strokeStyle: '#c33', - strokeWidth: 2, - width: 5, height: 5, - cornerRadius: 3 - } - }).drawLayers(); - - } - }); - $rootScope.modifySavedTextCI = []; - - } - } + //$rootScope.saveText = function () { + // // this part will work first time when save button will be clicked + // if ($rootScope.IsTextAlreadySaveCI == false) { + // // getting textarea style properties + // $rootScope.fontSizesCI = $("#text_area").css("font-size"); + // $rootScope.fontWeightCI = $("#text_area").css("font-weight"); + // $rootScope.fontStyleCI = $("#text_area").css("font-style"); + // $rootScope.textAlignmtCI = $("#text_area").css("text-align"); + // $rootScope.fontColorCI = $("#text_area").css("color"); + // $rootScope.fontFamilyCI = $("#text_area").css("font-family"); + // $rootScope.underlineTextCI = $("#text_area").css("text-decoration"); + // $rootScope.textAreaCI = $("#text_area").val(); + + // // deleting previous text area + + // $("#canvas").removeLayer('TextArea_' + $rootScope.resetTextCI).drawLayers(); + // $("#canvas").removeLayer("TextRect_" + $rootScope.resetTextRectCI).drawLayers(); + + // // Text After Saving in Rectangle + // $('#canvas').drawText({ + // layer: true, + // draggable: true, + // name: 'TextArea_' + $rootScope.resetTextCI, + // groups: ['TextArea_' + $rootScope.resetTextCI], + // dragGroups: ['TextArea_' + $rootScope.resetTextCI], + // fillStyle: $rootScope.fontColorCI, + // fontStyle: $rootScope.fontWeightCI + " " + $rootScope.fontStyleCI, + // fontSize: $rootScope.fontSizesCI, + // fontFamily: $rootScope.fontFamilyCI, + // align: $rootScope.textAlignmtCI, + // strokeWidth: 0, + // text: $rootScope.textAreaCI, + // x: $scope.offsetX1, y: $scope.offsetY1, + // maxWidth: $scope.x - $scope.offsetX1, + // maxHeight: $scope.y - $scope.offsetY1, + // add: function (layer) { + // $rootScope.TextPropertyArrayCI.push({ Text1: '', Align: '', FontColor: '', FontSize: '', FontStyle: '', FontFamily: '' }); + // $rootScope.TextPropertyArrayCI.push({ Text1: layer.text, Align: layer.align, FontColor: layer.fillStyle, FontSize: layer.fontSize, FontStyle: layer.fontStyle, FontFamily: layer.fontFamily, TextDecoration: $rootScope.underlineTextCI }); + // } + // }) + // // Draw rectangle + // .drawRect({ + // name: 'TextArea1_' + $rootScope.resetTextCI, + // layer: true, + // draggable: true, + // groups: ['TextArea_' + $rootScope.resetTextCI], + // dragGroups: ['TextArea_' + $rootScope.resetTextCI], + // 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, + // click: function (layer) { + // $rootScope.shapeTypeTextCI = "textAreaRect"; + + // var layerNameSplit = layer.name; + // var splitedName = layerNameSplit.split("_"); + // var textValName = "TextArea_"; + // var concatinateResult = textValName.concat(splitedName[1]); + // $rootScope.canvasLayerNameCollectionCI = []; + // $rootScope.canvasLayerNameCollectionCI.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(); + // }, + // dblclick: function (layer) { + // $rootScope.IsTextAlreadySaveCI = true; + // $rootScope.isTextAreaClosedButtonActiveCI = false; + // var _rectLayerOnSave = layer.name; + // var _rectLayerOnSaveSplit = _rectLayerOnSave.split("_"); + // var TextAreaRectName = "TextArea_"; + // var TextAreaRectNameConcatenated = TextAreaRectName.concat(_rectLayerOnSaveSplit[1]); + // $rootScope.modifySavedTextCI.push({ TextName: layer.name, RectText: TextAreaRectNameConcatenated }); + // $rootScope.rectDimensionCI.push({ width: layer.width, height: layer.height, x: layer.x, y: layer.y }); + // var _rectLayerOnSaveSplitInt; + // //if (_rectLayerOnSaveSplit[1] >= 3) + // // _rectLayerOnSaveSplitInt = parseInt(_rectLayerOnSaveSplit[1] - 2); + // //else + // _rectLayerOnSaveSplitInt = parseInt(_rectLayerOnSaveSplit[1]); + // var b = $rootScope.TextPropertyArrayCI[_rectLayerOnSaveSplitInt].Text1; + // $("#text_area").val(b); + // var fontStyleProp = $rootScope.TextPropertyArrayCI[_rectLayerOnSaveSplitInt].FontStyle; + // var fontWeightProp = fontStyleProp.split(" "); + + // $("#text_area").css("font-size", $rootScope.TextPropertyArrayCI[_rectLayerOnSaveSplitInt].FontSize); + // $("#text_area").css("font-weight", fontWeightProp[0]); + // $("#text_area").css("font-style", fontWeightProp[1]); + // $("#text_area").css("text-align", $rootScope.TextPropertyArrayCI[_rectLayerOnSaveSplitInt].Align); + // $("#text_area").css("color", $rootScope.TextPropertyArrayCI[_rectLayerOnSaveSplitInt].FontColor); + // $("#text_area").css("font-family", $rootScope.TextPropertyArrayCI[_rectLayerOnSaveSplitInt].FontFamily); + // $("#text_area").css("text-decoration", $rootScope.TextPropertyArrayCI[_rectLayerOnSaveSplitInt].TextDecoration); + + + // //adding text text decoration active class in text edit pop-up + + // if ($rootScope.TextPropertyArrayCI[_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"); + // } + + // //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.TextPropertyArrayCI[_rectLayerOnSaveSplitInt].Align == "left") { + // $("#text-right").removeClass("ActiveFormattingButtonClass"); + // $("#text-center").removeClass("ActiveFormattingButtonClass") + // $("#text-left").addClass("ActiveFormattingButtonClass"); + // } + + // else if ($rootScope.TextPropertyArrayCI[_rectLayerOnSaveSplitInt].Align == "right") { + // $("#text-center").removeClass("ActiveFormattingButtonClass") + // $("#text-left").removeClass("ActiveFormattingButtonClass"); + // $("#text-right").addClass("ActiveFormattingButtonClass"); + // } + + // else if ($rootScope.TextPropertyArrayCI[_rectLayerOnSaveSplitInt].Align == "center") { + // $("#text-left").removeClass("ActiveFormattingButtonClass"); + // $("#text-right").removeClass("ActiveFormattingButtonClass"); + // $("#text-center").addClass("ActiveFormattingButtonClass"); + // } + + + // _rectLayerOnSaveSplitInt = ''; b = ''; + // $("#annotationTextModal").modal("toggle"); + // }, + // mouseout: function (layer) { + // $rootScope.canvasLayerNameCollectionCI = []; + // $('#canvas').setLayer(layer.name, { + // handle: { + // type: 'rectangle', + // fillStyle: 'pink', + // strokeStyle: 'yellow', + // strokeWidth: 0, + // width: 0, height: 0, + // cornerRadius: 0 + // } + // }).drawLayers(); + // }, + // mouseover: function (layer) { + // $('#canvas').setLayer(layer.name, { + // handle: { + // type: 'rectangle', + // fillStyle: '#fff', + // strokeStyle: '#c33', + // strokeWidth: 2, + // width: 5, height: 5, + // cornerRadius: 3 + // } + // }).drawLayers(); + + // } + // }); + // $("#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"); + // } + + // // 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"); + // var _modifiedFontWeight = $("#text_area").css("font-weight"); + // var _modifiedFontStyle = $("#text_area").css("font-style"); + // var _modifiedTextAlign = $("#text_area").css("text-align"); + // var _modifiedFontColor = $("#text_area").css("color"); + // var _modifiedFontFamily = $("#text_area").css("font-family"); + // var _modifiedFontDecoration = $("#text_area").css("text-decoration"); + + // // deleting previous textarea + // $("#canvas").removeLayer($rootScope.modifySavedTextCI[0].RectText).drawLayers(); + // $("#canvas").removeLayer($rootScope.modifySavedTextCI[0].TextName).drawLayers(); + // $rootScope.resetTextRectSaveCI = $rootScope.ObjectIndexSaveCI++; + // $rootScope.resetTextSaveCI = $rootScope.ObjectIndexSaveCI++; + + // // generating new text area + // $('#canvas').drawText({ + // layer: true, + // draggable: true, + // name: 'TextAreaAfterEdit_' + $rootScope.resetTextSaveCI, + // groups: ['TextAreaAfterEdit_' + $rootScope.resetTextSaveCI], + // dragGroups: ['TextAreaAfterEdit_' + $rootScope.resetTextSaveCI], + // fillStyle: _modifiedFontColor, + // fontStyle: _modifiedFontWeight + " " + _modifiedFontStyle, + // fontSize: _modifiedFontSize, + // fontFamily: _modifiedFontFamily, + // align: _modifiedTextAlign, + // strokeWidth: 0, + // text: _modifiedText, + // x: $rootScope.rectDimensionCI[$rootScope.rectDimensionCI.length - 1].x, y: $rootScope.rectDimensionCI[$rootScope.rectDimensionCI.length - 1].y, + // maxWidth: $rootScope.rectDimensionCI[$rootScope.rectDimensionCI.length - 1].width, + // maxHeight: $rootScope.rectDimensionCI[$rootScope.rectDimensionCI.length - 1].height + + // }) + // // Draw rect as wide as the text + // .drawRect({ + // name: 'TextAreaAfterEditRect_' + $rootScope.resetTextSaveCI, + // layer: true, + // draggable: true, + // groups: ['TextAreaAfterEdit_' + $rootScope.resetTextSaveCI], + // dragGroups: ['TextAreaAfterEdit_' + $rootScope.resetTextSaveCI], + // opacity: $rootScope.shapestyleOpacity, + // strokeStyle: $rootScope.shapestyleborderColor, + // strokeWidth: $rootScope.shapestyleborderWidth, + // x: $rootScope.rectDimensionCI[$rootScope.rectDimensionCI.length - 1].x, y: $rootScope.rectDimensionCI[$rootScope.rectDimensionCI.length - 1].y, + // width: $rootScope.rectDimensionCI[$rootScope.rectDimensionCI.length - 1].width, + // height: $rootScope.rectDimensionCI[$rootScope.rectDimensionCI.length - 1].height, + // click: function (layer) { + // $rootScope.shapeTypeTextCI = "textAreaRect"; + // var layerNameSplit = layer.name; + // var splitedName = layerNameSplit.split("_"); + // var textValName = "TextAreaAfterEdit_"; + // var concatinateResult = textValName.concat(splitedName[1]); + // $rootScope.canvasLayerNameCollectionCI = []; + // $rootScope.canvasLayerNameCollectionCI.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(); + + // }, + // dblclick: function (layer) { + // //debugger; + // $rootScope.isTextAreaClosedButtonActiveCI = false; + // $rootScope.IsTextAlreadySaveCI = true; + // var _rectLayerOnSave = layer.name; + // var _rectLayerOnSaveSplit = _rectLayerOnSave.split("_"); + // var RectNameAfterEdit = "TextAreaAfterEdit_"; + // var RectNameAfterEditResult = RectNameAfterEdit.concat(_rectLayerOnSaveSplit[1]); + // $rootScope.modifySavedTextCI.push({ TextName: layer.name, RectText: RectNameAfterEditResult }); + // $rootScope.rectDimensionCI.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); + + // //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) { + + // $("#text-bold").addClass("ActiveFormattingButtonClass"); + // } + // else { + + // $("#text-bold").removeClass("ActiveFormattingButtonClass"); + + // } + + // //adding text font style active class in text edit pop-up + // if (_modifiedFontStyle == "italic") { + + // $("#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") { + + // $("#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"); + + // } + + // $("#annotationTextModal").modal("toggle"); + // }, + // mouseout: function (layer) { + // $rootScope.canvasLayerNameCollectionCI = []; + // $('#canvas').setLayer(layer.name, { + // handle: { + // type: 'rectangle', + // fillStyle: 'pink', + // strokeStyle: 'yellow', + // strokeWidth: 0, + // width: 0, height: 0, + // cornerRadius: 0 + // } + // }).drawLayers(); + // }, + // mouseover: function (layer) { + // $('#canvas').setLayer(layer.name, { + // handle: { + // type: 'rectangle', + // fillStyle: '#fff', + // strokeStyle: '#c33', + // strokeWidth: 2, + // width: 5, height: 5, + // cornerRadius: 3 + // } + // }).drawLayers(); + + // } + // }); + // $rootScope.modifySavedTextCI = []; + + // } + //} // deleting text area on close button $rootScope.closeModal = function () {