Commit 055f2366ee27c96f8aa0b02b06f5a757ced5e792

Authored by Nikita Kulshreshtha
2 parents 99800c1c 08852b21

Merge branch 'AnnotationEditMergeRequest' into Develop

400-SOURCECODE/AIAHTML5.Web/app/controllers/DAController.js
... ... @@ -6746,6 +6746,11 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
6746 6746 x: $scope.offsetX1, y: $scope.offsetY1,
6747 6747 width: $scope.x - $scope.offsetX1,
6748 6748 height: $scope.y - $scope.offsetY1,
  6749 + add: function (layer) {
  6750 +
  6751 + $rootScope.rectDimension.push({ width: layer.width, height: layer.height, x: layer.x, y: layer.y });
  6752 +
  6753 + },
6749 6754 click: function (layer) {
6750 6755  
6751 6756 $rootScope.canvasLayerNameCollection = [];
... ... @@ -6762,6 +6767,29 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
6762 6767 }).drawLayers();
6763 6768  
6764 6769 },
  6770 + dblclick: function (layer) {
  6771 +
  6772 +
  6773 + $rootScope.rectDimension.push({ width: layer.width, height: layer.height, x: layer.x, y: layer.y });
  6774 + $("#annotationTextModal").modal("toggle");
  6775 +
  6776 + $("#text_area").val('');
  6777 + $("#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" });
  6778 +
  6779 +
  6780 + $("#text-italic").removeClass("ActiveFormattingButtonClass");
  6781 +
  6782 + $("#text-bold").removeClass("ActiveFormattingButtonClass");
  6783 +
  6784 + $("#text-underline").removeClass("ActiveFormattingButtonClass");
  6785 +
  6786 + $("#text-left").removeClass("ActiveFormattingButtonClass");
  6787 +
  6788 + $("#text-right").removeClass("ActiveFormattingButtonClass");
  6789 +
  6790 + $("#text-center").removeClass("ActiveFormattingButtonClass");
  6791 +
  6792 + },
