diff --git a/400-SOURCECODE/AIAHTML5.Web/app/controllers/HomeController.js b/400-SOURCECODE/AIAHTML5.Web/app/controllers/HomeController.js index fd51bbf..0a0a338 100644 --- a/400-SOURCECODE/AIAHTML5.Web/app/controllers/HomeController.js +++ b/400-SOURCECODE/AIAHTML5.Web/app/controllers/HomeController.js @@ -65,6 +65,13 @@ AIA.controller("HomeController", ["$rootScope", "Modules", "$log", "$location", $rootScope.isEraseToolSelected = false; $rootScope.isMousedownOnPaintCanvas = false; + //opacity code + $rootScope.shapestyleOpacity = 1; + $rootScope.shapestyleFillColor = "#fff"; + $rootScope.shapestyleFillBorderColor = "black"; + $rootScope.shapestyleborderWidth = 2; + $rootScope.shapestyleborderStyles = "solid"; + $rootScope.$on("$locationChangeSuccess", function () { if (($location.url() == "/da-body-view") || ($location.url() == "/clinical-illustrations-detail") || ($location.url() == "/clinical-animations-detail")) { @@ -140,16 +147,6 @@ AIA.controller("HomeController", ["$rootScope", "Modules", "$log", "$location", } } - // $rootScope.DrawLine = function () { - //$rootScope.isIdetifyClicked = false; - //$rootScope.isDrawingToolSelected = true; - //$rootScope.isLineDrawSelecyed = true; - // $rootScope.shapeType = "Line"; - // alert($rootScope.shapeType); - - - // } - $rootScope.ClearIframe = function () { if ($('#daImagePanel') != null) $('#daImagePanel').remove(); @@ -287,14 +284,12 @@ AIA.controller("HomeController", ["$rootScope", "Modules", "$log", "$location", $('#modal-settings').modal('toggle'); } - } - - //----Annotation Toolbar: Jcanvas----- - $rootScope.DrLine = function (e) { + $rootScope.DrawLine = function (e) + { $rootScope.setListManagerZindex = true; $("#canvasPaint").css("display", "block"); $("#canvas").css("display", "block"); @@ -302,7 +297,6 @@ AIA.controller("HomeController", ["$rootScope", "Modules", "$log", "$location", $rootScope.switchCanvas(); $rootScope.shapeType = "Line"; - $('.btnCursor').removeClass('activebtncolor'); $(".btn-annotation").removeClass("activebtncolor"); $(".btn-annotation-line").addClass("activebtncolor"); @@ -311,7 +305,7 @@ AIA.controller("HomeController", ["$rootScope", "Modules", "$log", "$location", } - $rootScope.DrPin = function (e) { + $rootScope.DrawPin = function (e) { $("#canvasPaint").css("display", "block"); $("#canvas").css("display", "block"); @@ -386,13 +380,8 @@ AIA.controller("HomeController", ["$rootScope", "Modules", "$log", "$location", } - - // $('#canvasPaint').sketch(); - - } - } @@ -441,23 +430,16 @@ AIA.controller("HomeController", ["$rootScope", "Modules", "$log", "$location", $('.btnCursor').removeClass('activebtncolor'); $(".btn-annotation").removeClass("activebtncolor"); $(".btn-annotation-Text").addClass("activebtncolor"); - // $("#text_area").val(''); - // $("#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" }); - } + } $rootScope.DrawPolygon = function () { $rootScope.setListManagerZindex = true; $("#canvasPaint").css("display", "block"); $("#canvas").css("display", "block"); $rootScope.shapeType = "DrawPolygon"; - } - $rootScope.OpacityModal = function () { - - - } $rootScope.switchCanvas = function () { var x = $('#canvasPaint').css("z-index"); @@ -471,25 +453,12 @@ AIA.controller("HomeController", ["$rootScope", "Modules", "$log", "$location", } $rootScope.EraseDrawing = function () { $rootScope.switchCanvas(); - $rootScope.isEraseToolSelected = true; - //$rootScope.switchCanvasToPaintCanvas(); - //// $('#canvasPaint').sketch({ defaultColor: "yellow", defaultSize: 1 }); - //var sktch = $('#canvasPaint').sketch(); - //$('#canvasPaint').sketch().actions = []; // this line empties the actions. - //var myCanvas = document.getElementById("canvasPaint"); - //var ctx = myCanvas.getContext('2d'); - //ctx.clearRect(0, 0, myCanvas.width, myCanvas.height); - //$rootScope.switchCanvas(); - + $rootScope.isEraseToolSelected = true; } - //opacity code - $rootScope.shapestyleOpacity = 1; - $rootScope.shapestyleFillColor = "#fff"; - $rootScope.shapestyleFillBorderColor = "black"; - $rootScope.shapestyleborderWidth = 2; - $rootScope.shapestyleborderStyles = "solid"; - $rootScope.shapestyle = function (id) { + + $rootScope.setPropertiesForShapes = function (id) { + if ((document.getElementById('fill-option').checked == false) && (document.getElementById('Outline-Option').checked == false)) { // $('#btnShapeStyle').attr('disabled', 'disabled'); @@ -504,21 +473,18 @@ AIA.controller("HomeController", ["$rootScope", "Modules", "$log", "$location", $("#shapeStyleDiv").css("background-color", $rootScope.shapestyleFillColor); $rootScope.shapestyleborderColor = $("#" + id).parent().css("border-top-color"); $("#shapeStyleDiv").parent().css("border-color", $rootScope.shapestyleborderColor); - $rootScope.shapestyleborderWidthSeparatingPixel = $("#" + id).parent().css("border-top-width"); - $("#shapeStyleDiv").parent().css("border-width", $rootScope.shapestyleborderWidthSeparatingPixel); - var pixelSeparation = $rootScope.shapestyleborderWidthSeparatingPixel; - var intPart = pixelSeparation.split("p"); + $rootScope.borderDimensions = $("#" + id).parent().css("border-top-width"); + $("#shapeStyleDiv").parent().css("border-width", $rootScope.borderDimensions); + + var borderDimensions = $rootScope.borderDimensions; + var borderDimensionSplitArray = borderDimensions.split("p"); - $rootScope.shapestyleborderWidth = intPart[0]; + $rootScope.shapestyleborderWidth = borderDimensionSplitArray[0]; $rootScope.shapestyleborderStyles = "solid"; $('#editshapestyle').modal('hide'); - // name: 'Circle_' + $rootScope.resetCircle, - - - // $("#canvas").removeLayer("TextRect_" + $rootScope.resetTextRect).drawLayers(); - + //Edit Shape Style popup should open at it's default position $("#modeleditstyle").css({ "left": "40%", "right": "0", "top": "70px" }); } @@ -527,12 +493,10 @@ AIA.controller("HomeController", ["$rootScope", "Modules", "$log", "$location", $rootScope.enableAnnotationToolBar = function () { if ($rootScope.disableAnnotationTB == true) { document.getElementById('modelbackground').style.display = "none"; - //$("#editshapestyle").modal('show'); document.getElementById('modeleditstyle').style.display = "none"; } else { document.getElementById('modelbackground').style.display = "block"; - //$("#editshapestyle").modal('show'); document.getElementById('modeleditstyle').style.display = "block"; if ($('#modeleditstyle').css("display") == "block") { //Check if the modal is already showing var previewOpacity = $('#imgOpacity').css("opacity"); @@ -556,8 +520,6 @@ AIA.controller("HomeController", ["$rootScope", "Modules", "$log", "$location", $(".custom-tooltip-annotation").css('display', 'none'); $("#edit-block").removeClass("custom-tooltip-annotation"); - - } @@ -568,16 +530,11 @@ AIA.controller("HomeController", ["$rootScope", "Modules", "$log", "$location", //Edit Shape Style popup should open at it's default position $("#modeleditstyle").css({ "left": "40%", "right": "0", "top": "70px" }); - } - - - - //----End------------- //--Common code of Annotation Toolbar for CI and DA------- - $rootScope.LineFn = function (canvasId, LineNumber, shapestyleborderColor, shapestyleborderWidth, offsetX1, offsetY1, x, y) { + $rootScope.DrawLineOnModuleItem = function (canvasId, LineNumber, shapestyleborderColor, shapestyleborderWidth, offsetX1, offsetY1, x, y) { $(canvasId).addLayer({ name: 'Line_' + LineNumber, layer: true, @@ -640,8 +597,8 @@ AIA.controller("HomeController", ["$rootScope", "Modules", "$log", "$location", $('.btnCursor').addClass('activebtncolor'); } - $rootScope.RectangleFn = function (canvasId, RectNumber, shapestyleFillColor, shapestyleborderColor, shapestyleOpacity, shapestyleborderWidth, offsetX1, offsetY1, x, y) { - // alert("offsetX:" + offsetX1 + " offsetY:" + offsetY1 + " x:" + x + " y:" + y); + $rootScope.DrawRectangleOnModuleItem = function (canvasId, RectNumber, shapestyleFillColor, shapestyleborderColor, shapestyleOpacity, shapestyleborderWidth, offsetX1, offsetY1, x, y) { + $(canvasId).addLayer({ layer: true, name: 'Rect_' + RectNumber, @@ -657,8 +614,7 @@ AIA.controller("HomeController", ["$rootScope", "Modules", "$log", "$location", resizeFromCenter: true, - dblclick: function () { - // $rootScope.backOpacity(); + dblclick: function () { }, @@ -708,16 +664,13 @@ AIA.controller("HomeController", ["$rootScope", "Modules", "$log", "$location", } }).drawLayers(); - - - $('.btnCursor').trigger('click'); $(".btn-annotation").removeClass("activebtncolor"); $('.btnCursor').addClass('activebtncolor'); } - $rootScope.CircleFn = function (canvasId, CircleNumber, shapestyleOpacity, shapestyleborderColor, shapestyleborderWidth, shapestyleFillColor, offsetX1, offsetY1, x, y) { + $rootScope.DrawCircleOnModuleItem = function (canvasId, CircleNumber, shapestyleOpacity, shapestyleborderColor, shapestyleborderWidth, shapestyleFillColor, offsetX1, offsetY1, x, y) { $(canvasId).addLayer({ layer: true, @@ -732,9 +685,6 @@ AIA.controller("HomeController", ["$rootScope", "Modules", "$log", "$location", width: (x - offsetX1) * 2, height: (y - offsetY1) * 2, // Place a handle at each side and each corner handlePlacement: 'both', - - - click: function (layer) { $rootScope.canvasLayerNameCollection = []; @@ -787,7 +737,7 @@ AIA.controller("HomeController", ["$rootScope", "Modules", "$log", "$location", $('.btnCursor').addClass('activebtncolor'); } - $rootScope.ArrowFn = function (canvasId, ArrowNumber, shapestyleborderColor, shapestyleborderWidth, offsetX1, offsetY1, x, y) { + $rootScope.DrawArrowOnModuleItem = function (canvasId, ArrowNumber, shapestyleborderColor, shapestyleborderWidth, offsetX1, offsetY1, x, y) { $('#canvas').drawLine({ layer: true, @@ -855,7 +805,7 @@ AIA.controller("HomeController", ["$rootScope", "Modules", "$log", "$location", $('.btnCursor').addClass('activebtncolor'); } - $rootScope.PinFn = function (canvasId, PinNumber, offsetX1, offsetY1, x, y, PinArcNumber) { + $rootScope.DrawPinOnModuleItem = function (canvasId, PinNumber, offsetX1, offsetY1, x, y, PinArcNumber) { var xAxisPinDiff = offsetX1 - x; var yAxisPinDiff = offsetY1 - y; @@ -946,13 +896,7 @@ AIA.controller("HomeController", ["$rootScope", "Modules", "$log", "$location", fillStyle: radial, x: offsetX1, y: offsetY1, radius: 5, - //handle: { - // type: 'arc', - // fillStyle: '#fff', - // strokeStyle: '#c33', - // strokeWidth: 2, - // radius: 3 - //}, + add: function (layer) { @@ -970,7 +914,7 @@ AIA.controller("HomeController", ["$rootScope", "Modules", "$log", "$location", $('.btnCursor').addClass('activebtncolor'); } - $rootScope.TextAreaFn = function (canvasId, TextNumber, offsetX1, offsetY1, resetTextRect, shapestyleOpacity, shapestyleborderColor, shapestyleborderWidth, shapestyleFillColor, x, y) { + $rootScope.TextEditorFunctionality = function (canvasId, TextNumber, offsetX1, offsetY1, resetTextRect, shapestyleOpacity, shapestyleborderColor, shapestyleborderWidth, shapestyleFillColor, x, y) { debugger; @@ -1217,13 +1161,13 @@ AIA.controller("HomeController", ["$rootScope", "Modules", "$log", "$location", //$rootScope.canvasLayerNameCollection = []; $rootScope.LineNumber = $rootScope.ObjectIndex++; - $rootScope.LineFn('#canvas', $rootScope.LineNumber, $rootScope.shapestyleborderColor, $rootScope.shapestyleborderWidth, $rootScope.offsetX1, $rootScope.offsetY1, $rootScope.x, $rootScope.y) + $rootScope.DrawLineOnModuleItem('#canvas', $rootScope.LineNumber, $rootScope.shapestyleborderColor, $rootScope.shapestyleborderWidth, $rootScope.offsetX1, $rootScope.offsetY1, $rootScope.x, $rootScope.y) break; case "Rectangle": $rootScope.rectNumber = $rootScope.ObjectIndex++; - $rootScope.RectangleFn('#canvas', $rootScope.rectNumber, $rootScope.shapestyleFillColor, $rootScope.shapestyleborderColor, $rootScope.shapestyleOpacity, $rootScope.shapestyleborderWidth, $rootScope.offsetX1, $rootScope.offsetY1, $rootScope.x, $rootScope.y); + $rootScope.DrawRectangleOnModuleItem('#canvas', $rootScope.rectNumber, $rootScope.shapestyleFillColor, $rootScope.shapestyleborderColor, $rootScope.shapestyleOpacity, $rootScope.shapestyleborderWidth, $rootScope.offsetX1, $rootScope.offsetY1, $rootScope.x, $rootScope.y); break; @@ -1231,19 +1175,19 @@ AIA.controller("HomeController", ["$rootScope", "Modules", "$log", "$location", // alert($rootScope.shapestyleborderWidth); $rootScope.CircleNumber = $rootScope.ObjectIndex++; - $rootScope.CircleFn('#canvas', $rootScope.CircleNumber, $rootScope.shapestyleOpacity, $rootScope.shapestyleborderColor, $rootScope.shapestyleborderWidth, $rootScope.shapestyleFillColor, $rootScope.offsetX1, $rootScope.offsetY1, $rootScope.x, $rootScope.y); + $rootScope.DrawCircleOnModuleItem('#canvas', $rootScope.CircleNumber, $rootScope.shapestyleOpacity, $rootScope.shapestyleborderColor, $rootScope.shapestyleborderWidth, $rootScope.shapestyleFillColor, $rootScope.offsetX1, $rootScope.offsetY1, $rootScope.x, $rootScope.y); break; case "Arrow": $rootScope.ArrowNumber = $rootScope.ObjectIndex++; - $rootScope.ArrowFn('#canvas', $rootScope.ArrowNumber, $rootScope.shapestyleborderColor, $rootScope.shapestyleborderWidth, $rootScope.offsetX1, $rootScope.offsetY1, $rootScope.x, $rootScope.y); + $rootScope.DrawArrowOnModuleItem('#canvas', $rootScope.ArrowNumber, $rootScope.shapestyleborderColor, $rootScope.shapestyleborderWidth, $rootScope.offsetX1, $rootScope.offsetY1, $rootScope.x, $rootScope.y); // $scope.resetRect += 1; break; case "Pin": $rootScope.PinNumber = $rootScope.PinObjectIndex++; $rootScope.PinArcNumber = $rootScope.ArcObjectIndex++; - $rootScope.PinFn('#canvas', $rootScope.PinNumber, $rootScope.offsetX1, $rootScope.offsetY1, $rootScope.x, $rootScope.y, $rootScope.PinArcNumber); + $rootScope.DrawPinOnModuleItem('#canvas', $rootScope.PinNumber, $rootScope.offsetX1, $rootScope.offsetY1, $rootScope.x, $rootScope.y, $rootScope.PinArcNumber); break; case "TextArea": @@ -1253,7 +1197,7 @@ AIA.controller("HomeController", ["$rootScope", "Modules", "$log", "$location", // Draw text $rootScope.resetTextRect = $rootScope.ObjectIndex++; $rootScope.TextNumber = $rootScope.ObjectIndex++; - $rootScope.TextAreaFn('#canvas', $rootScope.TextNumber, $rootScope.offsetX1, $rootScope.offsetY1, $rootScope.resetTextRect, $rootScope.shapestyleOpacity, $rootScope.shapestyleborderColor, $rootScope.shapestyleborderWidth, $rootScope.shapestyleFillColor, $rootScope.x, $rootScope.y); + $rootScope.TextEditorFunctionality('#canvas', $rootScope.TextNumber, $rootScope.offsetX1, $rootScope.offsetY1, $rootScope.resetTextRect, $rootScope.shapestyleOpacity, $rootScope.shapestyleborderColor, $rootScope.shapestyleborderWidth, $rootScope.shapestyleFillColor, $rootScope.x, $rootScope.y); break; case "DrawPolygon": @@ -1264,12 +1208,6 @@ AIA.controller("HomeController", ["$rootScope", "Modules", "$log", "$location", //} } - - - - - - ///----- $rootScope.saveText = function () { @@ -1416,14 +1354,6 @@ AIA.controller("HomeController", ["$rootScope", "Modules", "$log", "$location", CurrentFontFamily = ''; CurrentFontSize = ''; - // $(".ActiveDefaultColorAnnotation").css({ "background-color": $rootScope.TextPropertyArray[_rectLayerOnSaveSplitInt].FontColor + "!important" }); - // $("#font-color .minicolors .minicolors-swatch .minicolors-swatch-color").addClass("ActiveDefaultColorAnnotation"); - - - //adding text text decoration active class in text edit pop-up - - - if ($rootScope.TextPropertyArray[i].TextDecoration == "underline") { @@ -1437,14 +1367,10 @@ AIA.controller("HomeController", ["$rootScope", "Modules", "$log", "$location", } - - //adding text font weight active class in text edit pop-up if (fontWeightProp[0] == 700) { - - $("#text-bold").addClass("ActiveFormattingButtonClass"); } @@ -1489,9 +1415,6 @@ AIA.controller("HomeController", ["$rootScope", "Modules", "$log", "$location", $("#text-left").removeClass("ActiveFormattingButtonClass"); $("#text-right").addClass("ActiveFormattingButtonClass"); - - - } else if ($rootScope.TextPropertyArray[i].Align == "center") { @@ -1502,12 +1425,8 @@ AIA.controller("HomeController", ["$rootScope", "Modules", "$log", "$location", $("#text-center").addClass("ActiveFormattingButtonClass"); - - } - - } else { // alert("no"); @@ -1831,12 +1750,6 @@ AIA.controller("HomeController", ["$rootScope", "Modules", "$log", "$location", document.getElementById('modelbackground').style.display = "none"; - //if ($rootScope.isTextAreaClosedButtonActive == true) { - // $("#canvas").removeLayer('TextArea_' + $rootScope.TextNumber).drawLayers(); - // $("#canvas").removeLayer("TextRect_" + $rootScope.resetTextRect).drawLayers(); - - //} - } //-- End ---------------------------- @@ -1873,17 +1786,9 @@ AIA.controller("HomeController", ["$rootScope", "Modules", "$log", "$location", $rootScope.PaintCanvasMousedownListener = function (canvasContext, x, y) { if ($rootScope.isLineDrawSelecyed == true) { - canvasContext.lineWidth = 0.1; - //$scope.paintCanvasContext.lineJoin = 'round'; - //$scope.paintCanvasContext.lineCap = 'round'; + canvasContext.lineWidth = 0.1; canvasContext.strokeStyle = 'red'; - - canvasContext.beginPath(); - - //var canvasOffset = $("#myCanvas").offset(); - //var offsetX = canvasOffset.left; - //var offsetY = canvasOffset.top; canvasContext.moveTo(x, y); } @@ -2128,14 +2033,7 @@ AIA.controller("HomeController", ["$rootScope", "Modules", "$log", "$location", } //2. - //localStorage.setItem("globalEthnicity", $rootScope.globalSetting.ethnicity); - - //3. - //localStorage.setItem("globalModesty", $rootScope.globalSetting.modesty); - - //4. - //$rootScope.reloadChildController(); - + var len = $rootScope.openModules.length; if (len > 0) { $rootScope.reloadChildController(); diff --git a/400-SOURCECODE/AIAHTML5.Web/index.html b/400-SOURCECODE/AIAHTML5.Web/index.html index a7678e3..a8af2e8 100644 --- a/400-SOURCECODE/AIAHTML5.Web/index.html +++ b/400-SOURCECODE/AIAHTML5.Web/index.html @@ -508,12 +508,12 @@