diff --git a/400-SOURCECODE/AIAHTML5.Web/app/controllers/DAController.js b/400-SOURCECODE/AIAHTML5.Web/app/controllers/DAController.js index fe309e9..22ef3c8 100644 --- a/400-SOURCECODE/AIAHTML5.Web/app/controllers/DAController.js +++ b/400-SOURCECODE/AIAHTML5.Web/app/controllers/DAController.js @@ -165,7 +165,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo //get the DA body view list based on selected gender $scope.getDAViewList = function ($event) { - // debugger; + if ($('#MainImage') != null) { $('#MainImage').remove(); } @@ -244,7 +244,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo } $scope.imagePath = "~/../content/images/DA/" + $scope.zoomInOut + "/body-views/" + value._id + '/skintone/' + userEthnicity + '/' + thumbnailImage; - // debugger; + var $el = $('
' + '' @@ -265,7 +265,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo $scope.openView = function ($event) { - // debugger; + $rootScope.isLoading = true; $('#spinner').css('visibility', 'visible'); @@ -623,8 +623,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo $scope.LoadDefaultLayerImage = function () { - // debugger; - + $rootScope.isNormalMode = true; $scope.layerNumber = 0; @@ -6171,7 +6170,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo x2: $scope.x, y2: $scope.y, click: function (layer) { - // debugger; + $rootScope.shapeTypePin = "Pin"; $rootScope.canvasLayerNameCollection = []; var pinLine_layer = layer.name; @@ -6195,9 +6194,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo }, mouseout: function (layer) { - // $rootScope.resetPinArc = ""; - // ax = ""; - + $rootScope.canvasLayerNameCollection = []; $('#canvas').setLayer(layer.name, { handle: { @@ -6260,7 +6257,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo $('.btnCursor').addClass('activebtncolor'); break; case "TextArea": - $rootScope.isTrue = false; + $rootScope.IsTextAlreadySave = false; $("#text_area").val(''); // Draw text $rootScope.resetTextRect = $rootScope.ObjectIndex++; @@ -6368,14 +6365,19 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo $rootScope.underlineText; $rootScope.textArea; $rootScope.fontFamily; - $rootScope.TextAreaStyleProp = []; + $rootScope.TextPropertyArray = []; $rootScope.modifySavedText = []; $rootScope.TextRectangleArr = []; $rootScope.rectDimension = []; + + // will refactor this code later + + $rootScope.saveText = function () { - debugger; - if ($rootScope.isTrue == false) { + // this part will work first time when save button will be clicked + if ($rootScope.IsTextAlreadySave == false) { + // getting textarea style properties $rootScope.fontSizes = $("#text_area").css("font-size"); $rootScope.fontWeight = $("#text_area").css("font-weight"); $rootScope.fontStyle = $("#text_area").css("font-style"); @@ -6384,10 +6386,13 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo $rootScope.fontFamily = $("#text_area").css("font-family"); $rootScope.underlineText = $("#text_area").css("text-decoration"); $rootScope.textArea = $("#text_area").val(); - + + // deleting previous text area + $("#canvas").removeLayer('TextArea_' + $rootScope.resetText).drawLayers(); $("#canvas").removeLayer("TextRect_" + $rootScope.resetTextRect).drawLayers(); - + + // Text After Saving in Rectangle $('#canvas').drawText({ layer: true, draggable: true, @@ -6404,24 +6409,12 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo x: $scope.offsetX1, y: $scope.offsetY1, maxWidth: $scope.x - $scope.offsetX1, maxHeight: $scope.y - $scope.offsetY1, - add: function (layer) { - - $rootScope.TextAreaStyleProp.push({ Text1: '', Align: '', FontColor: '', FontSize: '', FontStyle: '', FontFamily: '' }); - $rootScope.TextAreaStyleProp.push({ Text1: layer.text, Align: layer.align, FontColor: layer.fillStyle, FontSize: layer.fontSize, FontStyle: layer.fontStyle, FontFamily: layer.fontFamily }); - - // $rootScope.TextAreaStyleProp.push({ Text: '', Align: '', FontColor: '', FontSize: '', FontStyle: '', FontFamily: '' }); - // $rootScope.TextAreaStyleProp.push({ Text: layer.text, Align: layer.align, FontColor: layer.fillStyle, FontSize: layer.fontSize, FontStyle: layer.fontStyle, FontFamily: layer.fontFamily }); - - - }, - - change: function (layer, props) { - - } - - }) - // Draw rect as wide as the text + $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 }); + } + }) + // Draw rectangle .drawRect({ name: 'TextArea1_' + $rootScope.resetText, layer: true, @@ -6431,30 +6424,19 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo 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, - add: function (layer) { - - }, click: function (layer) { $rootScope.shapeTypeText = "textAreaRect"; - + var layerNameSplit = layer.name; - var splitedName = layerNameSplit.split("_"); - var textValName = "TextArea_"; - var concatinateResult = textValName.concat(splitedName[1]); - $rootScope.canvasLayerNameCollection = []; $rootScope.canvasLayerNameCollection.push({ textareaRectangle: layer.name, textareaString: concatinateResult }); - - - - $('#canvas').setLayer(layer.name, { + $('#canvas').setLayer(layer.name, { handle: { type: 'rectangle', fillStyle: '#fff', @@ -6464,45 +6446,34 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo cornerRadius: 3 } }).drawLayers(); - }, dblclick: function (layer) { - // debugger; - $rootScope.isTrue = true; - + $rootScope.IsTextAlreadySave = true; + var _rectLayerOnSave = layer.name; var _rectLayerOnSaveSplit = _rectLayerOnSave.split("_"); - var str1 = "TextArea_"; - var res = str1.concat(_rectLayerOnSaveSplit[1]); - - $rootScope.modifySavedText.push({ TextName: layer.name, RectText: res}); + var TextAreaRectName = "TextArea_"; + var TextAreaRectNameConcatenated = TextAreaRectName.concat(_rectLayerOnSaveSplit[1]); + $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) _rectLayerOnSaveSplitInt = parseInt(_rectLayerOnSaveSplit[1] - 2); else _rectLayerOnSaveSplitInt = parseInt(_rectLayerOnSaveSplit[1]); - - var b = $rootScope.TextAreaStyleProp[_rectLayerOnSaveSplitInt].Text1; + var b = $rootScope.TextPropertyArray[_rectLayerOnSaveSplitInt].Text1; $("#text_area").val(b); - // alert($rootScope.TextAreaStyleProp[_rectLayerOnSaveSplitInt].FontSize); - - $("#text_area").css("font-size", $rootScope.TextAreaStyleProp[_rectLayerOnSaveSplitInt].FontSize); - $("#text_area").css("font-weight", $rootScope.TextAreaStyleProp[_rectLayerOnSaveSplitInt].FontStyle); - $("#text_area").css("font-style", $rootScope.TextAreaStyleProp[_rectLayerOnSaveSplitInt].FontStyle); - $("#text_area").css("text-align", $rootScope.TextAreaStyleProp[_rectLayerOnSaveSplitInt].Align); - $("#text_area").css("color", $rootScope.TextAreaStyleProp[_rectLayerOnSaveSplitInt].FontColor); - $("#text_area").css("font-family", $rootScope.TextAreaStyleProp[_rectLayerOnSaveSplitInt].FontFamily); + $("#text_area").css("font-size", $rootScope.TextPropertyArray[_rectLayerOnSaveSplitInt].FontSize); + $("#text_area").css("font-weight", $rootScope.TextPropertyArray[_rectLayerOnSaveSplitInt].FontStyle); + $("#text_area").css("font-style", $rootScope.TextPropertyArray[_rectLayerOnSaveSplitInt].FontStyle); + $("#text_area").css("text-align", $rootScope.TextPropertyArray[_rectLayerOnSaveSplitInt].Align); + $("#text_area").css("color", $rootScope.TextPropertyArray[_rectLayerOnSaveSplitInt].FontColor); + $("#text_area").css("font-family", $rootScope.TextPropertyArray[_rectLayerOnSaveSplitInt].FontFamily); $("#text_area").css("text-decoration", $rootScope.underlineText); - - _rectLayerOnSaveSplitInt = ''; b = ''; $("#annotationTextModal").modal("toggle"); - }, mouseout: function (layer) { - $rootScope.canvasLayerNameCollection = []; $('#canvas').setLayer(layer.name, { handle: { @@ -6513,13 +6484,9 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo width: 0, height: 0, cornerRadius: 0 } - }).drawLayers(); - // $rootScope.textss = ''; - }, mouseover: function (layer) { - $('#canvas').setLayer(layer.name, { handle: { type: 'rectangle', @@ -6537,10 +6504,10 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo $("#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" }); } - else { - // debugger; - +// 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"); @@ -6550,19 +6517,19 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo var _modifiedFontFamily = $("#text_area").css("font-family"); var _modifiedFontDecoration = $("#text_area").css("text-decoration"); + // deleting previous textarea $("#canvas").removeLayer($rootScope.modifySavedText[0].RectText).drawLayers(); $("#canvas").removeLayer($rootScope.modifySavedText[0].TextName).drawLayers(); - $rootScope.resetTextRectSave = $rootScope.ObjectIndexSave++; $rootScope.resetTextSave = $rootScope.ObjectIndexSave++; - // alert($rootScope.resetText); - // alert('TextArea12_' + $rootScope.resetTextSave); + + // generating new text area $('#canvas').drawText({ layer: true, draggable: true, - name: 'TextArea12_' + $rootScope.resetTextSave, - groups: ['TextArea12_' + $rootScope.resetTextSave], - dragGroups: ['TextArea12_' + $rootScope.resetTextSave], + name: 'TextAreaAfterEdit_' + $rootScope.resetTextSave, + groups: ['TextAreaAfterEdit_' + $rootScope.resetTextSave], + dragGroups: ['TextAreaAfterEdit_' + $rootScope.resetTextSave], fillStyle: _modifiedFontColor, fontStyle: _modifiedFontStyle, fontSize: _modifiedFontSize, @@ -6572,49 +6539,31 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo text: _modifiedText, 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) { - - - - }, - - change: function (layer, props) { - - } + maxHeight: $rootScope.rectDimension[$rootScope.rectDimension.length - 1].height }) // Draw rect as wide as the text .drawRect({ - name: 'TextArea13_' + $rootScope.resetTextSave, + name: 'TextAreaAfterEditRect_' + $rootScope.resetTextSave, layer: true, draggable: true, - groups: ['TextArea12_' + $rootScope.resetTextSave], - dragGroups: ['TextArea12_' + $rootScope.resetTextSave], + groups: ['TextAreaAfterEdit_' + $rootScope.resetTextSave], + dragGroups: ['TextAreaAfterEdit_' + $rootScope.resetTextSave], opacity: $rootScope.shapestyleOpacity, strokeStyle: $rootScope.shapestyleborderColor, strokeWidth: $rootScope.shapestyleborderWidth, 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 = "TextArea12_"; - - var concatinateResult = textValName.concat(splitedName[1]); - - $rootScope.canvasLayerNameCollection = []; + 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', @@ -6629,31 +6578,24 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo }, dblclick: function (layer) { - $rootScope.isTrue = true; - + $rootScope.IsTextAlreadySave = true; var _rectLayerOnSave = layer.name; var _rectLayerOnSaveSplit = _rectLayerOnSave.split("_"); - var str1 = "TextArea12_"; - var res = str1.concat(_rectLayerOnSaveSplit[1]); - - $rootScope.modifySavedText.push({ TextName: layer.name, RectText: res }); + var RectNameAfterEdit = "TextAreaAfterEdit_"; + var RectNameAfterEditResult = RectNameAfterEdit.concat(_rectLayerOnSaveSplit[1]); + $rootScope.modifySavedText.push({ TextName: layer.name, RectText: 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").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); - - $("#annotationTextModal").modal("toggle"); - }, mouseout: function (layer) { - $rootScope.canvasLayerNameCollection = []; $('#canvas').setLayer(layer.name, { handle: { @@ -6664,13 +6606,10 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo width: 0, height: 0, cornerRadius: 0 } - }).drawLayers(); - }, mouseover: function (layer) { - - $('#canvas').setLayer(layer.name, { + $('#canvas').setLayer(layer.name, { handle: { type: 'rectangle', fillStyle: '#fff', @@ -6686,18 +6625,15 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo $rootScope.modifySavedText = []; } - } - + } + + // deleting text area on close button $rootScope.closeModal = function () { - debugger; - - $("#canvas").removeLayer('TextArea_' + $rootScope.resetText).drawLayers(); $("#canvas").removeLayer("TextRect_" + $rootScope.resetTextRect).drawLayers(); - - } + } function OnPaintCanvasMouseMove(event) { @@ -6706,13 +6642,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo } $rootScope.FreeStylePaint = function (e) { - // debugger; - - - // $rootScope.shapeType = "FreeStylePaint"; - // canvasPaint.addEventListener('mouseup', $scope.OnPaintBrushCanvasMouseUp, false); - // canvasPaint.addEventListener('mousedown', $scope.OnPaintBrushCanvasMouseDown, false); - + } $scope.OnPaintBrushCanvasMouseDown = function (event) { @@ -6720,7 +6650,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo case "FreeStylePaint": - debugger; + // $('#canvasPaint').sketch(); // $('#canvasPaint').sketch({ defaultSize: 1 }); @@ -6753,8 +6683,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo // case "FreeStylePaint": - // debugger; - + // if ($("#amount-2").val() == '') // { // $('#canvasPaint').sketch({ defaultSize: $scope.shapesize }); @@ -6782,7 +6711,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo if (event.which == 46) { - //debugger; + if ($rootScope.shapeTypePin == "Pin") { @@ -7166,7 +7095,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo //list manager $scope.$on('listManagerEvent', function (event, data) { - // debugger; + $('#spinner').css('visibility', 'visible'); console.log('listManagerEvent') if ($rootScope.islistManagerEventAlredayDispachted == true) { @@ -7301,7 +7230,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo $scope.HighlightBodyOnListManagerSelection = function (event) { $scope.terminateCurrentlyRunningWPs(); - //debugger + $rootScope.isListManagerSelected = true; $rootScope.isLoading = true;