diff --git a/400-SOURCECODE/AIAHTML5.Web/app/controllers/HomeController.js b/400-SOURCECODE/AIAHTML5.Web/app/controllers/HomeController.js
index fc1dad8..3b2634b 100644
--- a/400-SOURCECODE/AIAHTML5.Web/app/controllers/HomeController.js
+++ b/400-SOURCECODE/AIAHTML5.Web/app/controllers/HomeController.js
@@ -3742,6 +3742,12 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data
};
}
+ $timeout(function(){
+ $('.btnCursor').trigger('click');
+ $(".btn-annotation").removeClass("activebtncolor");
+ $('.btnCursor').addClass('activebtncolor');
+
+ },100)
}
@@ -3932,8 +3938,8 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data
$rootScope.IsTextAlreadySave = false;
$rootScope.TextNumber = $rootScope.ObjectIndex++;
$rootScope.isTextAreaPreviewCompleted = true;
-
- $rootScope.TextEditorFunctionality(canvasId, $rootScope.TextNumber,shapeData.text,shapeData.shapestyle,shapeData.textstyle, shapeData.x, shapeData.y, shapeData.size.width, shapeData.size.height);
+
+ $rootScope.TextEditorFunctionality(canvasId, $rootScope.TextNumber,shapeData.text,shapeData.shapestyle,shapeData.textstyle, shapeData.x, shapeData.y, shapeData.size.width, shapeData.size.height);
break;
}
@@ -4221,7 +4227,9 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data
}
$rootScope.jcanvasObjectArray = [];
$rootScope.DrawRectangleOnModuleItem = function (canvasId, RectNumber, shapestyleFillColor, shapestyleborderColor, shapestyleOpacity, shapestyleborderWidth, offsetX1, offsetY1, width, height) {
- if ($rootScope.isRectanglePreviewCompleted == true) {
+ if ($rootScope.isRectanglePreviewCompleted == true) {
+ if(width<30) width=30 ;
+ if(height<30) height=30;
$rootScope.isRectanglePreviewCompleted = false;
$("#"+canvasId).addLayer({
panelCanvasId:canvasId,
@@ -4237,6 +4245,8 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data
x: offsetX1, y: offsetY1,
width: width,
height: height,
+ minWidth:30,
+ minHeight:30,
resizeFromCenter: false,
add: function (layer) {
var drawingPoints={
@@ -4372,7 +4382,9 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data
$rootScope.DrawCircleOnModuleItem = function (canvasId, CircleNumber, shapestyleOpacity, shapestyleborderColor, shapestyleborderWidth, shapestyleFillColor, offsetX1, offsetY1, width, height) {
- if ($rootScope.isCirclePreviewCompleted == true) {
+ if ($rootScope.isCirclePreviewCompleted == true) {
+ if(width<30) width=30 ;
+ if(height<30) height=30;
$rootScope.isCirclePreviewCompleted = false;
$("#"+canvasId).addLayer({
panelCanvasId:canvasId,
@@ -4389,6 +4401,8 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data
y: offsetY1,
width: width,
height: height,
+ minWidth:30,
+ minHeight:30,
// Place a handle at each side and each corner
resizeFromCenter: false,
handlePlacement: 'both',
@@ -4932,139 +4946,6 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data
document.getElementById('modelbackground').style.display = "none";
}
- $scope.RefreshShapeText=function(canvasId,selectedTextRect,selectedTextArea,areaText)
- {
- var contentWidthArray = [];
- var contentHeightArray = [];
- $rootScope.textWidth=[];
- var adjustWidth=0;
- var text = areaText;
- var stringText="";
-
- var rectDimension = new jinqJs()
- .from($rootScope.rectDimension)
- .where('panelCanvasId == ' + canvasId,'name == ' + selectedTextRect)
- .select();
- var textDimension = new jinqJs()
- .from($rootScope.textDimension)
- .where('panelCanvasId == ' + canvasId,'name == ' + selectedTextArea)
- .select();
-
- $("#atTextDiv").css({ "width": Math.abs(rectDimension[0].width), "height": Math.abs(rectDimension[0].height), "font-size": textDimension[0].textstyle.fontSize });
-
- $("#textspan").empty();
- $("#textspan").css({"display":"inline-block"});
-
- for (var i = 0; i <= text.length - 1; i++) {
- if (contentWidthArray.length > 0) {
- if (parseInt(contentWidthArray[0]) < $("#atTextDiv").width()) {
- //store break line by enter key
- var charvalue=text[i];
- var LineBreaksLen = (text[i].match(/\n/g)||[]).length;
- var isaddchar=true;
- if(LineBreaksLen>0)
- {
- var lastspace= $rootScope.textWidth[$rootScope.textWidth.length-1].character;
- charvalue=" ";//replace break line in between text by white space
- if(lastspace==charvalue)
- {
- isaddchar=false;
- }
- }
- else
- {
- // handle multiple space
- var lastspace= $rootScope.textWidth[$rootScope.textWidth.length-1].character;
- if(lastspace==" " && charvalue==" ")
- {
- isaddchar=false;
- }
-
- }
- if(isaddchar)
- {
- stringText=stringText+charvalue;
- $("#textspan").append(charvalue);
- contentWidthArray = [];
- $rootScope.textWidth.push({"panelCanvasId":canvasId, "id": "", "character": charvalue });
- contentWidthArray.push(Math.ceil($("#textspan").width()));
- }
- }
- else {
- var LineBreaksLen = (text[i].match(/\n/g)||[]).length;
- if(LineBreaksLen<=0)
- {
- if(adjustWidth0) {
- // update height
- $rootScope.rectDimension = new jinqJs()
- .from($rootScope.rectDimension)
- .update(function (coll, index) {
- coll[index].height = contentHeightArray[0].totalHeight;
- coll[index].width = adjustWidth>0 ?adjustWidth:coll[index].width;
- })
- .at('panelCanvasId == ' + canvasId,'name == ' + selectedTextRect)
- .select();
-
-
- }
-
- $rootScope.textDimension = new jinqJs()
- .from($rootScope.textDimension)
- .update(function (coll, index) { coll[index].stringText = stringText; })
- .at('panelCanvasId == ' + canvasId,'name == ' + selectedTextArea)
- .select();
-
- contentHeightArray = [];//clear hieght
- }
-
$scope.UpdateTextEditor=function(TextPropertyArray,fillStyle)
{
if (TextPropertyArray.length>0) {
@@ -5156,9 +5037,13 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data
if(areaText!=undefined)
{
//not use while open from CB
- $scope.RefreshShapeText(canvasId,selectedTextRect,selectedTextArea,areaText);
+ $rootScope.textDimension = new jinqJs()
+ .from($rootScope.textDimension)
+ .update(function (coll, index) { coll[index].stringText = areaText; })
+ .at('panelCanvasId == ' + canvasId,'name == ' + selectedTextArea)
+ .select();
}
-
+
var rectDimension = new jinqJs()
.from($rootScope.rectDimension)
.where('panelCanvasId == ' + canvasId,'name == ' + selectedTextRect)
@@ -5185,8 +5070,35 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data
}
}
}
-
- $("#" + canvasId).drawRect({
+
+ $("#" + canvasId).drawText({
+ panelCanvasId:canvasId,
+ layer: true,
+ name: 'temptext',//use for intially adjust height and width of text for rectangle
+ fillStyle:textDimension[0].textstyle.fontColor,
+ fontStyle: textDimension[0].textstyle.fontWeight + " " + textDimension[0].textstyle.fontStyle,
+ fontSize: textDimension[0].textstyle.fontSize,
+ fromCenter: false,
+ fontFamily: textDimension[0].textstyle.fontFamily,
+ align: textDimension[0].textstyle.textAlignmt,
+ strokeWidth: 0,
+ text: textDimension[0].stringText,
+ x: rectDimension[0].x, y: rectDimension[0].y,
+ maxWidth:rectDimension[0].width,
+ add: function (layer) {
+ // internal use
+ // use to calculate minwidth of rectangle by longest word with applied css
+ var str=layer.text;
+ var splittext=str.split(" ");
+ var longtext= longest_string(splittext)[0];
+ var test = document.getElementById("atTextDiv");
+ test.style.fontSize = layer.fontSize;
+ test.style.fontFamily = layer.fontFamily;
+ test.style.fontWeight = layer.fontStyle.split(" ")[0];
+ test.style.fontStyle = layer.fontStyle.split(" ")[1];
+ $('#atTextDiv').html(longtext);
+ },
+ }).drawRect({
panelCanvasId:canvasId,
name: rectDimension[0].name,
groups: [rectDimension[0].groupName],
@@ -5200,12 +5112,12 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data
fillStyle: rectDimension[0].shapestyle.fillStyle,
fromCenter: false,
x: rectDimension[0].x, y: rectDimension[0].y,
- width: Math.abs(rectDimension[0].width),
- height: Math.abs(rectDimension[0].height),
- minWidth: Math.abs(rectDimension[0].width),
- minHeight: Math.abs(rectDimension[0].height),
+ width: $("#" + canvasId).measureText('temptext').width>20?$("#" + canvasId).measureText('temptext').width+10:40,
+ height:$("#" + canvasId).measureText('temptext').height>20?$("#" + canvasId).measureText('temptext').height+10:40,
+ minWidth:document.getElementById("atTextDiv").clientWidth>20?document.getElementById("atTextDiv").clientWidth+10:40,
+ minHeight:$("#" + canvasId).measureText('temptext').height>20?$("#" + canvasId).measureText('temptext').height:40,
resizeFromCenter: false,
- add: function (layer) {
+ add: function (layer) {
var drawingPoints={
"layerName": layer.name,//for internal use
"shapeType":layer.type,
@@ -5351,7 +5263,10 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data
handlemove: function(layer) {
if ($rootScope.isAnnotaionToolBarDrawingModeActive == true) {
var txtnumber=(layer.name).split('_')[1];
- var textareaName="TextArea_" +txtnumber;
+ var textareaName="TextArea_" +txtnumber;
+ // change min height of reactangle
+ var textheight=$("#" + layer.panelCanvasId).measureText(textareaName).height+10;
+ layer.minHeight= textheight;
$("#" + layer.panelCanvasId).removeLayer(textareaName).drawLayers();
var textDimension = new jinqJs()
@@ -5374,8 +5289,8 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data
align: textDimension[0].textstyle.textAlignmt,
strokeWidth: 0,
text: textDimension[0].stringText,
- x: layer.x, y: layer.y,
- maxWidth:layer.width,
+ x: layer.x+5, y: layer.y+5,
+ maxWidth:layer.width-2,
add: function (layer) {
layer.draggable = true;
},
@@ -5435,7 +5350,16 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data
}
}
var txtnumber=(layer.name).split('_')[1];
- var textareaName="TextArea_" +txtnumber;
+ var textareaName="TextArea_" +txtnumber;
+
+ $rootScope.rectDimension = new jinqJs()
+ .from($rootScope.rectDimension)
+ .update(function (coll, index) {
+ coll[index].height = layer.height;
+ coll[index].width = layer.width;
+ })
+ .at('panelCanvasId == ' + layer.panelCanvasId,'name == ' + layer.name)
+ .select();
var rectDimension = new jinqJs()
.from($rootScope.rectDimension)
@@ -5474,7 +5398,7 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data
}
}
- }).drawText({
+ }).drawText({
panelCanvasId:canvasId,
layer: true,
draggable: true,
@@ -5489,10 +5413,12 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data
align: textDimension[0].textstyle.textAlignmt,
strokeWidth: 0,
text: textDimension[0].stringText,
- x: rectDimension[0].x, y: rectDimension[0].y,
+ x: rectDimension[0].x+5, y: rectDimension[0].y+5,
maxWidth:rectDimension[0].width,
add: function (layer) {
- layer.draggable = true;
+ layer.draggable = true;
+ //remove temptext
+ $("#" + canvasId).removeLayer('temptext').drawLayers();
},
dragstop: function (layer) {
if ($rootScope.isAnnotaionToolBarDrawingModeActive == true) {
@@ -5536,6 +5462,13 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data
}
}
+ function longest_string(str_ara) {
+ let max = str_ara[0].length;
+ str_ara.map(v => max = Math.max(max, v.length));
+ var result = str_ara.filter(v => v.length == max);
+ return result;
+ }
+
$scope.dragstopEvent=function(panelCanvasId,rectName,textareaName,positionX,positionY)
{
if ((panelCanvasId).match("canvasAA")) {
diff --git a/400-SOURCECODE/AIAHTML5.Web/index.aspx b/400-SOURCECODE/AIAHTML5.Web/index.aspx
index be47494..7f1309f 100644
--- a/400-SOURCECODE/AIAHTML5.Web/index.aspx
+++ b/400-SOURCECODE/AIAHTML5.Web/index.aspx
@@ -786,15 +786,7 @@
-
-
-
-
-
-
-
-
-
+
-
-
+
+
+
+