6765 6793 mouseout: function (layer) {
6766 6794 $rootScope.canvasLayerNameCollection = [];
6767 6795 $('#canvas').setLayer(layer.name, {
... ... @@ -6796,25 +6824,25 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
6796 6824  
6797 6825 $("#annotationTextModal").modal("toggle");
6798 6826 $('.btnCursor').trigger('click');
6799   -
  6827 +
6800 6828 $("#text_area").val('');
6801   -
  6829 +
6802 6830 $("#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" });
6803   -
6804   - $("#text-italic").removeClass("ActiveFormattingButtonClass");
6805   -
6806   - $("#text-bold").removeClass("ActiveFormattingButtonClass");
6807   -
6808   - $("#text-underline").removeClass("ActiveFormattingButtonClass");
6809   -
6810   - $("#text-left").removeClass("ActiveFormattingButtonClass");
6811   -
6812   - $("#text-right").removeClass("ActiveFormattingButtonClass");
6813   -
6814   - $("#text-center").removeClass("ActiveFormattingButtonClass");
6815   -
  6831 +
  6832 + $("#text-italic").removeClass("ActiveFormattingButtonClass");
  6833 +
  6834 + $("#text-bold").removeClass("ActiveFormattingButtonClass");
  6835 +
  6836 + $("#text-underline").removeClass("ActiveFormattingButtonClass");
  6837 +
  6838 + $("#text-left").removeClass("ActiveFormattingButtonClass");
  6839 +
  6840 + $("#text-right").removeClass("ActiveFormattingButtonClass");
  6841 +
  6842 + $("#text-center").removeClass("ActiveFormattingButtonClass");
  6843 +
6816 6844 $(".btn-annotation").removeClass("activebtncolor");
6817   -
  6845 +
6818 6846 $('.btnCursor').addClass('activebtncolor');
6819 6847 break;
6820 6848  
... ... @@ -6848,6 +6876,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
6848 6876  
6849 6877  
6850 6878 $rootScope.saveText = function () {
  6879 +
6851 6880 // this part will work first time when save button will be clicked
6852 6881 if ($rootScope.IsTextAlreadySave == false) {
6853 6882 // getting textarea style properties
... ... @@ -6869,9 +6898,9 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
6869 6898 $('#canvas').drawText({
6870 6899 layer: true,
6871 6900 draggable: true,
6872   - name: 'TextArea_' + $rootScope.resetText,
6873   - groups: ['TextArea_' + $rootScope.resetText],
6874   - dragGroups: ['TextArea_' + $rootScope.resetText],
  6901 + name: 'TextAreaNew_' + $rootScope.resetText,
  6902 + groups: ['TextAreaNew_' + $rootScope.resetText],
  6903 + dragGroups: ['TextAreaNew_' + $rootScope.resetText],
6875 6904 fillStyle: $rootScope.fontColor,
6876 6905 fontStyle: $rootScope.fontWeight + " " + $rootScope.fontStyle,
6877 6906 fontSize: $rootScope.fontSizes,
... ... @@ -6879,10 +6908,11 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
6879 6908 align: $rootScope.textAlignmt,
6880 6909 strokeWidth: 0,
6881 6910 text: $rootScope.textArea,
6882   - x: $scope.offsetX1, y: $scope.offsetY1,
6883   - maxWidth: $scope.x - $scope.offsetX1,
6884   - maxHeight: $scope.y - $scope.offsetY1,
  6911 + x: $rootScope.rectDimension[$rootScope.rectDimension.length - 1].x, y: $rootScope.rectDimension[$rootScope.rectDimension.length - 1].y,
  6912 + maxWidth: $rootScope.rectDimension[$rootScope.rectDimension.length - 1].width,
  6913 + maxHeight: $rootScope.rectDimension[$rootScope.rectDimension.length - 1].height,
6885 6914 add: function (layer) {
  6915 + // alert(layer.maxWidth);
6886 6916 $rootScope.TextPropertyArray.push({ Text1: '', Align: '', FontColor: '', FontSize: '', FontStyle: '', FontFamily: '' });
6887 6917 $rootScope.TextPropertyArray.push({ Text1: layer.text, Align: layer.align, FontColor: layer.fillStyle, FontSize: layer.fontSize, FontStyle: layer.fontStyle, FontFamily: layer.fontFamily, TextDecoration: $rootScope.underlineText });
6888 6918 }
... ... @@ -6892,20 +6922,20 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
6892 6922 name: 'TextArea1_' + $rootScope.resetText,
6893 6923 layer: true,
6894 6924 draggable: true,
6895   - groups: ['TextArea_' + $rootScope.resetText],
6896   - dragGroups: ['TextArea_' + $rootScope.resetText],
  6925 + groups: ['TextAreaNew_' + $rootScope.resetText],
  6926 + dragGroups: ['TextAreaNew_' + $rootScope.resetText],
6897 6927 opacity: $rootScope.shapestyleOpacity,
6898 6928 strokeStyle: $rootScope.shapestyleborderColor,
6899 6929 strokeWidth: $rootScope.shapestyleborderWidth,
6900   - x: $scope.offsetX1, y: $scope.offsetY1,
6901   - width: $scope.x - $scope.offsetX1,
6902   - height: $scope.y - $scope.offsetY1,
  6930 + x: $rootScope.rectDimension[$rootScope.rectDimension.length - 1].x, y: $rootScope.rectDimension[$rootScope.rectDimension.length - 1].y,
  6931 + width: $rootScope.rectDimension[$rootScope.rectDimension.length - 1].width,
  6932 + height: $rootScope.rectDimension[$rootScope.rectDimension.length - 1].height,
6903 6933 click: function (layer) {
6904 6934 $rootScope.shapeTypeText = "textAreaRect";
6905 6935  
6906 6936 var layerNameSplit = layer.name;
6907 6937 var splitedName = layerNameSplit.split("_");
6908   - var textValName = "TextArea_";
  6938 + var textValName = "TextAreaNew_";
6909 6939 var concatinateResult = textValName.concat(splitedName[1]);
6910 6940 $rootScope.canvasLayerNameCollection = [];
6911 6941 $rootScope.canvasLayerNameCollection.push({ textareaRectangle: layer.name, textareaString: concatinateResult });
... ... @@ -6921,13 +6951,20 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
6921 6951 }).drawLayers();
6922 6952 },
6923 6953 dblclick: function (layer) {
  6954 +
  6955 + $rootScope.isTextAreaClosedButtonActive = false;
6924 6956 $rootScope.IsTextAlreadySave = true;
6925 6957  
6926 6958 var _rectLayerOnSave = layer.name;
6927 6959 var _rectLayerOnSaveSplit = _rectLayerOnSave.split("_");
6928   - var TextAreaRectName = "TextArea_";
  6960 + var TextAreaRectName = "TextAreaNew_";
6929 6961 var TextAreaRectNameConcatenated = TextAreaRectName.concat(_rectLayerOnSaveSplit[1]);
6930   - $rootScope.modifySavedText.push({ TextName: layer.name, RectText: TextAreaRectNameConcatenated });
  6962 +
  6963 + $rootScope.layerNameArr = layer.name;
  6964 + $rootScope.rectTextArr = TextAreaRectNameConcatenated;
  6965 + // $rootScope.modifySavedText.push({ TextName: '', RectText: ''});
  6966 + // $rootScope.modifySavedText.push({ TextName: layer.name, RectText: TextAreaRectNameConcatenated });
  6967 +
6931 6968 $rootScope.rectDimension.push({ width: layer.width, height: layer.height, x: layer.x, y: layer.y });
6932 6969 var _rectLayerOnSaveSplitInt;
6933 6970 //if (_rectLayerOnSaveSplit[1] >= 3)
... ... @@ -6936,11 +6973,12 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
6936 6973 // _rectLayerOnSaveSplitInt = parseInt(_rectLayerOnSaveSplit[1]);
6937 6974  
6938 6975 _rectLayerOnSaveSplitInt = parseInt(_rectLayerOnSaveSplit[1]);
  6976 +
6939 6977 var b = $rootScope.TextPropertyArray[_rectLayerOnSaveSplitInt].Text1;
6940 6978 $("#text_area").val(b);
6941 6979 var fontStyleProp = $rootScope.TextPropertyArray[_rectLayerOnSaveSplitInt].FontStyle;
6942   - var fontWeightProp = fontStyleProp.split(" ");
6943   -
  6980 + var fontWeightProp = fontStyleProp.split(" ");
  6981 +
6944 6982 $("#text_area").css("font-size", $rootScope.TextPropertyArray[_rectLayerOnSaveSplitInt].FontSize);
6945 6983 $("#text_area").css("font-weight", fontWeightProp[0]);
6946 6984 $("#text_area").css("font-style", fontWeightProp[1]);
... ... @@ -6953,96 +6991,89 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
6953 6991  
6954 6992  
6955 6993 //adding text text decoration active class in text edit pop-up
6956   -
6957   - if ($rootScope.TextPropertyArray[_rectLayerOnSaveSplitInt].TextDecoration == "underline") {
6958   -
6959   - $("#text-underline").addClass("ActiveFormattingButtonClass");
6960   -
6961   - }
6962   -
6963   - else {
6964   -
6965   - $("#text-underline").removeClass("ActiveFormattingButtonClass");
6966   -
6967   - }
6968   -
6969 6994  
6970   -
6971   - //adding text font weight active class in text edit pop-up
6972   -
6973   - if (fontWeightProp[0] == 700) {
6974   -
6975   -
6976   -
6977   - $("#text-bold").addClass("ActiveFormattingButtonClass");
6978   -
6979   - }
6980   -
6981   - else
6982   -
6983   - {
6984   -
6985   - $("#text-bold").removeClass("ActiveFormattingButtonClass");
6986   -
  6995 + if ($rootScope.TextPropertyArray[_rectLayerOnSaveSplitInt].TextDecoration == "underline") {
  6996 +
  6997 + $("#text-underline").addClass("ActiveFormattingButtonClass");
  6998 +
6987 6999 }
6988   -
6989   - //adding text font style active class in text edit pop-up
6990   -
6991   - if (fontWeightProp[1] == "italic") {
6992   -
6993   -
6994   - $("#text-italic").addClass("ActiveFormattingButtonClass");
6995   - }
6996   - else
6997   -
6998   - {
6999   - $("#text-italic").removeClass("ActiveFormattingButtonClass");
7000   -
7001 7000  
7002   -
7003   - }
7004   -
  7001 + else {
7005 7002  
7006   -
7007   - //adding text alignment active class in text edit pop-up
7008   -
7009   - if ($rootScope.TextPropertyArray[_rectLayerOnSaveSplitInt].Align == "left") {
7010   -
7011   - $("#text-right").removeClass("ActiveFormattingButtonClass");
7012   -
7013   - $("#text-center").removeClass("ActiveFormattingButtonClass")
7014   -
7015   - $("#text-left").addClass("ActiveFormattingButtonClass");
7016   -
7017   - }
7018   -
7019   - else if ($rootScope.TextPropertyArray[_rectLayerOnSaveSplitInt].Align == "right") {
  7003 + $("#text-underline").removeClass("ActiveFormattingButtonClass");
  7004 +
  7005 + }
7020 7006  
7021 7007  
7022 7008  
7023   - $("#text-center").removeClass("ActiveFormattingButtonClass")
  7009 + //adding text font weight active class in text edit pop-up
7024 7010  
7025   - $("#text-left").removeClass("ActiveFormattingButtonClass");
  7011 + if (fontWeightProp[0] == 700) {
7026 7012  
7027   - $("#text-right").addClass("ActiveFormattingButtonClass");
7028 7013  
7029 7014  
  7015 + $("#text-bold").addClass("ActiveFormattingButtonClass");
7030 7016  
7031   - }
  7017 + }
7032 7018  
7033   - else if ($rootScope.TextPropertyArray[_rectLayerOnSaveSplitInt].Align == "center") {
  7019 + else {
7034 7020  
7035   - $("#text-left").removeClass("ActiveFormattingButtonClass");
  7021 + $("#text-bold").removeClass("ActiveFormattingButtonClass");
7036 7022  
7037   - $("#text-right").removeClass("ActiveFormattingButtonClass");
  7023 + }
7038 7024  
7039   - $("#text-center").addClass("ActiveFormattingButtonClass");
  7025 + //adding text font style active class in text edit pop-up
7040 7026  
  7027 + if (fontWeightProp[1] == "italic") {
7041 7028  
7042 7029  
7043   - }
  7030 + $("#text-italic").addClass("ActiveFormattingButtonClass");
  7031 + }
  7032 + else {
  7033 + $("#text-italic").removeClass("ActiveFormattingButtonClass");
  7034 +
  7035 +
  7036 + }
  7037 +
  7038 + //adding text alignment active class in text edit pop-up
  7039 +
  7040 + if ($rootScope.TextPropertyArray[_rectLayerOnSaveSplitInt].Align == "left") {
  7041 +
  7042 + $("#text-right").removeClass("ActiveFormattingButtonClass");
  7043 +
  7044 + $("#text-center").removeClass("ActiveFormattingButtonClass")
  7045 +
  7046 + $("#text-left").addClass("ActiveFormattingButtonClass");
  7047 +
  7048 + }
  7049 +
  7050 + else if ($rootScope.TextPropertyArray[_rectLayerOnSaveSplitInt].Align == "right") {
  7051 +
  7052 +
  7053 +
  7054 + $("#text-center").removeClass("ActiveFormattingButtonClass")
  7055 +
  7056 + $("#text-left").removeClass("ActiveFormattingButtonClass");
  7057 +
  7058 + $("#text-right").addClass("ActiveFormattingButtonClass");
  7059 +
  7060 +
  7061 +
  7062 + }
  7063 +
  7064 + else if ($rootScope.TextPropertyArray[_rectLayerOnSaveSplitInt].Align == "center") {
  7065 +
  7066 + $("#text-left").removeClass("ActiveFormattingButtonClass");
  7067 +
  7068 + $("#text-right").removeClass("ActiveFormattingButtonClass");
  7069 +
  7070 + $("#text-center").addClass("ActiveFormattingButtonClass");
  7071 +
  7072 +
  7073 +
  7074 + }
  7075 +
7044 7076  
7045   -
7046 7077 _rectLayerOnSaveSplitInt = ''; b = '';
7047 7078 $("#annotationTextModal").modal("toggle");
7048 7079 },
... ... @@ -7078,22 +7109,23 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
7078 7109  
7079 7110  
7080 7111 $("#text-italic").removeClass("ActiveFormattingButtonClass");
7081   -
7082   - $("#text-bold").removeClass("ActiveFormattingButtonClass");
7083   -
7084   - $("#text-underline").removeClass("ActiveFormattingButtonClass");
7085   -
7086   - $("#text-left").removeClass("ActiveFormattingButtonClass");
7087   -
7088   - $("#text-right").removeClass("ActiveFormattingButtonClass");
7089   -
7090   - $("#text-center").removeClass("ActiveFormattingButtonClass");
  7112 +
  7113 + $("#text-bold").removeClass("ActiveFormattingButtonClass");
  7114 +
  7115 + $("#text-underline").removeClass("ActiveFormattingButtonClass");
  7116 +
  7117 + $("#text-left").removeClass("ActiveFormattingButtonClass");
  7118 +
  7119 + $("#text-right").removeClass("ActiveFormattingButtonClass");
  7120 +
  7121 + $("#text-center").removeClass("ActiveFormattingButtonClass");
7091 7122  
7092 7123  
7093 7124 }
7094 7125  
7095 7126 // this part will work second time when save button will be clicked
7096 7127 else {
  7128 +
7097 7129 // getting textarea style properties
7098 7130 var _modifiedText = $("#text_area").val();
7099 7131 var _modifiedFontSize = $("#text_area").css("font-size");
... ... @@ -7105,8 +7137,15 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
7105 7137 var _modifiedFontDecoration = $("#text_area").css("text-decoration");
7106 7138  
7107 7139 // deleting previous textarea
7108   - $("#canvas").removeLayer($rootScope.modifySavedText[0].RectText).drawLayers();
7109   - $("#canvas").removeLayer($rootScope.modifySavedText[0].TextName).drawLayers();
  7140 +
  7141 + // var a = $rootScope.modifySavedTextIndexNumber;
  7142 + // alert(a);
  7143 + // alert($rootScope.modifySavedText.length);
  7144 + // alert($rootScope.modifySavedText[a].RectText);
  7145 +
  7146 + $("#canvas").removeLayer($rootScope.layerNameArr).drawLayers();
  7147 + $("#canvas").removeLayer($rootScope.rectTextArr).drawLayers();
  7148 +
7110 7149 $rootScope.resetTextRectSave = $rootScope.ObjectIndexSave++;
7111 7150 $rootScope.resetTextSave = $rootScope.ObjectIndexSave++;
7112 7151  
... ... @@ -7165,12 +7204,23 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
7165 7204 },
7166 7205 dblclick: function (layer) {
7167 7206  
  7207 + $rootScope.isTextAreaClosedButtonActive = false;
7168 7208 $rootScope.IsTextAlreadySave = true;
7169 7209 var _rectLayerOnSave = layer.name;
7170 7210 var _rectLayerOnSaveSplit = _rectLayerOnSave.split("_");
7171 7211 var RectNameAfterEdit = "TextAreaAfterEdit_";
7172 7212 var RectNameAfterEditResult = RectNameAfterEdit.concat(_rectLayerOnSaveSplit[1]);
7173   - $rootScope.modifySavedText.push({ TextName: layer.name, RectText: RectNameAfterEditResult });
  7213 + $rootScope.modifySavedTextIndexNumber = _rectLayerOnSaveSplit[1];
  7214 +
  7215 +
  7216 +
  7217 + // $rootScope.modifySavedText.push({ TextName: '', RectText: '' });
  7218 + // $rootScope.modifySavedText.push({ TextName: layer.name, RectText: RectNameAfterEditResult });
  7219 +
  7220 + $rootScope.layerNameArr = layer.name;
  7221 + $rootScope.rectTextArr = RectNameAfterEditResult;
  7222 +
  7223 +
7174 7224 $rootScope.rectDimension.push({ width: layer.width, height: layer.height, x: layer.x, y: layer.y });
7175 7225 $("#text_area").val(_modifiedText);
7176 7226 $("#text_area").css("font-size", _modifiedFontSize);
... ... @@ -7233,9 +7283,6 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
7233 7283 }
7234 7284  
7235 7285  
7236   -
7237   -
7238   -
7239 7286 $("#annotationTextModal").modal("toggle");
7240 7287 },
7241 7288 mouseout: function (layer) {
... ... @@ -7265,7 +7312,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
7265 7312  
7266 7313 }
7267 7314 });
7268   - $rootScope.modifySavedText = [];
  7315 + // $rootScope.modifySavedText = [];
7269 7316  
7270 7317 }
7271 7318 }
... ... @@ -7273,8 +7320,12 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
7273 7320 // deleting text area on close button
7274 7321 $rootScope.closeModal = function () {
7275 7322  
7276   - $("#canvas").removeLayer('TextArea_' + $rootScope.resetText).drawLayers();
7277   - $("#canvas").removeLayer("TextRect_" + $rootScope.resetTextRect).drawLayers();
  7323 +
  7324 + if ($rootScope.isTextAreaClosedButtonActive == true) {
  7325 + $("#canvas").removeLayer('TextArea_' + $rootScope.resetText).drawLayers();
  7326 + $("#canvas").removeLayer("TextRect_" + $rootScope.resetTextRect).drawLayers();
  7327 +
  7328 + }
7278 7329  
7279 7330 }
7280 7331  
... ...
400-SOURCECODE/AIAHTML5.Web/index.html
... ... @@ -605,8 +605,9 @@
605 605 <textarea class="form-control" id="text_area" rows="3" style="font-family: 'Verdana, sans-serif';font-size:14px; font-weight: normal; font-style: normal; color: #000; text-align: left; text-decoration: none;"></textarea>
606 606 </div>
607 607 <div class="modal-footer">
608   - <button type="button" class="btn btn-default" ng-click="closeModal()" data-dismiss="modal">Close</button>
609   - <button type="button" id="saveBtn" class="btn btn-primary" data-dismiss="modal" ng-click="saveText()">Save</button>
  608 + <!--<button type="button" class="btn btn-default" ng-click="closeModal()" data-dismiss="modal">Close</button>-->
  609 + <button type="button" class="btn btn-default" id="closeEditText" data-dismiss="modal">Close</button>
  610 + <button type="button" id="saveBtn" class="btn btn-primary" data-dismiss="modal" ng-click="saveText()">Save</button>
610 611 </div>
611 612 </div>
612 613 </div>
... ...