diff --git a/400-SOURCECODE/AIAHTML5.Web/app/controllers/HomeController.js b/400-SOURCECODE/AIAHTML5.Web/app/controllers/HomeController.js index 7670961..29e8ab4 100644 --- a/400-SOURCECODE/AIAHTML5.Web/app/controllers/HomeController.js +++ b/400-SOURCECODE/AIAHTML5.Web/app/controllers/HomeController.js @@ -2504,7 +2504,7 @@ function ($rootScope, Modules, $log, $location, $timeout, DataService, Authentic $(".btn-annotation").removeClass("activebtncolor"); $('.btnCursor').addClass('activebtncolor'); } - + var isDoubleTouch = null; $rootScope.TextEditorFunctionality = function (canvasId, TextNumber, offsetX1, offsetY1, resetTextRect, shapestyleOpacity, shapestyleborderColor, shapestyleborderWidth, shapestyleFillColor, x, y) { if ($rootScope.isTextAreaPreviewCompleted == true) { $rootScope.isTextAreaPreviewCompleted = false; @@ -2647,6 +2647,80 @@ function ($rootScope, Modules, $log, $location, $timeout, DataService, Authentic layer.draggable = false; } }, + touchstart: function (layer) + { + if (isDoubleTouch == null) { + isDoubleTouch = setTimeout(function () { + isDoubleTouch = null; + if ($rootScope.isAnnotaionToolBarDrawingModeActive == true) { + //jcanvas property + layer.draggable = true; + $rootScope.canvasLayerNameCollection = []; + $rootScope.canvasLayerNameCollection.push(layer.name); + $('#canvas').setLayer(layer.name, { + handle: { + type: 'rectangle', + fillStyle: '#fff', + strokeStyle: '#c33', + strokeWidth: 2, + width: 5, height: 5, + cornerRadius: 3, + + } + }).drawLayers(); + } + else { + //jcanvas property + layer.draggable = false; + } + + }, 1000) + } else { + clearTimeout(isDoubleTouch); + isDoubleTouch = null; + if ($rootScope.isAnnotaionToolBarDrawingModeActive == true) { + //jcanvas property + layer.draggable = true; + $rootScope.IsTextAlreadySave = false; + var RectNameArray = (layer.name).split("_"); + + var TextAreaRectangleName = "TextArea_"; + var TextAreaRectNameConcat = TextAreaRectangleName.concat(RectNameArray[1]); + $rootScope.TextAreaRectID = layer.name; + $rootScope.TextID = TextAreaRectNameConcat; + + $rootScope.rectDimension.push({ width: layer.width, height: layer.height, x: layer.x, y: layer.y }); + $("#annotationTextModal").css("padding-right", "0px"); + document.getElementById('modelbackground').style.display = "block"; + $("#annotationTextModal").modal("toggle"); + + $("#text_area").val(''); + $("#text_area").css({ "font-family": "Arial", "font-size": "14px", "font-weight": "normal", "font-style": "normal", "color": "#000", "text-align": "left", "text-decoration": "none" }); + $("#font-color .minicolors .minicolors-swatch .minicolors-swatch-color").css({ "background-color": "#000000" }); + // $("#font-color .minicolors .minicolors-swatch .minicolors-swatch-color").addClass("ActiveDefaultColorAnnotation"); + + $("#selected-font-family option:eq(0)").prop('selected', true); + $("#selected-font-size option:eq(0)").prop('selected', true); + + $("#text-italic").removeClass("ActiveFormattingButtonClass"); + + $("#text-bold").removeClass("ActiveFormattingButtonClass"); + + $("#text-underline").removeClass("ActiveFormattingButtonClass"); + + $("#text-left").removeClass("ActiveFormattingButtonClass"); + + $("#text-right").removeClass("ActiveFormattingButtonClass"); + + $("#text-center").removeClass("ActiveFormattingButtonClass"); + } + else { + //jcanvas property + layer.draggable = false; + } + + } + }, mouseout: function (layer) { if ($rootScope.isAnnotaionToolBarDrawingModeActive == true) { //jcanvas property @@ -2943,6 +3017,9 @@ function ($rootScope, Modules, $log, $location, $timeout, DataService, Authentic } ///----- + + var isDoubleTouchSaveText = null; + var isDoubleTouchSaveTextAgain = null; $rootScope.saveText = function () { document.getElementById('modelbackground').style.display = "none"; @@ -3189,6 +3266,182 @@ function ($rootScope, Modules, $log, $location, $timeout, DataService, Authentic } }, + touchstart: function (layer) { + + if (isDoubleTouchSaveText == null) { + isDoubleTouchSaveText = setTimeout(function () { + isDoubleTouchSaveText = null; + if ($rootScope.isAnnotaionToolBarDrawingModeActive == true) { + //jcanvas property + layer.draggable = true; + $rootScope.shapeTypeText = "textAreaRect"; + var layerName = layer.name; + var splitedName = layerName.split("_"); + var textValName = "TextAreaNew_"; + var concatinateResult = textValName.concat(splitedName[1]); + $rootScope.canvasLayerNameCollection = []; + $rootScope.canvasLayerNameCollection.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(); + + } + else { + //jcanvas property + layer.draggable = false; + } + + }, 1000) + } else { + clearTimeout(isDoubleTouchSaveText); + isDoubleTouchSaveText = null; + if ($rootScope.isAnnotaionToolBarDrawingModeActive == true) { + //jcanvas property + layer.draggable = true; + $rootScope.isTextAreaClosedButtonActive = false; + $rootScope.IsTextAlreadySave = true; + + var _rectLayerOnSave = layer.name; + var _rectLayerOnSaveSplit = _rectLayerOnSave.split("_"); + var TextAreaRectName = "TextAreaNew_"; + var TextAreaRectNameConcatenated = TextAreaRectName.concat(_rectLayerOnSaveSplit[1]); + + $rootScope.layerNameArr = layer.name; + $rootScope.rectTextArr = TextAreaRectNameConcatenated; + + + $rootScope.rectDimension.push({ width: layer.width, height: layer.height, x: layer.x, y: layer.y }); + + for (var i = 0; i <= $rootScope.TextPropertyArray.length - 1; i++) { + if ($rootScope.TextPropertyArray[i].layerName == TextAreaRectNameConcatenated) { + + var textArrVal = $rootScope.TextPropertyArray[i].Rect_Text; + $("#text_area").val(textArrVal); + var fontStyleProp = $rootScope.TextPropertyArray[i].FontStyle; + var fontWeightProp = fontStyleProp.split(" "); + + $("#text_area").css("font-size", $rootScope.TextPropertyArray[i].FontSize); + $("#text_area").css("font-weight", fontWeightProp[0]); + $("#text_area").css("font-style", fontWeightProp[1]); + $("#text_area").css("text-align", $rootScope.TextPropertyArray[i].Align); + $("#text_area").css("color", $rootScope.TextPropertyArray[i].FontColor); + $("#text_area").css("font-family", $rootScope.TextPropertyArray[i].FontFamily); + $("#text_area").css("text-decoration", $rootScope.TextPropertyArray[i].TextDecoration); + $("#font-color .minicolors .minicolors-swatch .minicolors-swatch-color").css({ "background-color": $rootScope.TextPropertyArray[i].FontColor }); + + var CurrentFontFamily = $rootScope.TextPropertyArray[i].FontFamily; + var CurrentFontSize = parseInt($rootScope.TextPropertyArray[i].FontSize); + $("#selected-font-family option[value=" + CurrentFontFamily + "]").prop('selected', true); + $("#selected-font-size option[value=" + CurrentFontSize + "]").prop('selected', true); + + CurrentFontFamily = ''; + CurrentFontSize = ''; + + + if ($rootScope.TextPropertyArray[i].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.TextPropertyArray[i].Align == "left") { + + $("#text-right").removeClass("ActiveFormattingButtonClass"); + + $("#text-center").removeClass("ActiveFormattingButtonClass") + + $("#text-left").addClass("ActiveFormattingButtonClass"); + + } + + else if ($rootScope.TextPropertyArray[i].Align == "right") { + + + + $("#text-center").removeClass("ActiveFormattingButtonClass") + + $("#text-left").removeClass("ActiveFormattingButtonClass"); + + $("#text-right").addClass("ActiveFormattingButtonClass"); + } + + else if ($rootScope.TextPropertyArray[i].Align == "center") { + + $("#text-left").removeClass("ActiveFormattingButtonClass"); + + $("#text-right").removeClass("ActiveFormattingButtonClass"); + + $("#text-center").addClass("ActiveFormattingButtonClass"); + + } + + } + else { + // alert("no"); + + } + + } + + + // _rectLayerOnSaveSplitInt = ''; + textArrVal = ''; + $("#annotationTextModal").css("padding-right", "0px"); + document.getElementById('modelbackground').style.display = "block"; + $("#annotationTextModal").modal("toggle"); + + // $("#selected-font-family").val(CurrentFontFamily); + // $("#selected-font-size").val(CurrentFontSize); + } + else { + //jcanvas property + layer.draggable = false; + } + + } + }, mouseout: function (layer) { if ($rootScope.isAnnotaionToolBarDrawingModeActive == true) { @@ -3521,6 +3774,138 @@ function ($rootScope, Modules, $log, $location, $timeout, DataService, Authentic layer.draggable = false; } }, + touchstart: function (layer) { + + if (isDoubleTouchSaveTextAgain == null) { + isDoubleTouchSaveTextAgain = setTimeout(function () { + isDoubleTouchSaveTextAgain = null; + if ($rootScope.isAnnotaionToolBarDrawingModeActive == true) { + //jcanvas property + layer.draggable = true; + $rootScope.shapeTypeText = "textAreaRect"; + var layerName = layer.name; + var splitedName = layerName.split("_"); + 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', + fillStyle: '#fff', + strokeStyle: '#c33', + strokeWidth: 2, + width: 5, height: 5, + cornerRadius: 3, + } + }).drawLayers(); + } + else { + //jcanvas property + layer.draggable = false; + } + + }, 1000) + } else { + clearTimeout(isDoubleTouchSaveTextAgain); + isDoubleTouchSaveTextAgain = null; + if ($rootScope.isAnnotaionToolBarDrawingModeActive == true) { + //jcanvas property + layer.draggable = true; + $rootScope.isTextAreaClosedButtonActive = false; + $rootScope.IsTextAlreadySave = true; + var _rectLayerOnSave = layer.name; + var _rectLayerOnSaveSplit = _rectLayerOnSave.split("_"); + var RectNameAfterEdit = "TextAreaAfterEdit_"; + var RectNameAfterEditResult = RectNameAfterEdit.concat(_rectLayerOnSaveSplit[1]); + $rootScope.modifySavedTextIndexNumber = _rectLayerOnSaveSplit[1]; + + $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); + $("#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); + $("#font-color .minicolors .minicolors-swatch .minicolors-swatch-color").css({ "background-color": _modifiedFontColor }); + + // $(".ActiveDefaultColorAnnotation").css({ "background-color": _modifiedFontColor + "!important" }); + // $("#font-color .minicolors .minicolors-swatch .minicolors-swatch-color").addClass("ActiveDefaultColorAnnotation"); + + //khushbu + var CurrentFontFamily = _modifiedFontFamily; + // alert(CurrentFontFamily); + // CurrentFontFamily = CurrentFontFamily.replace(/'/g, ""); + var CurrentFontSize = parseInt(_modifiedFontSize); + $("#selected-font-family option[value=" + CurrentFontFamily + "]").prop('selected', true); + $("#selected-font-size option[value=" + CurrentFontSize + "]").prop('selected', true); + CurrentFontFamily = ''; + CurrentFontSize = ''; + //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"); + + } + + document.getElementById('modelbackground').style.display = "block"; + $("#annotationTextModal").modal("toggle"); + } + else { + //jcanvas property + layer.draggable = false; + } + + } + }, mouseout: function (layer) { if ($rootScope.isAnnotaionToolBarDrawingModeActive == true) { //jcanvas property @@ -4652,7 +5037,15 @@ function ($rootScope, Modules, $log, $location, $timeout, DataService, Authentic $("#cursor-block").html(); } + var $ue = navigator.userAgent; + if (($ue.match(/(iPod|iPhone|iPad|android)/i))) { + $("#text_area").click(function () { + $("#annotationTextModal").draggable('disable'); + }).blur(function () { + $("#annotationTextModal").draggable('enable'); + }); + } $rootScope.CheckRefresh = function (e) { //Checking if 'REFRESHED' or 'RELOADED' if ((e.keyCode === 116) || (e.keyCode == 82 && e.ctrlKey))