Commit a71b82eaf449344e1461c53a8141e8dd91969e97

Authored by Mukul Rajput
1 parent 7b06aac1

this is solution for the issue of ipad text on anotation toolbar

400-SOURCECODE/AIAHTML5.Web/app/controllers/HomeController.js
... ... @@ -2504,7 +2504,7 @@ function ($rootScope, Modules, $log, $location, $timeout, DataService, Authentic
2504 2504 $(".btn-annotation").removeClass("activebtncolor");
2505 2505 $('.btnCursor').addClass('activebtncolor');
2506 2506 }
2507   -
  2507 + var isDoubleTouch = null;
2508 2508 $rootScope.TextEditorFunctionality = function (canvasId, TextNumber, offsetX1, offsetY1, resetTextRect, shapestyleOpacity, shapestyleborderColor, shapestyleborderWidth, shapestyleFillColor, x, y) {
2509 2509 if ($rootScope.isTextAreaPreviewCompleted == true) {
2510 2510 $rootScope.isTextAreaPreviewCompleted = false;
... ... @@ -2647,6 +2647,80 @@ function ($rootScope, Modules, $log, $location, $timeout, DataService, Authentic
2647 2647 layer.draggable = false;
2648 2648 }
2649 2649 },
  2650 + touchstart: function (layer)
  2651 + {
  2652 + if (isDoubleTouch == null) {
  2653 + isDoubleTouch = setTimeout(function () {
  2654 + isDoubleTouch = null;
  2655 + if ($rootScope.isAnnotaionToolBarDrawingModeActive == true) {
  2656 + //jcanvas property
  2657 + layer.draggable = true;
  2658 + $rootScope.canvasLayerNameCollection = [];
  2659 + $rootScope.canvasLayerNameCollection.push(layer.name);
  2660 + $('#canvas').setLayer(layer.name, {
  2661 + handle: {
  2662 + type: 'rectangle',
  2663 + fillStyle: '#fff',
  2664 + strokeStyle: '#c33',
  2665 + strokeWidth: 2,
  2666 + width: 5, height: 5,
  2667 + cornerRadius: 3,
  2668 +
  2669 + }
  2670 + }).drawLayers();
  2671 + }
  2672 + else {
  2673 + //jcanvas property
  2674 + layer.draggable = false;
  2675 + }
  2676 +
  2677 + }, 1000)
  2678 + } else {
  2679 + clearTimeout(isDoubleTouch);
  2680 + isDoubleTouch = null;
  2681 + if ($rootScope.isAnnotaionToolBarDrawingModeActive == true) {
  2682 + //jcanvas property
  2683 + layer.draggable = true;
  2684 + $rootScope.IsTextAlreadySave = false;
  2685 + var RectNameArray = (layer.name).split("_");
  2686 +
  2687 + var TextAreaRectangleName = "TextArea_";
  2688 + var TextAreaRectNameConcat = TextAreaRectangleName.concat(RectNameArray[1]);
  2689 + $rootScope.TextAreaRectID = layer.name;
  2690 + $rootScope.TextID = TextAreaRectNameConcat;
  2691 +
  2692 + $rootScope.rectDimension.push({ width: layer.width, height: layer.height, x: layer.x, y: layer.y });
  2693 + $("#annotationTextModal").css("padding-right", "0px");
  2694 + document.getElementById('modelbackground').style.display = "block";
  2695 + $("#annotationTextModal").modal("toggle");
  2696 +
  2697 + $("#text_area").val('');
  2698 + $("#text_area").css({ "font-family": "Arial", "font-size": "14px", "font-weight": "normal", "font-style": "normal", "color": "#000", "text-align": "left", "text-decoration": "none" });
  2699 + $("#font-color .minicolors .minicolors-swatch .minicolors-swatch-color").css({ "background-color": "#000000" });
  2700 + // $("#font-color .minicolors .minicolors-swatch .minicolors-swatch-color").addClass("ActiveDefaultColorAnnotation");
  2701 +
  2702 + $("#selected-font-family option:eq(0)").prop('selected', true);
  2703 + $("#selected-font-size option:eq(0)").prop('selected', true);
  2704 +
  2705 + $("#text-italic").removeClass("ActiveFormattingButtonClass");
  2706 +
  2707 + $("#text-bold").removeClass("ActiveFormattingButtonClass");
  2708 +
  2709 + $("#text-underline").removeClass("ActiveFormattingButtonClass");
  2710 +
  2711 + $("#text-left").removeClass("ActiveFormattingButtonClass");
  2712 +
  2713 + $("#text-right").removeClass("ActiveFormattingButtonClass");
  2714 +
  2715 + $("#text-center").removeClass("ActiveFormattingButtonClass");
  2716 + }
  2717 + else {
  2718 + //jcanvas property
  2719 + layer.draggable = false;
  2720 + }
  2721 +
  2722 + }
  2723 + },
2650 2724 mouseout: function (layer) {
2651 2725 if ($rootScope.isAnnotaionToolBarDrawingModeActive == true) {
2652 2726 //jcanvas property
... ... @@ -2943,6 +3017,9 @@ function ($rootScope, Modules, $log, $location, $timeout, DataService, Authentic
2943 3017 }
2944 3018  
2945 3019 ///-----
  3020 +
  3021 + var isDoubleTouchSaveText = null;
  3022 + var isDoubleTouchSaveTextAgain = null;
2946 3023 $rootScope.saveText = function () {
2947 3024  
2948 3025 document.getElementById('modelbackground').style.display = "none";
... ... @@ -3189,6 +3266,182 @@ function ($rootScope, Modules, $log, $location, $timeout, DataService, Authentic
3189 3266 }
3190 3267  
3191 3268 },
  3269 + touchstart: function (layer) {
  3270 +
  3271 + if (isDoubleTouchSaveText == null) {
  3272 + isDoubleTouchSaveText = setTimeout(function () {
  3273 + isDoubleTouchSaveText = null;
  3274 + if ($rootScope.isAnnotaionToolBarDrawingModeActive == true) {
  3275 + //jcanvas property
  3276 + layer.draggable = true;
  3277 + $rootScope.shapeTypeText = "textAreaRect";
  3278 + var layerName = layer.name;
  3279 + var splitedName = layerName.split("_");
  3280 + var textValName = "TextAreaNew_";
  3281 + var concatinateResult = textValName.concat(splitedName[1]);
  3282 + $rootScope.canvasLayerNameCollection = [];
  3283 + $rootScope.canvasLayerNameCollection.push({ textareaRectangle: layer.name, textareaString: concatinateResult });
  3284 + $('#canvas').setLayer(layer.name, {
  3285 + handle: {
  3286 + type: 'rectangle',
  3287 + fillStyle: '#fff',
  3288 + strokeStyle: '#c33',
  3289 + strokeWidth: 2,
  3290 + width: 5, height: 5,
  3291 + cornerRadius: 3,
  3292 + }
  3293 + }).drawLayers();
  3294 +
  3295 + }
  3296 + else {
  3297 + //jcanvas property
  3298 + layer.draggable = false;
  3299 + }
  3300 +
  3301 + }, 1000)
  3302 + } else {
  3303 + clearTimeout(isDoubleTouchSaveText);
  3304 + isDoubleTouchSaveText = null;
  3305 + if ($rootScope.isAnnotaionToolBarDrawingModeActive == true) {
  3306 + //jcanvas property
  3307 + layer.draggable = true;
  3308 + $rootScope.isTextAreaClosedButtonActive = false;
  3309 + $rootScope.IsTextAlreadySave = true;
  3310 +
  3311 + var _rectLayerOnSave = layer.name;
  3312 + var _rectLayerOnSaveSplit = _rectLayerOnSave.split("_");
  3313 + var TextAreaRectName = "TextAreaNew_";
  3314 + var TextAreaRectNameConcatenated = TextAreaRectName.concat(_rectLayerOnSaveSplit[1]);
  3315 +
  3316 + $rootScope.layerNameArr = layer.name;
  3317 + $rootScope.rectTextArr = TextAreaRectNameConcatenated;
  3318 +
  3319 +
  3320 + $rootScope.rectDimension.push({ width: layer.width, height: layer.height, x: layer.x, y: layer.y });
  3321 +
  3322 + for (var i = 0; i <= $rootScope.TextPropertyArray.length - 1; i++) {
  3323 + if ($rootScope.TextPropertyArray[i].layerName == TextAreaRectNameConcatenated) {
  3324 +
  3325 + var textArrVal = $rootScope.TextPropertyArray[i].Rect_Text;
  3326 + $("#text_area").val(textArrVal);
  3327 + var fontStyleProp = $rootScope.TextPropertyArray[i].FontStyle;
  3328 + var fontWeightProp = fontStyleProp.split(" ");
  3329 +
  3330 + $("#text_area").css("font-size", $rootScope.TextPropertyArray[i].FontSize);
  3331 + $("#text_area").css("font-weight", fontWeightProp[0]);
  3332 + $("#text_area").css("font-style", fontWeightProp[1]);
  3333 + $("#text_area").css("text-align", $rootScope.TextPropertyArray[i].Align);
  3334 + $("#text_area").css("color", $rootScope.TextPropertyArray[i].FontColor);
  3335 + $("#text_area").css("font-family", $rootScope.TextPropertyArray[i].FontFamily);
  3336 + $("#text_area").css("text-decoration", $rootScope.TextPropertyArray[i].TextDecoration);
  3337 + $("#font-color .minicolors .minicolors-swatch .minicolors-swatch-color").css({ "background-color": $rootScope.TextPropertyArray[i].FontColor });
  3338 +
  3339 + var CurrentFontFamily = $rootScope.TextPropertyArray[i].FontFamily;
  3340 + var CurrentFontSize = parseInt($rootScope.TextPropertyArray[i].FontSize);
  3341 + $("#selected-font-family option[value=" + CurrentFontFamily + "]").prop('selected', true);
  3342 + $("#selected-font-size option[value=" + CurrentFontSize + "]").prop('selected', true);
  3343 +
  3344 + CurrentFontFamily = '';
  3345 + CurrentFontSize = '';
  3346 +
  3347 +
  3348 + if ($rootScope.TextPropertyArray[i].TextDecoration == "underline") {
  3349 +
  3350 + $("#text-underline").addClass("ActiveFormattingButtonClass");
  3351 +
  3352 + }
  3353 +
  3354 + else {
  3355 +
  3356 + $("#text-underline").removeClass("ActiveFormattingButtonClass");
  3357 +
  3358 + }
  3359 +
  3360 + //adding text font weight active class in text edit pop-up
  3361 +
  3362 + if (fontWeightProp[0] == 700) {
  3363 +
  3364 + $("#text-bold").addClass("ActiveFormattingButtonClass");
  3365 +
  3366 + }
  3367 +
  3368 + else {
  3369 +
  3370 + $("#text-bold").removeClass("ActiveFormattingButtonClass");
  3371 +
  3372 + }
  3373 +
  3374 + //adding text font style active class in text edit pop-up
  3375 +
  3376 + if (fontWeightProp[1] == "italic") {
  3377 +
  3378 +
  3379 + $("#text-italic").addClass("ActiveFormattingButtonClass");
  3380 + }
  3381 + else {
  3382 + $("#text-italic").removeClass("ActiveFormattingButtonClass");
  3383 +
  3384 +
  3385 + }
  3386 +
  3387 + //adding text alignment active class in text edit pop-up
  3388 +
  3389 + if ($rootScope.TextPropertyArray[i].Align == "left") {
  3390 +
  3391 + $("#text-right").removeClass("ActiveFormattingButtonClass");
  3392 +
  3393 + $("#text-center").removeClass("ActiveFormattingButtonClass")
  3394 +
  3395 + $("#text-left").addClass("ActiveFormattingButtonClass");
  3396 +
  3397 + }
  3398 +
  3399 + else if ($rootScope.TextPropertyArray[i].Align == "right") {
  3400 +
  3401 +
  3402 +
  3403 + $("#text-center").removeClass("ActiveFormattingButtonClass")
  3404 +
  3405 + $("#text-left").removeClass("ActiveFormattingButtonClass");
  3406 +
  3407 + $("#text-right").addClass("ActiveFormattingButtonClass");
  3408 + }
  3409 +
  3410 + else if ($rootScope.TextPropertyArray[i].Align == "center") {
  3411 +
  3412 + $("#text-left").removeClass("ActiveFormattingButtonClass");
  3413 +
  3414 + $("#text-right").removeClass("ActiveFormattingButtonClass");
  3415 +
  3416 + $("#text-center").addClass("ActiveFormattingButtonClass");
  3417 +
  3418 + }
  3419 +
  3420 + }
  3421 + else {
  3422 + // alert("no");
  3423 +
  3424 + }
  3425 +
  3426 + }
  3427 +
  3428 +
  3429 + // _rectLayerOnSaveSplitInt = '';
  3430 + textArrVal = '';
  3431 + $("#annotationTextModal").css("padding-right", "0px");
  3432 + document.getElementById('modelbackground').style.display = "block";
  3433 + $("#annotationTextModal").modal("toggle");
  3434 +
  3435 + // $("#selected-font-family").val(CurrentFontFamily);
  3436 + // $("#selected-font-size").val(CurrentFontSize);
  3437 + }
  3438 + else {
  3439 + //jcanvas property
  3440 + layer.draggable = false;
  3441 + }
  3442 +
  3443 + }
  3444 + },
3192 3445 mouseout: function (layer) {
3193 3446  
3194 3447 if ($rootScope.isAnnotaionToolBarDrawingModeActive == true) {
... ... @@ -3521,6 +3774,138 @@ function ($rootScope, Modules, $log, $location, $timeout, DataService, Authentic
3521 3774 layer.draggable = false;
3522 3775 }
3523 3776 },
  3777 + touchstart: function (layer) {
  3778 +
  3779 + if (isDoubleTouchSaveTextAgain == null) {
  3780 + isDoubleTouchSaveTextAgain = setTimeout(function () {
  3781 + isDoubleTouchSaveTextAgain = null;
  3782 + if ($rootScope.isAnnotaionToolBarDrawingModeActive == true) {
  3783 + //jcanvas property
  3784 + layer.draggable = true;
  3785 + $rootScope.shapeTypeText = "textAreaRect";
  3786 + var layerName = layer.name;
  3787 + var splitedName = layerName.split("_");
  3788 + var textValName = "TextAreaAfterEdit_";
  3789 + var concatinateResult = textValName.concat(splitedName[1]);
  3790 + $rootScope.canvasLayerNameCollection = [];
  3791 + $rootScope.canvasLayerNameCollection.push({ textareaRectangle: layer.name, textareaString: concatinateResult });
  3792 +
  3793 + $('#canvas').setLayer(layer.name, {
  3794 + handle: {
  3795 + type: 'rectangle',
  3796 + fillStyle: '#fff',
  3797 + strokeStyle: '#c33',
  3798 + strokeWidth: 2,
  3799 + width: 5, height: 5,
  3800 + cornerRadius: 3,
  3801 + }
  3802 + }).drawLayers();
  3803 + }
  3804 + else {
  3805 + //jcanvas property
  3806 + layer.draggable = false;
  3807 + }
  3808 +
  3809 + }, 1000)
  3810 + } else {
  3811 + clearTimeout(isDoubleTouchSaveTextAgain);
  3812 + isDoubleTouchSaveTextAgain = null;
  3813 + if ($rootScope.isAnnotaionToolBarDrawingModeActive == true) {
  3814 + //jcanvas property
  3815 + layer.draggable = true;
  3816 + $rootScope.isTextAreaClosedButtonActive = false;
  3817 + $rootScope.IsTextAlreadySave = true;
  3818 + var _rectLayerOnSave = layer.name;
  3819 + var _rectLayerOnSaveSplit = _rectLayerOnSave.split("_");
  3820 + var RectNameAfterEdit = "TextAreaAfterEdit_";
  3821 + var RectNameAfterEditResult = RectNameAfterEdit.concat(_rectLayerOnSaveSplit[1]);
  3822 + $rootScope.modifySavedTextIndexNumber = _rectLayerOnSaveSplit[1];
  3823 +
  3824 + $rootScope.layerNameArr = layer.name;
  3825 + $rootScope.rectTextArr = RectNameAfterEditResult;
  3826 +
  3827 + $rootScope.rectDimension.push({ width: layer.width, height: layer.height, x: layer.x, y: layer.y });
  3828 + $("#text_area").val(_modifiedText);
  3829 + $("#text_area").css("font-size", _modifiedFontSize);
  3830 + $("#text_area").css("font-weight", _modifiedFontWeight);
  3831 + $("#text_area").css("font-style", _modifiedFontStyle);
  3832 + $("#text_area").css("text-align", _modifiedTextAlign);
  3833 + $("#text_area").css("color", _modifiedFontColor);
  3834 + $("#text_area").css("font-family", _modifiedFontFamily);
  3835 + $("#text_area").css("text-decoration", _modifiedFontDecoration);
  3836 + $("#font-color .minicolors .minicolors-swatch .minicolors-swatch-color").css({ "background-color": _modifiedFontColor });
  3837 +
  3838 + // $(".ActiveDefaultColorAnnotation").css({ "background-color": _modifiedFontColor + "!important" });
  3839 + // $("#font-color .minicolors .minicolors-swatch .minicolors-swatch-color").addClass("ActiveDefaultColorAnnotation");
  3840 +
  3841 + //khushbu
  3842 + var CurrentFontFamily = _modifiedFontFamily;
  3843 + // alert(CurrentFontFamily);
  3844 + // CurrentFontFamily = CurrentFontFamily.replace(/'/g, "");
  3845 + var CurrentFontSize = parseInt(_modifiedFontSize);
  3846 + $("#selected-font-family option[value=" + CurrentFontFamily + "]").prop('selected', true);
  3847 + $("#selected-font-size option[value=" + CurrentFontSize + "]").prop('selected', true);
  3848 + CurrentFontFamily = '';
  3849 + CurrentFontSize = '';
  3850 + //adding text text decoration active class in text edit pop-up
  3851 + if (_modifiedFontDecoration == "underline") {
  3852 + $("#text-underline").addClass("ActiveFormattingButtonClass");
  3853 + }
  3854 + else {
  3855 + $("#text-underline").removeClass("ActiveFormattingButtonClass");
  3856 + }
  3857 +
  3858 + //adding text font weight active class in text edit pop-up
  3859 + if (_modifiedFontWeight == 700) {
  3860 +
  3861 + $("#text-bold").addClass("ActiveFormattingButtonClass");
  3862 + }
  3863 + else {
  3864 +
  3865 + $("#text-bold").removeClass("ActiveFormattingButtonClass");
  3866 +
  3867 + }
  3868 +
  3869 + //adding text font style active class in text edit pop-up
  3870 + if (_modifiedFontStyle == "italic") {
  3871 +
  3872 + $("#text-italic").addClass("ActiveFormattingButtonClass");
  3873 + }
  3874 + else {
  3875 + $("#text-italic").removeClass("ActiveFormattingButtonClass");
  3876 +
  3877 + }
  3878 +
  3879 + //adding text alignment active class in text edit pop-up
  3880 + if (_modifiedTextAlign == "left") {
  3881 + $("#text-right").removeClass("ActiveFormattingButtonClass");
  3882 + $("#text-center").removeClass("ActiveFormattingButtonClass")
  3883 + $("#text-left").addClass("ActiveFormattingButtonClass");
  3884 + }
  3885 + else if (_modifiedTextAlign == "right") {
  3886 +
  3887 + $("#text-center").removeClass("ActiveFormattingButtonClass")
  3888 + $("#text-left").removeClass("ActiveFormattingButtonClass");
  3889 + $("#text-right").addClass("ActiveFormattingButtonClass");
  3890 +
  3891 + }
  3892 + else if (_modifiedTextAlign == "center") {
  3893 + $("#text-left").removeClass("ActiveFormattingButtonClass");
  3894 + $("#text-right").removeClass("ActiveFormattingButtonClass");
  3895 + $("#text-center").addClass("ActiveFormattingButtonClass");
  3896 +
  3897 + }
  3898 +
  3899 + document.getElementById('modelbackground').style.display = "block";
  3900 + $("#annotationTextModal").modal("toggle");
  3901 + }
  3902 + else {
  3903 + //jcanvas property
  3904 + layer.draggable = false;
  3905 + }
  3906 +
  3907 + }
  3908 + },
3524 3909 mouseout: function (layer) {
3525 3910 if ($rootScope.isAnnotaionToolBarDrawingModeActive == true) {
3526 3911 //jcanvas property
... ... @@ -4652,7 +5037,15 @@ function ($rootScope, Modules, $log, $location, $timeout, DataService, Authentic
4652 5037 $("#cursor-block").html();
4653 5038  
4654 5039 }
  5040 + var $ue = navigator.userAgent;
  5041 + if (($ue.match(/(iPod|iPhone|iPad|android)/i))) {
4655 5042  
  5043 + $("#text_area").click(function () {
  5044 + $("#annotationTextModal").draggable('disable');
  5045 + }).blur(function () {
  5046 + $("#annotationTextModal").draggable('enable');
  5047 + });
  5048 + }
4656 5049 $rootScope.CheckRefresh = function (e) {
4657 5050 //Checking if 'REFRESHED' or 'RELOADED'
4658 5051 if ((e.keyCode === 116) || (e.keyCode == 82 && e.ctrlKey))
... ...