Commit dd601b777a778ad21f6a2325b275e7db6ab88ad9
1 parent
744cfacf
fix bug in annotation tools
Showing
4 changed files
with
62 additions
and
34 deletions
400-SOURCECODE/AIAHTML5.Web/app/controllers/DAController.js
... | ... | @@ -8720,7 +8720,13 @@ AIA.controller("DAController", ["$scope", "$rootScope", "$compile", "$http", "$l |
8720 | 8720 | $scope.SetwindowStoreData(windowviewid,'zoomInOut',25); |
8721 | 8721 | $('#zoomValueDA_' + windowviewid).attr('value', $scope.GetwindowStoreData(windowviewid,'zoomInOut')); |
8722 | 8722 | } |
8723 | - | |
8723 | + $rootScope.isLoading = true; | |
8724 | + $('#spinner').css('visibility', 'visible'); | |
8725 | + var canDiv = document.getElementById('canvasDivDA_' + windowviewid); | |
8726 | + var canDivChildCount = canDiv.childElementCount; | |
8727 | + if (canDivChildCount > 0) { | |
8728 | + canDiv.innerHTML = ''; | |
8729 | + } | |
8724 | 8730 | var viewOrientationId = $scope.GetwindowStoreData(windowviewid, 'viewOrientationId'); |
8725 | 8731 | $scope.CalculateImageCordinates(viewOrientationId,windowviewid); |
8726 | 8732 | ... | ... |
400-SOURCECODE/AIAHTML5.Web/app/controllers/HomeController.js
... | ... | @@ -2660,7 +2660,10 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data |
2660 | 2660 | } |
2661 | 2661 | $rootScope.CIAnotationIdentifyModeOff = false; |
2662 | 2662 | $rootScope.OnIdentifyClick = function () { |
2663 | - | |
2663 | + //clear sketch js event for paint and erase | |
2664 | + $.sketch = { tools: {}}; | |
2665 | + $rootScope.shapeType = ""; | |
2666 | + $(".btn-annotation").removeClass("activebtncolor"); | |
2664 | 2667 | $("#OnIdentify").addClass("annotationtoolbartab"); |
2665 | 2668 | $("#DrawMode").removeClass("annotationtoolbartab"); |
2666 | 2669 | |
... | ... | @@ -2842,7 +2845,8 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data |
2842 | 2845 | } |
2843 | 2846 | |
2844 | 2847 | $rootScope.DrawingMode = function () { |
2845 | - | |
2848 | + //clear sketch js event for paint and erase | |
2849 | + $.sketch = { tools: {}}; | |
2846 | 2850 | //Annotation History |
2847 | 2851 | $rootScope.isAnnotaionToolBarDrawingModeActive = true; |
2848 | 2852 | $("#OnIdentify").removeClass("annotationtoolbartab"); |
... | ... | @@ -2917,6 +2921,8 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data |
2917 | 2921 | //----Annotation Toolbar: Jcanvas----- |
2918 | 2922 | |
2919 | 2923 | $rootScope.DrawLine = function (e) { |
2924 | + //clear sketch js event for paint and erase | |
2925 | + $.sketch = { tools: {}}; | |
2920 | 2926 | $('.btnCursor').removeClass('activebtncolor'); |
2921 | 2927 | $(".btn-annotation").removeClass("activebtncolor"); |
2922 | 2928 | $(".btn-annotation-line").addClass("activebtncolor"); |
... | ... | @@ -2980,7 +2986,8 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data |
2980 | 2986 | } |
2981 | 2987 | |
2982 | 2988 | $rootScope.DrawPin = function (e) { |
2983 | - | |
2989 | + //clear sketch js event for paint and erase | |
2990 | + $.sketch = { tools: {}}; | |
2984 | 2991 | $('.btnCursor').removeClass('activebtncolor'); |
2985 | 2992 | $(".btn-annotation").removeClass("activebtncolor"); |
2986 | 2993 | $(".btn-annotation-pin").addClass("activebtncolor"); |
... | ... | @@ -3022,7 +3029,9 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data |
3022 | 3029 | |
3023 | 3030 | } |
3024 | 3031 | |
3025 | - $rootScope.Cursor = function () { | |
3032 | + $rootScope.Cursor = function () { | |
3033 | + //clear sketch js event for paint and erase | |
3034 | + $.sketch = { tools: {}}; | |
3026 | 3035 | $rootScope.shapeType = "cursor"; |
3027 | 3036 | $(".btn-annotation").removeClass("activebtncolor"); |
3028 | 3037 | // $("#" + e.currentTarget.id).removeClass("activebtncolor"); |
... | ... | @@ -3051,7 +3060,8 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data |
3051 | 3060 | } |
3052 | 3061 | |
3053 | 3062 | $rootScope.DrawRectangle = function (e) { |
3054 | - | |
3063 | + //clear sketch js event for paint and erase | |
3064 | + $.sketch = { tools: {}}; | |
3055 | 3065 | $('.btnCursor').removeClass('activebtncolor'); |
3056 | 3066 | $(".btn-annotation").removeClass("activebtncolor"); |
3057 | 3067 | $(".btn-annotation-rectangle").addClass("activebtncolor"); |
... | ... | @@ -3152,13 +3162,12 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data |
3152 | 3162 | } |
3153 | 3163 | |
3154 | 3164 | $rootScope.shapeType = "FreeStylePaint"; |
3155 | - var btnBrushSizeValue = $("#btnBrushSize").val(); | |
3156 | - $rootScope.shapeSize = parseInt(btnBrushSizeValue); | |
3157 | - $("#annotationpaintbrushsize").attr("data-size", $rootScope.shapeSize); | |
3165 | + | |
3166 | + $("#annotationpaintbrushsize").attr("data-size", parseInt($("#btnBrushSize").val())); | |
3158 | 3167 | |
3159 | 3168 | $("#annotationpaintbrushsize").attr("data-color", $rootScope.shapestyleColorWithOpacity); |
3160 | 3169 | |
3161 | - if ($rootScope.shapeSize == '') { | |
3170 | + if (parseInt($("#btnBrushSize").val()) <1) { | |
3162 | 3171 | $("#" + canvasPaintId).sketch({ defaultSize: 1}); |
3163 | 3172 | } |
3164 | 3173 | else { |
... | ... | @@ -3195,12 +3204,10 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data |
3195 | 3204 | |
3196 | 3205 | $rootScope.isAnnotaionToolBarDrawingModeActive = true; |
3197 | 3206 | $rootScope.switchCanvasToPaintCanvas(paneld); |
3198 | - var btneraseBrushSizeValue = $("#btnBrushSize").val(); | |
3199 | - $rootScope.shapeSize = parseInt(btneraseBrushSizeValue); | |
3200 | 3207 | |
3201 | 3208 | $('#' + canvasPaintId).sketch(); |
3202 | 3209 | |
3203 | - $("#annotationpainteraser").attr("data-size", $rootScope.shapeSize); | |
3210 | + $("#annotationpainteraser").attr("data-size", parseInt($("#btnBrushSize").val())); | |
3204 | 3211 | $scope.PaintEraseEvent(); |
3205 | 3212 | } |
3206 | 3213 | } |
... | ... | @@ -3219,14 +3226,14 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data |
3219 | 3226 | this.stopPainting(); |
3220 | 3227 | } |
3221 | 3228 | this.color= $rootScope.shapestyleColorWithOpacity!=undefined ? $rootScope.shapestyleColorWithOpacity : "#fff"; |
3222 | - this.size=$rootScope.shapeSize; | |
3229 | + this.size= parseInt($("#btnBrushSize").val()); | |
3223 | 3230 | if ($("#annotationpaintbrushsize").hasClass("activebtncolor")) { |
3224 | 3231 | this.tool='marker'; |
3225 | 3232 | this.startPainting(); |
3226 | 3233 | } |
3227 | 3234 | else if ($("#annotationpainteraser").hasClass("activebtncolor")) { |
3228 | 3235 | this.tool='eraser'; |
3229 | - this.size=$rootScope.shapeSize>5?$rootScope.shapeSize:5; | |
3236 | + this.size=parseInt($("#btnBrushSize").val())>5?parseInt($("#btnBrushSize").val()):5; | |
3230 | 3237 | this.startPainting(); |
3231 | 3238 | } |
3232 | 3239 | else |
... | ... | @@ -3360,7 +3367,9 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data |
3360 | 3367 | } |
3361 | 3368 | } |
3362 | 3369 | |
3363 | - $rootScope.DrawCircle = function (e) { | |
3370 | + $rootScope.DrawCircle = function (e) { | |
3371 | + //clear sketch js event for paint and erase | |
3372 | + $.sketch = { tools: {}}; | |
3364 | 3373 | $('.btnCursor').removeClass('activebtncolor'); |
3365 | 3374 | $(".btn-annotation").removeClass("activebtncolor"); |
3366 | 3375 | $(".btn-annotation-circle").addClass("activebtncolor"); |
... | ... | @@ -3402,6 +3411,8 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data |
3402 | 3411 | } |
3403 | 3412 | |
3404 | 3413 | $rootScope.DrawArrow = function (e) { |
3414 | + //clear sketch js event for paint and erase | |
3415 | + $.sketch = { tools: {}}; | |
3405 | 3416 | $('.btnCursor').removeClass('activebtncolor'); |
3406 | 3417 | $(".btn-annotation").removeClass("activebtncolor"); |
3407 | 3418 | $(".btn-annotation-arrow").addClass("activebtncolor"); |
... | ... | @@ -3442,6 +3453,8 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data |
3442 | 3453 | } |
3443 | 3454 | } |
3444 | 3455 | $rootScope.DrawText = function () { |
3456 | + //clear sketch js event for paint and erase | |
3457 | + $.sketch = { tools: {}}; | |
3445 | 3458 | $('.btnCursor').removeClass('activebtncolor'); |
3446 | 3459 | $(".btn-annotation").removeClass("activebtncolor"); |
3447 | 3460 | $(".btn-annotation-Text").addClass("activebtncolor"); |
... | ... | @@ -3484,6 +3497,8 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data |
3484 | 3497 | } |
3485 | 3498 | |
3486 | 3499 | $rootScope.DrawPolygon = function () { |
3500 | + //clear sketch js event for paint and erase | |
3501 | + $.sketch = { tools: {}}; | |
3487 | 3502 | $("#OnIdentify").removeClass('annotationtoolbartab'); |
3488 | 3503 | $("#DrawMode").addClass('annotationtoolbartab'); |
3489 | 3504 | |
... | ... | @@ -4516,7 +4531,7 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data |
4516 | 4531 | strokeStyle: shapestyleborderColor, |
4517 | 4532 | strokeWidth: shapestyleborderWidth, |
4518 | 4533 | rounded: true, |
4519 | - startArrow: true, | |
4534 | + endArrow: true, | |
4520 | 4535 | arrowRadius: 7, |
4521 | 4536 | arrowAngle: 90, |
4522 | 4537 | x1: offsetX1, y1: offsetY1, |
... | ... | @@ -4778,7 +4793,7 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data |
4778 | 4793 | strokeStyle: 'grey', |
4779 | 4794 | strokeWidth: shapestyleborderWidth, |
4780 | 4795 | fillStyle: radial, |
4781 | - x: offsetX1, y: offsetY1, | |
4796 | + x: x, y: y, | |
4782 | 4797 | radius: 5, |
4783 | 4798 | add: function (layer) { |
4784 | 4799 | layer.draggable = false; |
... | ... | @@ -5641,7 +5656,7 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data |
5641 | 5656 | |
5642 | 5657 | //Birendra updated due to some issue |
5643 | 5658 | $rootScope.OnPaintCanvasMouseDown = function (event) { |
5644 | - event.preventDefault(); | |
5659 | + event.preventDefault(); | |
5645 | 5660 | if ($rootScope.isAnnotatiomToolBarPopupClosed == false) { |
5646 | 5661 | if ($rootScope.shapeType==undefined || $rootScope.shapeType=='cursor'||$rootScope.shapeType=="") { |
5647 | 5662 | return; |
... | ... | @@ -5688,12 +5703,13 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data |
5688 | 5703 | //Birendra updated due to some issue |
5689 | 5704 | $rootScope.OnPaintCanvasMouseUp = function (event) { |
5690 | 5705 | event.preventDefault(); |
5706 | + | |
5691 | 5707 | if ($rootScope.isAnnotatiomToolBarPopupClosed == false) { |
5692 | 5708 | if ($rootScope.shapeType==undefined || $rootScope.shapeType=='cursor'||$rootScope.shapeType=="") { |
5693 | 5709 | return; |
5694 | 5710 | } |
5695 | 5711 | $rootScope.clicked=false; |
5696 | - if (isDrawing === true) { | |
5712 | + if (isDrawing === true) { | |
5697 | 5713 | isDrawing = false; |
5698 | 5714 | $(".line").remove(); |
5699 | 5715 | $(".arrow").remove(); |
... | ... | @@ -5820,7 +5836,7 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data |
5820 | 5836 | if ($rootScope.shapeType==undefined || $rootScope.shapeType=='cursor'||$rootScope.shapeType=="") { |
5821 | 5837 | return; |
5822 | 5838 | } |
5823 | - if ($rootScope.clicked == true) { | |
5839 | + if ($rootScope.clicked == true) { | |
5824 | 5840 | var canvasElement=event.target; |
5825 | 5841 | if (canvasElement!= null || canvasElement != undefined) |
5826 | 5842 | { |
... | ... | @@ -5828,7 +5844,7 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data |
5828 | 5844 | if (canvasId != null ||canvasId != undefined) |
5829 | 5845 | { |
5830 | 5846 | if(canvasId.match("canvasDA")||canvasId.match("canvasAA")||canvasId.match("canvasCI")||canvasId.match("canvasAI")||canvasId.match("canvasPIC")) |
5831 | - { | |
5847 | + { | |
5832 | 5848 | var canvasDiv = (event.target.parentElement); |
5833 | 5849 | var canvasDivId = canvasDiv.id; |
5834 | 5850 | isDrawing = true; |
... | ... | @@ -5841,19 +5857,19 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data |
5841 | 5857 | case "Line": |
5842 | 5858 | $(".line").remove(); |
5843 | 5859 | $rootScope.isLinePreviewCompleted = true; |
5844 | - $("#" + canvasDivId).append("<div class='line' style='z-index:12001;border:1px dashed #000000;position:absolute;left:" + $rootScope.offsetX1 + "px;top:" + $rootScope.offsetY1 + "px;'></div>"); | |
5860 | + $("#" + canvasDivId).append("<div class='line' style='z-index:12001;border:1px dashed #000000;position:absolute;left:" + $rootScope.offsetX1 + "px;top:" + ($rootScope.offsetY1+5) + "px;'></div>"); | |
5845 | 5861 | $rootScope.Annotationangle(); |
5846 | 5862 | break; |
5847 | 5863 | case "Arrow": |
5848 | 5864 | $(".arrow").remove(); |
5849 | 5865 | $rootScope.isArrowPreviewCompleted = true; |
5850 | - $("#" + canvasDivId).append("<div class='arrow' style='z-index:12001;border:1px dashed #000000;position:absolute;left:" + $rootScope.offsetX1 + "px;top:" + $rootScope.offsetY1 + "px;width:" + Math.abs($rootScope.MouseMoveXAxis - $rootScope.offsetX1) + "px;'><div style='border-bottom: 9px solid transparent;border-right: 12px dashed #ccc;border-top: 7px solid transparent;height: 0;left: -6px;position: absolute;top: -8px;width: 0;'></div></div>"); | |
5866 | + $("#" + canvasDivId).append("<div class='arrow' style='z-index:12001;border:1px dashed #000000;position:absolute;left:" + $rootScope.offsetX1 + "px;top:" + ($rootScope.offsetY1+5) + "px;width:" + Math.abs($rootScope.MouseMoveXAxis - $rootScope.offsetX1) + "px;'><div class='arrowPoint' style='border-bottom: 9px solid transparent;border-left: 12px dashed #ccc;border-top: 7px solid transparent;height: 0;left:" + Math.abs($rootScope.MouseMoveXAxis - $rootScope.offsetX1) + "px;position: absolute;top: -8px;width: 0;'></div></div>"); | |
5851 | 5867 | $rootScope.Annotationangle(); |
5852 | 5868 | break; |
5853 | 5869 | case "Pin": |
5854 | 5870 | $(".pin").remove(); |
5855 | 5871 | $rootScope.isPinPreviewCompleted = true; |
5856 | - $("#" + canvasDivId).append("<div class='pin' style='z-index:12001;border:1px dashed #000000;position:absolute;left:" + $rootScope.offsetX1 + "px;top:" + $rootScope.offsetY1 + "px;width:" + Math.abs($rootScope.MouseMoveXAxis - $rootScope.offsetX1) + "px;'><div style='background-color:#fff;left: -8px;position: absolute;top: -6px;width: 10;height:12px;width:12px;border:2px dashed #808080;border-radius:50%;'></div></div>"); | |
5872 | + $("#" + canvasDivId).append("<div class='pin' style='z-index:12001;border:1px dashed #000000;position:absolute;left:" + $rootScope.offsetX1 + "px;top:" + ($rootScope.offsetY1+5) + "px;width:" + Math.abs($rootScope.MouseMoveXAxis - $rootScope.offsetX1) + "px;'><div class='pinPoint' style='background-color:#fff;left:" + Math.abs($rootScope.MouseMoveXAxis - $rootScope.offsetX1) + "px;position: absolute;top: -6px;height:12px;width:12px;border:2px dashed #808080;border-radius:50%;'></div></div>"); | |
5857 | 5873 | $rootScope.Annotationangle(); |
5858 | 5874 | break; |
5859 | 5875 | case "Circle": |
... | ... | @@ -5917,9 +5933,11 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data |
5917 | 5933 | break; |
5918 | 5934 | case "Arrow": |
5919 | 5935 | $('.arrow').css({ 'transform': 'rotate(' + theta + 'deg)', '-moz-transform': 'rotate(' + theta + 'deg)', '-webkit-transform': 'rotate(' + theta + 'deg)', 'transform-origin': '0% 0%', 'width': dottedLineWidth + 'px' }); |
5936 | + $('.arrowPoint').css({ 'left': dottedLineWidth + 'px' }); | |
5920 | 5937 | break; |
5921 | 5938 | case "Pin": |
5922 | 5939 | $('.pin').css({ 'transform': 'rotate(' + theta + 'deg)', '-moz-transform': 'rotate(' + theta + 'deg)', '-webkit-transform': 'rotate(' + theta + 'deg)', 'transform-origin': '0% 0%', 'width': dottedLineWidth + 'px' }); |
5940 | + $('.pinPoint').css({ 'left': dottedLineWidth + 'px' }); | |
5923 | 5941 | break; |
5924 | 5942 | case "Circle": |
5925 | 5943 | var classname=".circle" | ... | ... |
400-SOURCECODE/AIAHTML5.Web/index.aspx
... | ... | @@ -1807,12 +1807,12 @@ |
1807 | 1807 | <script> |
1808 | 1808 | $(function () { |
1809 | 1809 | function onBrushSizeChange() { |
1810 | - $('.btnCursor').trigger('click'); | |
1811 | - $('.btnCursor').addClass('activebtncolor'); | |
1812 | - $(".btn-annotation").removeClass("activebtncolor"); | |
1813 | - $(".btn-annotation-erase").removeClass("activebtncolor"); | |
1814 | - $(".btn-annotation-erase").removeClass("activebtncolor"); | |
1815 | - $(".annotationpaintbrushsize").removeClass("activebtncolor"); | |
1810 | + //$('.btnCursor').trigger('click'); | |
1811 | + // $('.btnCursor').addClass('activebtncolor'); | |
1812 | + // $(".btn-annotation").removeClass("activebtncolor"); | |
1813 | + // $(".btn-annotation-erase").removeClass("activebtncolor"); | |
1814 | + // $(".btn-annotation-erase").removeClass("activebtncolor"); | |
1815 | + // $(".annotationpaintbrushsize").removeClass("activebtncolor"); | |
1816 | 1816 | var x = $('#canvasPaint').css("z-index"); |
1817 | 1817 | |
1818 | 1818 | var y = $('#canvas').css("z-index"); | ... | ... |
400-SOURCECODE/AIAHTML5.Web/libs/sketch.js
... | ... | @@ -106,9 +106,13 @@ var __slice = Array.prototype.slice; |
106 | 106 | e.pageX = e.originalEvent.targetTouches[0].pageX; |
107 | 107 | e.pageY = e.originalEvent.targetTouches[0].pageY; |
108 | 108 | } |
109 | - $.sketch.tools[$(this).data('sketch').tool].onEvent.call($(this).data('sketch'), e); | |
110 | - e.preventDefault(); | |
111 | - return false; | |
109 | + if($.sketch.tools[$(this).data('sketch').tool]!=undefined) //Birendra-after paint/erase create problem while drawing other shape | |
110 | + { | |
111 | + $.sketch.tools[$(this).data('sketch').tool].onEvent.call($(this).data('sketch'), e); | |
112 | + e.preventDefault(); | |
113 | + return false; | |
114 | + } | |
115 | + | |
112 | 116 | }; |
113 | 117 | Sketch.prototype.redraw = function() { |
114 | 118 | var sketch; | ... | ... |