'use strict'; AIA.controller("HomeController", ["$rootScope", "Modules", "$log", "$location", "$timeout", "DataService", "AuthenticationService", "LoginConstants", "UserModules", "LoginMessageConstants", "AdminService", "$http", "AdminConstants", "UserTypeConstants", function ($rootScope, Modules, $log, $location, $timeout, DataService, AuthenticationService, LoginConstants, UserModules, LoginMessageConstants, AdminService, $http, AdminConstants, UserTypeConstants) { //$scope.pageToOpen = { // name: 'MainMenu' //}; $rootScope.pageToOpen = 'app/widget/MainMenu.html'; $rootScope.currentBodyViewId; $rootScope.currentActiveModuleTitle = 'Welcome to A.D.A.M. Interactive Anatomy';//Modules[0].Name; $rootScope.currentActiveViewTitle; $rootScope.cuurentActiveModuleId; $rootScope.openModules = []; $rootScope.openViews = []; $rootScope.currentSlug; $rootScope.jsPanelTitle; $rootScope.ViewTitle; $rootScope.isLoading = false; $rootScope.isAnnotationWindowOpen = false; $rootScope.isDrawingToolSelected = false; $rootScope.isIdetifyClicked = true; $rootScope.paint = false; $rootScope.clickX = new Array(); $rootScope.clickY = new Array(); $rootScope.clickDrag = new Array(); $rootScope.isLineDrawSelecyed = false; $rootScope.isAnnotationWindowClose = false; $rootScope.setListManagerZindex = false; $rootScope.lastX; $rootScope.lastY; $rootScope.CommonData; $rootScope.shapeType; $rootScope.globalSetting = { ethnicity: 'W', modesty: 'Y', }; $rootScope.formsetting = { ethnicity: null, modesty: null }; // on refersh this variable will also get null that is why we are only checking this variable on initialize that if it is null that means page gets refershed. $rootScope.refreshcheck = null; $rootScope.isModestyOn; $rootScope.isModestyOff; $rootScope.SetSettingActiveTab; $rootScope.disableMenuannotation = "disableMenuannotation"; $rootScope.disableMenuoption = "disableMenuoption"; $rootScope.menuLabExer; $rootScope.menuLabExer = 0; $rootScope.fontSizes; $rootScope.fontWeight; $rootScope.fontStyle; $rootScope.textAlignmt; $rootScope.fontColor; $rootScope.underlineText; $rootScope.textArea; $rootScope.fontFamily; $rootScope.TextPropertyArray = []; $rootScope.modifySavedText = []; $rootScope.TextRectangleArr = []; $rootScope.rectDimension = []; $rootScope.isMousedownOnPaintCanvas = false; //opacity code $rootScope.shapestyleOpacity = 1; $rootScope.shapestyleFillColor = "#fff"; $rootScope.shapestyleFillBorderColor = "black"; $rootScope.shapestyleborderWidth = 2; $rootScope.shapestyleborderStyles = "solid"; //$rootScope.errorMessage = ''; // Commented initialization to retain message when coming to login after password reset success screen $rootScope.disableFileMenu = "disableFileMenu"; $rootScope.userInfo = { username: null, password: null, emailId: null, newPassword: null, confirmPassword: null, userMessage: null, unblockUser: false, isMailForForgotPassword:false }; $rootScope.userLicenseInfo = { userLicenseId: 0, licenseeAccountNumber: null }; $rootScope.userData; $rootScope.userModules; $rootScope.passwordMismatchMessage; $rootScope.isVisibleLogin; $rootScope.haveRoleAdmin; $rootScope.checked = false; var isfilloptionChecked = ""; var isOutlineOptionChecked = ""; $rootScope.forgotPwdModalShow = function () { document.getElementById("forgetPwdForm").reset() $("#forgotPwdModal").modal("show"); $(".modal-backdrop").css("opacity", ".5"); $("body.modal-open").css("padding-right", "0px"); } $rootScope.forgotUserModalShow = function () { document.getElementById("forgetUSerIdForm").reset(); $("#forgotUserModal").modal("show"); $(".modal-backdrop").css("opacity", ".5"); $("body.modal-open").css("padding-right", "0px"); } $rootScope.initializeAIA = function () { $rootScope.isLoading = false; var url = $location.url(); if (url.indexOf('?unb:') != -1) { $rootScope.isVisibleLogin = true; $rootScope.UnblockUser(); } else if (url.indexOf('?em:') != -1) { $rootScope.isVisibleLogin = false; $rootScope.isVisibleResetPass = true; } else { $rootScope.isVisibleLogin = true; $rootScope.isVisibleResetPass = false; getUserDetails(); } } $rootScope.AuthenticateUser = function (userInfo) { $rootScope.errorMessage = ""; if (userInfo.username == "" || userInfo.username == null || userInfo.password == "" || userInfo.password == null) { // alert(LoginMessageConstants.USER_CREDENTIALS_MISSING); $rootScope.errorMessage = LoginMessageConstants.USER_CREDENTIALS_MISSING; $("#messageModal").modal('show'); } else { AuthenticationService.authenticateUser(userInfo) .then( function (result) { if (result == LoginConstants.USER_NOT_FOUND) { $rootScope.isVisibleLogin = true; // alert(LoginMessageConstants.USER_OR_PASSWORD_INCORRECT); $rootScope.errorMessage = LoginMessageConstants.INVALID_USER; $("#messageModal").modal('show'); } else { if (typeof result.LoginId != undefined || result.LoginId != "" || result.LoginId != null) { if ($("#messageModal").length > 0) { $("#messageModal").modal('hide'); } if (result.LoginFailureCauseId!=undefined && result.LoginFailureCauseId.toString() == LoginConstants.E_PASSWORD_NOT_MATCH) { $rootScope.isVisibleLogin = true; $rootScope.errorMessage = LoginMessageConstants.INVALID_PASSWORD; $("#messageModal").modal('show'); } else if (result.LoginFailureCauseId != undefined && result.LoginFailureCauseId.toString() == LoginConstants.E_USER_ID_BLOCKED_24_HRS) { $rootScope.isVisibleLogin = true; $rootScope.errorMessage = LoginMessageConstants.USER_BLOCKED; $("#messageModal").modal('show'); } else if ((result.LoginFailureCauseId != undefined && result.LoginFailureCauseId.toString() == LoginConstants.E_USER_NOT_ACTIVE) && (result.LicenseInfo != null) && (result.LicenseInfo != undefined) && (result.LicenseInfo.IsActive) && result.IsSubscriptionExpired) { $rootScope.isVisibleLogin = true; $rootScope.errorMessage = LoginMessageConstants.SUBSCRIPTION_EXPIRATION_MESSAGE + result.SubscriptionExpirationDate + '.'; $rootScope.errorMessage = $rootScope.errorMessage + ' ' + LoginMessageConstants.USER_INACTIVE_MESSAGE; $("#messageModal").modal('show'); } else if ((result.LoginFailureCauseId != undefined && result.LoginFailureCauseId.toString() == LoginConstants.E_USER_NOT_ACTIVE) && (result.LicenseInfo != null) && (result.LicenseInfo != undefined) && (!result.LicenseInfo.IsActive) && result.IsSubscriptionExpired) { $rootScope.isVisibleLogin = true; $rootScope.errorMessage = LoginMessageConstants.SUBSCRIPTION_EXPIRATION_MESSAGE + result.SubscriptionExpirationDate + '.'; $rootScope.errorMessage = $rootScope.errorMessage + ' ' + LoginMessageConstants.LICENSE_INACTIVE_MESSAGE + ' ' + LoginMessageConstants.USER_INACTIVE_MESSAGE; $("#messageModal").modal('show'); } else if ((result.LoginFailureCauseId != undefined && result.LoginFailureCauseId.toString() == LoginConstants.E_USER_NOT_ACTIVE) && (result.LicenseInfo != null) && (result.LicenseInfo != undefined) && (!result.LicenseInfo.IsActive) && result.IsSubscriptionExpired) { $rootScope.isVisibleLogin = true; $rootScope.errorMessage = LoginMessageConstants.SUBSCRIPTION_EXPIRATION_MESSAGE + result.SubscriptionExpirationDate + '.'; $rootScope.errorMessage = $rootScope.errorMessage + ' ' + LoginMessageConstants.LICENSE_INACTIVE_MESSAGE + ' ' + LoginMessageConstants.USER_INACTIVE_MESSAGE; $("#messageModal").modal('show'); } else if ((result.LoginFailureCauseId != undefined && result.LoginFailureCauseId.toString() == LoginConstants.E_USER_NOT_ACTIVE) && (result.LicenseInfo != null) && (result.LicenseInfo != undefined) && (!result.LicenseInfo.IsActive) && (!result.IsSubscriptionExpired)) { $rootScope.isVisibleLogin = true; $rootScope.errorMessage = LoginMessageConstants.LICENSE_INACTIVE_MESSAGE + ' ' + LoginMessageConstants.USER_INACTIVE_MESSAGE; $("#messageModal").modal('show'); } else if (result.LoginFailureCauseId != undefined && result.LoginFailureCauseId.toString() == LoginConstants.E_USER_NOT_ACTIVE) { $rootScope.isVisibleLogin = true; $rootScope.errorMessage = LoginMessageConstants.USER_INACTIVE_MESSAGE; $("#messageModal").modal('show'); } else if ( (result.LicenseInfo!= null) && (result.LicenseInfo!= undefined) && (!result.LicenseInfo.IsActive) && (result.IsSubscriptionExpired)) { $rootScope.isVisibleLogin = true; $rootScope.errorMessage = LoginMessageConstants.SUBSCRIPTION_EXPIRATION_MESSAGE + result.SubscriptionExpirationDate + '.'; $rootScope.errorMessage = $rootScope.errorMessage + ' ' + LoginMessageConstants.LICENSE_INACTIVE_MESSAGE; $("#messageModal").modal('show'); } else if ((result.LicenseInfo!= null) && (result.LicenseInfo!= undefined) && (result.LicenseInfo.IsActive) && (result.IsSubscriptionExpired)) { $rootScope.isVisibleLogin = true; $rootScope.errorMessage = LoginMessageConstants.SUBSCRIPTION_EXPIRATION_MESSAGE + result.SubscriptionExpirationDate + '.'; $("#messageModal").modal('show'); } else if ((result.LicenseInfo!= null) && (result.LicenseInfo!= undefined) && (!result.LicenseInfo.IsActive) && (!result.IsSubscriptionExpired)) { $rootScope.isVisibleLogin = true; $rootScope.errorMessage = LoginMessageConstants.LICENSE_INACTIVE_MESSAGE; $("#messageModal").modal('show'); } else { if (result.UserType == UserTypeConstants.SUPER_ADMIN && result.IsActive) { //(!result.IsSubscriptionExpired) && $rootScope.userData = result; $rootScope.userModules = result.Modules; $rootScope.isVisibleLogin = false; $rootScope.haveRoleAdmin = true; localStorage.setItem('loggedInUserDetails', JSON.stringify(result)); ShowAssignedModulesPopup(result.Modules); $location.path('/'); } else { if (result.LicenseInfo != null && result.LicenseInfo.IsTermAccepted) { $rootScope.userData = result; $rootScope.userModules = result.Modules; $rootScope.isVisibleLogin = false; $rootScope.haveRoleAdmin = false; localStorage.setItem('loggedInUserDetails', JSON.stringify(result)); ShowAssignedModulesPopup(result.Modules); $location.path('/'); } else { if ($('#dvTerms').length > 0) { $('#dvTerms').html(result.TermsAndConditionsText); } $rootScope.isVisibleLogin = true; $('#dvTermCondition').fadeIn(); $rootScope.userData = result; $rootScope.haveRoleAdmin = false; localStorage.setItem('loggedInUserDetails', JSON.stringify(result)); $location.path('/'); } } } } } }), function (error) { console.log(' Error in authentication = ' + error.statusText); // alert(LoginMessageConstants.ERROR_IN_FECTHING_DETAILS); $rootScope.isVisibleLogin = true; $rootScope.errorMessage = error; $("#messageModal").modal('show'); } } } function ShowAssignedModulesPopup(userModules) { var allModules = Modules; var arrPendingModules = []; if ($('#dvPendingModules').length > 0) { $('#dvPending').hide(); } for (var module = 1; module <= allModules.length; module++) { $('#moduleDiv' + module).hide(); } if (('#moduleDiv1017').length > 0) { $('#moduleDiv1017').hide(); } for (var count = 0; count < userModules.length; count++) { for (var module = 0; module < allModules.length; module++) { if (userModules[count].id == allModules[module].Id) { $('#moduleDiv' + userModules[count].id).show(); break; } if (userModules[count].id == 7) arrPendingModules.push(userModules[count].id); if (userModules[count].id == 8) arrPendingModules.push(userModules[count].id); if (userModules[count].id == 10) arrPendingModules.push(userModules[count].id); } } if (userModules.length > 0) { $('#dvUserModulesInfo').modal('show'); } if (arrPendingModules.length > 0) { $('#dvPendingModules').show(); } } $rootScope.UpdateLicenseTermStatus = function () { $('#dvTermCondition').fadeOut(); var currentUserDetails = $rootScope.getLocalStorageValue('loggedInUserDetails'); if (currentUserDetails) { var userInfo = JSON.parse(currentUserDetails); } if (userInfo.LicenseInfo.AccountNumber != null && userInfo.LicenseInfo.Id != 0) { $rootScope.userLicenseInfo.userLicenseId = userInfo.LicenseInfo.Id; $rootScope.userLicenseInfo.licenseeAccountNumber = userInfo.LicenseInfo.AccountNumber; AuthenticationService.UpdateLicenseTerm($rootScope.userLicenseInfo) .then(function (result) { if (result.Modules !=="" && result.Modules !== null) { // LoginMessageConstants.LICENSE_TERM_CONDITION_UPDATE_SUCCESS) { console.log(' Term and Condition acceptance status updated successfully.'); if (currentUserDetails) { var userInfo = JSON.parse(currentUserDetails); userInfo.Modules = result.Modules; if (userInfo.LoginId != undefined || userInfo.LoginId != "" || userInfo.LoginId != null) { $rootScope.isVisibleLogin = false; $rootScope.userData = userInfo; $rootScope.userModules = userInfo.Modules; ShowAssignedModulesPopup(userInfo.Modules);; } } } else if (result = LoginConstants.LICENSE_TERM_CONDITION_UPDATE_FAILED) { console.log(result); $rootScope.isVisibleLogin = true; $('#dvTermCondition').fadeIn(); $rootScope.errorMessage = LoginConstants.LICENSE_TERM_CONDITION_UPDATE_FAILED; $("#messageModal").modal('show'); $("#messageModal").css("z-index", 111112); localStorage.removeItem("loggedInUserDetails"); } }, function (error) { console.log(' Error in Term and Condition acceptance status update = ' + error);//.statusText $rootScope.isVisibleLogin = true; $rootScope.isVisibleLogin = true; $rootScope.errorMessage = error; $("#messageModal").modal('show'); $('#dvTermCondition').fadeIn(); }); } }; $rootScope.LogoutUser = function () { localStorage.removeItem('loggedInUserDetails'); localStorage.clear(); document.location = '/'; $rootScope.isVisibleLogin = true; } function getUserDetails() { //Retain logged in user details var currentUserDetails = $rootScope.getLocalStorageValue('loggedInUserDetails'); if (currentUserDetails) { try { var userInfo = JSON.parse(currentUserDetails); if (userInfo.LoginId != undefined || userInfo.LoginId != "" || userInfo.LoginId != null) { if (userInfo.UserType == UserTypeConstants.SUPER_ADMIN && userInfo.IsActive) { //(!result.IsSubscriptionExpired) && $rootScope.userData = userInfo; $rootScope.userModules = userInfo.Modules; $rootScope.isVisibleLogin = false; $rootScope.haveRoleAdmin = true; if ($rootScope.refreshcheck == null) { $location.path('/'); } } else { $rootScope.haveRoleAdmin = false; if (userInfo.LicenseInfo.IsTermAccepted) { $rootScope.userData = userInfo; $rootScope.userModules = userInfo.Modules; $rootScope.isVisibleLogin = false; //$rootScope.haveRoleAdmin = true; if ($rootScope.refreshcheck == null) { $location.path('/'); } } else { if ($('#dvTerms').length > 0) { $('#dvTerms').html(userInfo.TermsAndConditionsText); } $rootScope.isVisibleLogin = true; $('#dvTermCondition').fadeIn(); $rootScope.userData = userInfo; $rootScope.userModules = userInfo.Modules; //$rootScope.haveRoleAdmin = true; $location.path('/'); } } } } catch (e) { localStorage.removeItem('loggedInUserDetails'); } } } $rootScope.SendMailToUser = function (userInfo, isMailForForgotPassword) { // if ((userInfo.emailId != null) && (userInfo.emailId != '')) { if (validateEmail(userInfo.emailId)) { if (isMailForForgotPassword) { var selectedOption = $("input[name='inlineRadioOptions']:checked").val(); if (selectedOption == LoginMessageConstants.UNBLOCK_SELECTED) { userInfo.unblockUser = true; userInfo.isMailForForgotPassword = true; } else if (selectedOption == LoginMessageConstants.FORGOT_PASSWORD_SELECTED) { userInfo.unblockUser = false; userInfo.isMailForForgotPassword = true; } } else userInfo.isMailForForgotPassword = false; AuthenticationService.SendMailToUser(userInfo) .then(function (result) { if (result == LoginConstants.USER_NOT_FOUND) { removeEmailPopUp(); // alert(LoginMessageConstants.INCORRECT_EMAIL_ID); $rootScope.errorMessage = LoginMessageConstants.INCORRECT_EMAIL_ID; $("#messageModal").modal('show'); } else if (result == LoginConstants.MAIL_NOT_SENT) { removeEmailPopUp(); // alert(LoginMessageConstants.MAIL_NOT_SENT); $rootScope.errorMessage = LoginMessageConstants.MAIL_NOT_SENT; $("#messageModal").modal('show'); } else { if (result == LoginMessageConstants.MAIL_SENT) { var message; removeEmailPopUp(); if (isMailForForgotPassword) { if (userInfo.unblockUser) message = LoginMessageConstants.USER_UNBLOCK_LINK_IN_EMAIL; else message = LoginMessageConstants.RESET_PASSWORD; } else message = LoginMessageConstants.USERID_SENT_IN_EMAIL //alert(message); $rootScope.errorMessage = message; $("#messageModal").modal('show'); } } }, function (error) { console.log(' Error in authentication = ' + error.statusText); removeEmailPopUp(); // alert(LoginConstants.ERROR_IN_FECTHING_DETAILS); $rootScope.errorMessage = error; $("#messageModal").modal('show'); }); } else { // alert(LoginMessageConstants.INCORRECT_EMAIL_ID); removeEmailPopUp(); $rootScope.errorMessage = LoginMessageConstants.INCORRECT_EMAIL_ID; $("#messageModal").modal('show'); } } else { //alert(LoginMessageConstants.BLANK_EMAIL_ID); removeEmailPopUp(); $rootScope.errorMessage = LoginMessageConstants.BLANK_EMAIL_ID; $("#messageModal").modal('show'); } }; function removeEmailPopUp() { if ($('#forgotUserModal').length > 0) { $('#forgotUserModal').fadeOut(); $('#forgotUserModal').modal('hide'); } if ($('#forgotPwdModal').length > 0) { $('#forgotPwdModal').fadeOut(); $('#forgotPwdModal').modal('hide'); } } function validateEmail(email) { var re = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/; return re.test(email); } $rootScope.ResetUserPassword = function (userInfo) { var url = $location.url(); if (url.indexOf('?em:') != -1) { var split = url.split('?em:'); userInfo.emailId = split[1]; } if (userInfo.newPassword != null) { if (userInfo.newPassword === userInfo.confirmPassword) { $rootScope.passwordMismatchMessage = null; AuthenticationService.ResetUserPassword(userInfo) .then( function (result) { if (result == LoginConstants.USER_NOT_FOUND) { // alert(LoginMessageConstants.USER_OR_PASSWORD_INCORRECT); $rootScope.errorMessage = LoginMessageConstants.USER_NOT_FOUND; $("#messageModal").modal('show'); } else if (result == LoginConstants.EXCEPTION_OCCURED) { // alert(LoginMessageConstants.ERROR_IN_FECTHING_DETAILS); $rootScope.errorMessage = LoginConstants.ERROR_IN_FECTHING_DETAILS; $("#messageModal").modal('show'); } else if (result == LoginConstants.SQL_CONNECTION_ERROR) { $rootScope.errorMessage = LoginConstants.SQL_CONNECTION_ERROR_MESSAGE; $("#messageModal").modal('show'); } else { //if ((result.IsAcknowledged == true) && (result.IsModifiedCountAvailable == true)) { if (result == LoginMessageConstants.PASSWORD_UPDATE_SUCCESS) { // alert(LoginMessageConstants.PASSWORD_RESET_MESSAGE); $rootScope.errorMessage = LoginMessageConstants.PASSWORD_RESET_MESSAGE; $("#messageModal").modal('show'); $rootScope.isVisibleLogin = true; $rootScope.isVisibleResetPass = false; $location.url("/"); } else { $rootScope.errorMessage = LoginMessageConstants.PASSWORD_RESET_FAILURE; $("#messageModal").modal('show'); $rootScope.isVisibleLogin = true; $rootScope.isVisibleResetPass = false; $location.url("/"); } } }, function (error) { console.log(' Error in authentication = ' + error.statusText); // alert(LoginMessageConstants.ERROR_IN_FECTHING_DETAILS); $rootScope.errorMessage = error; $("#messageModal").modal('show'); }); } else { $rootScope.errorMessage = LoginMessageConstants.NEW_AND_OLD_PASSWORD_DONOT_MATCH; $("#messageModal").modal('show'); } } else { $rootScope.errorMessage = LoginMessageConstants.NEW_PASSWORD_FIELD_IS_EMPTY; $("#messageModal").modal('show'); } } $rootScope.UnblockUser = function () { var userEmailId = ''; var url = $location.url(); var split = url.split('?unb:'); userEmailId = split[1]; AuthenticationService.UnblockUser(userEmailId) .then( function (result) { if (result == LoginMessageConstants.USER_UNBLOCK_SUCCESS) { $rootScope.errorMessage = LoginMessageConstants.USER_UNBLOCK_SUCCESS_MESSAGE; $("#messageModal").modal('show'); $rootScope.isVisibleLogin = true; $location.url("/"); } else { $rootScope.errorMessage = LoginMessageConstants.UNABLE_TO_UNBLOCK; $("#messageModal").modal('show'); $rootScope.isVisibleLogin = true; $location.url("/"); } }, function (error) { console.log(' Error in UnblockUser = ' + error.statusText); $rootScope.errorMessage = error; $("#messageModal").modal('show'); } ); } $rootScope.lexiconLanguageArray = []; $rootScope.lexiconLanguageArray.push({ id: "1", language: "English" }); $(document).ready(function () { $rootScope.isLexiconTabClicked = true; $rootScope.lexiconData = function () { if ($rootScope.isLexiconTabClicked == true) { $rootScope.isLexiconTabClicked = false; $.ajax({ url: '~/../content/data/json/da/uc_dat_default.json', dataType: "json", success: function (result) { $(result.root.uc.al.lx).each(function (key, value) { $('#lexiconLangDropdown').append(''); }); } }); } $('#lexiconLangDropdown').change(function () { $rootScope.isLexiconLanguageClicked = true; $('#laxiconLangAdd').removeAttr('disabled'); $('#laxicanlanguageChagne').removeAttr('disabled'); $rootScope.selectedId = $("#lexiconLangDropdown option:selected").attr('val'); $rootScope.selectedText = $("#lexiconLangDropdown option:selected").text(); }); $('#laxiconLangAdd').click(function () { if ($rootScope.isLexiconLanguageClicked == true) { $rootScope.isLexiconLanguageClicked = false; $("#lexiconLangDropdown :selected").remove(); $('#secondLax').append(''); $rootScope.lexiconLanguageArray.push({ id: $rootScope.selectedId, language: $rootScope.selectedText }); } }); $('#secondLax').change(function () { $rootScope.isActiveLexiconLanguageClicked = true; $rootScope.secondlaxdid = $("#secondLax option:selected").attr('val'); $rootScope.secondlaxtext = $("#secondLax option:selected").text(); }); $("#laxiconLangRemove").click(function () { if ($rootScope.isActiveLexiconLanguageClicked == true) { $rootScope.isActiveLexiconLanguageClicked = false; $("#secondLax :selected").remove(); $('#lexiconLangDropdown').append(''); // $rootScope.lexiconLanguageArray.splice($rootScope.secondlaxtext, 1); $rootScope.lexiconLanguageArray = []; $("#secondLax > option").each(function () { $rootScope.lexiconLanguageArray.push({ id: $(this).attr("val"), language: this.value }); }); $rootScope.lexiconLanguageArray.unshift({ id: $("#primarylaxican").attr("name"), language: $("#primarylaxican").val() }); } }); $("#laxicanlanguageChagne").click(function () { if ($rootScope.isLexiconLanguageClicked == true) { $rootScope.isLexiconLanguageClicked = false; var primarylaxiid = $("#lexiconLangDropdown option:selected").attr('val'); var primarylaxicantext = $("#lexiconLangDropdown option:selected").text(); $("#lexiconLangDropdown :selected").remove(); $('#lexiconLangDropdown').append(''); $('#primarylaxican').val(primarylaxicantext); $('#primarylaxican').attr("name", primarylaxiid); $rootScope.lexiconLanguageArray[0].id = primarylaxiid; $rootScope.lexiconLanguageArray[0].language = primarylaxicantext; } }); } if ($.browser.msie) { $("#resetBtn").css("display", "inline-block"); // $rootScope.refreshCanvas(); } $(function () { var colpick = $('.demo').each(function () { $(this).minicolors({ control: $(this).attr('data-control') || 'hue', inline: $(this).attr('data-inline') === 'true', letterCase: 'lowercase', opacity: false, change: function (hex, opacity) { $("#font-color .minicolors .minicolors-swatch .minicolors-swatch-color").removeClass("ActiveDefaultColorAnnotation"); if (!hex) return; if (opacity) hex += ', ' + opacity; try { console.log(hex); $("#text_area").css("color", hex); } catch (e) { } $(this).select(); }, theme: 'bootstrap' }); }); var $inlinehex = $('#inlinecolorhex h3 small'); //alert($inlinehex); $('#inlinecolors').minicolors({ inline: true, theme: 'bootstrap', change: function (hex) { if (!hex) return; $inlinehex.html(hex); } }); }); $(function () { var colpick = $('.drawTextBG').each(function () { $(this).minicolors({ control: $(this).attr('data-control') || 'hue', inline: $(this).attr('data-inline') === 'true', letterCase: 'lowercase', opacity: false, change: function (hex, opacity) { $("#drawTextBGColorpicker .minicolors .minicolors-swatch .minicolors-swatch-color").removeClass("ActiveDefaultColorAnnotation"); if (!hex) return; if (opacity) hex += ', ' + opacity; try { console.log(hex); // $("#text_area").css("background-color", hex); } catch (e) { } $(this).select(); }, theme: 'bootstrap' }); }); var $inlinehex = $('#inlinecolorhex h3 small'); //alert($inlinehex); $('#inlinecolors').minicolors({ inline: true, theme: 'bootstrap', change: function (hex) { if (!hex) return; $inlinehex.html(hex); } }); }); $("#font-color .minicolors .minicolors-swatch .minicolors-swatch-color").css({ "background-color": "#000000" }); $("#drawTextBGColorpicker .minicolors .minicolors-swatch .minicolors-swatch-color").css({ "background-color": "#ffffff" }); }); $rootScope.$on("$locationChangeSuccess", function () { $rootScope.HightLightModuleSelection = function (moduleUrl) { var currentRoute = $location.path().substring(1); return moduleUrl === currentRoute ? 'active' : ''; } $("#annotationToolBarOptions").removeClass("disableMenuoption"); $("#optionsListManagerTab").removeClass("disableMenuoption"); if (($location.url() == "/da-body-view")) { $rootScope.disableMenuannotation = " "; $rootScope.disableMenuoption = " "; $rootScope.disableSubMenu = "disableSubMenu"; $rootScope.disableFileMenu = " "; } else if ($location.url() == "/clinical-illustrations-detail") { $rootScope.disableMenuannotation = " "; $rootScope.disableMenuoption = " "; $rootScope.disableSubMenu = "disableSubMenu"; $("#annotationToolBarOptions").removeClass("disableSubMenu"); $("#optionsListManagerTab").addClass("disableSubMenu"); $rootScope.disableFileMenu = " "; } else if ($location.url() == "/module-item-view") { $rootScope.disableMenuannotation = " "; $rootScope.disableMenuoption = " "; $rootScope.disableSubMenu = "disableSubMenu"; $("#annotationToolBarOptions").removeClass("disableSubMenu"); $rootScope.disableFileMenu = " "; } else if ($location.url() == "/clinical-animations-detail") { $rootScope.disableMenuannotation = "disableMenuannotation"; $rootScope.disableMenuoption = " "; $rootScope.disableSubMenu = "disableSubMenu"; $("#annotationToolBarOptions").addClass("disableSubMenu"); $("#optionsListManagerTab").addClass("disableSubMenu"); $rootScope.disableFileMenu = "disableFileMenu"; } else { $("#annotationToolBarOptions").removeClass("disableSubMenu"); $("#optionsListManagerTab").removeClass("disableSubMenu"); $rootScope.disableMenuannotation = "disableMenuannotation"; $rootScope.disableMenuoption = "disableMenuoption"; $rootScope.disableSubMenu = ""; $rootScope.CloseAnnotationTool(); $rootScope.CloseListManager(); angular.element('#modal-settings').css('display', 'none'); if ($location.url() == "/lab-exercises") { $rootScope.menuLabExer = 0; } if ($rootScope.menuLabExer == 1) { $rootScope.disableMenuoption = " "; } $rootScope.disableFileMenu = "disableFileMenu"; } }); //jspanel functionality.. $rootScope.getModuleScrollPosition = function () { $rootScope.refreshcheck = "check"; $('.mCSB_container ul li').click(function () { $rootScope.scrollTopPosition = $(this).position().top; }); setTimeout(function () { $(".sidebar").mCustomScrollbar("scrollTo", $rootScope.scrollTopPosition + "px"); }, 300); } $rootScope.openParent = function (slug) { if ($('#jsPanel-1').length > 0) { } else { var openViews = $rootScope.openViews; if (openViews.length > 0) { $rootScope.openViews.splice(openViews.length - 1); } if (openViews.length > 0) { var lastOpenMoudle = $rootScope.openViews[openViews.length - 1]; } // $('#daImagePanel').remove(); if ($('#jsPanel-1').length > 0) $('#jsPanel-1').remove(); if ($('#3DImagePanel').length > 0) $('#3DImagePanel').remove(); if ($('#ciImagePanel').length > 0) $('#ciImagePanel').remove(); if ($('#caVideoPanel').length > 0) $('#caVideoPanel').remove(); if ($('#ImagePanel').length > 0) $('#ImagePanel').remove(); $location.url('/' + slug); $rootScope.$broadcast('jsPanelCloseEvent', true); } } //called on jsanel minimize $rootScope.setState = function (state, title) { var alreadyOpenThisView = new jinqJs() .from($rootScope.openViews) .where("body-views == " + title) .select(); var k = 0; if (alreadyOpenThisView != null) { for (var i = 0; i < $rootScope.openViews.length; i++) { k++; if ($rootScope.openViews[i].body - views == title) { $rootScope.openViews.splice((k - 1), 1); $rootScope.openViews.push( { "module": $rootScope.currentActiveModuleTitle, "bodyView": title, "state": state, "BodyViewId": $rootScope.currentBodyViewId, "slug": $rootScope.currentSlug } ); } } } if (state == 'max') { $('#daBodyview').css('width', '100%') } } $rootScope.ClearIframe = function () { if ($('#daImagePanel') != null) $('#daImagePanel').remove(); if ($('#jsPanel-1').length > 0) $('#jsPanel-1').remove(); $rootScope.hideScrollbar(); } //ends $rootScope.hideScrollbar = function () { $(".sidebar").mCustomScrollbar({ autoHideScrollbar: true, //theme:"rounded" }); } $rootScope.isFontFamilyLoaded = false; //annotation tool custom events $rootScope.ShowAnnotationWindow = function () { //7904 $rootScope.isAnnotatiomToolBarPopupActive = true; $rootScope.isAnnotatiomToolBarPopupClosed = false; $rootScope.isAnnotaionToolBarDrawingModeActive = false; if ($rootScope.MenuModuleName == "DA" || $rootScope.MenuModuleName == "CI" || $rootScope.MenuModuleName == "AA") { if ($rootScope.disableAnnotationtoolOnListManager == true) { $('#AnnotaionPopupDiv').find('a,input, textarea, button, select,img,div').attr('disabled', 'disabled'); $('#slider-range-min-2').slider('disable'); $("#annotationpaintbrushsize").attr('disabled', 'disabled'); $("#annotationpainteraser").attr('disabled', 'disabled'); // $rootScope.disableAnnotationTB = false; } else { $('#AnnotaionPopupDiv').find('input, textarea, button, select,img,div').removeAttr('disabled', 'disabled'); $('#slider-range-min-2').slider('enable'); $("#annotationpaintbrushsize").removeAttr('disabled', 'disabled'); $("#annotationpainteraser").removeAttr('disabled', 'disabled'); } // document.getElementById('modelbackground').style.display = "block"; // document.getElementById('modeleditstyle').style.display = "block"; } if ($rootScope.MenuModuleName == "CA") { $("#annotationpaintbrushsize").attr("href", "#"); $("#annotationpainteraser").attr("href", "#"); $("#annotationpainteraser").attr('disabled', 'disabled'); $("#annotationpainteraser").css('pointer-events', 'none'); } else { $("#annotationpaintbrushsize").attr("href", "#canvasPaint"); $("#annotationpainteraser").attr("href", "#canvasPaint"); $("#annotationpainteraser").removeAttr('disabled', 'disabled'); $("#annotationpainteraser").css('pointer-events', 'auto'); } $("#OnIdentify").addClass("annotationtoolbartab"); $("#annotationToolBarOptions").addClass("active"); $("#annotationButton").addClass("active"); $rootScope.isAnnotationWindowOpen = true; $(".annotationTollbar").css("display", "block"); $rootScope.$broadcast('annotationToolEvent', true); // $("#canvasPaint").css("display", "none"); // $("#canvas").css("display", "none"); var FontFamilyJson = '~/../content/data/json/settings/fontstyle.json'; if ($rootScope.isFontFamilyLoaded == false) { DataService.getJson(FontFamilyJson) .then( function (result) { $rootScope.AnnotationFontFamily = result; // alert($rootScope.AnnotationFontFamily.FontStyle.length); for (var i = 0; i <= $rootScope.AnnotationFontFamily.FontFamily.length - 1; i++) { $("#selected-font-family").append(""); } $rootScope.isFontFamilyLoaded = true; }, function (error) { console.log(error.statusText) } ) } if ($("#transparencyScale").css("display") == "block") { $rootScope.switchToTransparencycanvas(); } if ($location.url() == "/module-item-view") { var canvasZIndex = $("#canvas").css("z-index"); var canvasPaintZIndex = $("#canvasPaint").css("z-index"); if (parseInt(canvasZIndex) < parseInt(canvasPaintZIndex)) { canvasPaintZIndex = parseInt(canvasPaintZIndex) + 1; $("#aaDetailViewCanvas").css("z-index", canvasPaintZIndex); } else { canvasZIndex = parseInt(canvasZIndex) + 1; $("#aaDetailViewCanvas").css("z-index", canvasZIndex); } } } $rootScope.CloseAnnotationTool = function () { console.log('close'); $rootScope.isAnnotatiomToolBarPopupActive = false; $rootScope.isAnnotatiomToolBarPopupClosed = true; $("#OnIdentify").removeClass("annotationtoolbartab"); $("#DrawMode").removeClass("annotationtoolbartab"); $('.btnCursor').removeClass('activebtncolor'); $("#annotationButton").removeClass("active"); $("#annotationButton").blur(); $("#annotationToolBarOptions").removeClass("active"); $(".annotationTollbar").css("display", "none"); $rootScope.isAnnotationWindowClose = true; // $("#canvasPaint").css("display", "none"); // $("#canvas").css("display", "none"); $('.btnCursor').removeClass('activebtncolor'); $(".btn-annotation").removeClass("activebtncolor"); $rootScope.isAnnotaionToolBarDrawingModeActive = false; if ($("#transparencyScale").css("display") == "block") { $rootScope.switchToTransparencycanvas(); } else { $rootScope.switchCanvas(); } $rootScope.shapeType = ''; if ($location.url() == "/module-item-view") { var canvasZIndex = $("#canvas").css("z-index"); var canvasPaintZIndex = $("#canvasPaint").css("z-index"); if (parseInt(canvasZIndex) < parseInt(canvasPaintZIndex)) { canvasPaintZIndex = parseInt(canvasPaintZIndex) + 1; $("#aaDetailViewCanvas").css("z-index", canvasPaintZIndex); } else { canvasZIndex = parseInt(canvasZIndex) + 1; $("#aaDetailViewCanvas").css("z-index", canvasZIndex); } for (var i = 0; i <= $rootScope.jcanvasObjectArray.length - 1; i++) { for (var j = 0; j <= $rootScope.aaPinDataArray.length - 1; j++) { if (($rootScope.jcanvasObjectArray[i].x <= parseInt($rootScope.aaPinDataArray[j]._HeadX) && $rootScope.jcanvasObjectArray[i].y <= parseInt($rootScope.aaPinDataArray[j]._HeadY)) && (($rootScope.jcanvasObjectArray[i].x + $rootScope.jcanvasObjectArray[i].width) >= parseInt($rootScope.aaPinDataArray[j]._HeadX) && ($rootScope.jcanvasObjectArray[i].y + $rootScope.jcanvasObjectArray[i].height) >= parseInt($rootScope.aaPinDataArray[j]._HeadY)) || ($rootScope.jcanvasObjectArray[i].x <= parseInt($rootScope.aaPinDataArray[j]._PinX) && $rootScope.jcanvasObjectArray[i].y <= parseInt($rootScope.aaPinDataArray[j]._PinY)) && (($rootScope.jcanvasObjectArray[i].x + $rootScope.jcanvasObjectArray[i].width) >= parseInt($rootScope.aaPinDataArray[j]._PinX) && ($rootScope.jcanvasObjectArray[i].y + $rootScope.jcanvasObjectArray[i].height) >= parseInt($rootScope.aaPinDataArray[j]._PinY))) { var pinName = 'Pin_' + $rootScope.aaPinDataArray[j]._PinId; var pinArcName = 'PinArc_' + $rootScope.aaPinDataArray[j]._PinId; $('#aaDetailViewCanvas').setLayer(pinName, { visible: false // set to true instead to show the layer again }).drawLayers(); $('#aaDetailViewCanvas').setLayer(pinArcName, { visible: false // set to true instead to show the layer again }).drawLayers(); } } } } } $rootScope.CIAnotationIdentifyModeOff = false; $rootScope.OnIdentifyClick = function () { $("#OnIdentify").addClass("annotationtoolbartab"); $("#DrawMode").removeClass("annotationtoolbartab"); if ($rootScope.CIAnotationIdentifyModeOff == true) { $('.btnCursor').removeClass('activebtncolor'); } else { $('.btnCursor').removeClass('activebtncolor'); } $("#annotationpaintbrushsize").removeClass("activebtncolor"); $("#annotationpainteraser").removeClass("activebtncolor"); $rootScope.isAnnotaionToolBarDrawingModeActive = false; $rootScope.switchCanvas(); if ($("#transparencyScale").css("display") == "block") { $rootScope.switchToTransparencycanvas(); } if ($location.url() == "/module-item-view") { var canvasZIndex = $("#canvas").css("z-index"); var canvasPaintZIndex = $("#canvasPaint").css("z-index"); if (parseInt(canvasZIndex) < parseInt(canvasPaintZIndex)) { canvasPaintZIndex = parseInt(canvasPaintZIndex) + 1; $("#aaDetailViewCanvas").css("z-index", canvasPaintZIndex); } else { canvasZIndex = parseInt(canvasZIndex) + 1; $("#aaDetailViewCanvas").css("z-index", canvasZIndex); } for (var i = 0; i <= $rootScope.jcanvasObjectArray.length - 1; i++) { for (var j = 0; j <= $rootScope.aaPinDataArray.length - 1; j++) { if (($rootScope.jcanvasObjectArray[i].x <= parseInt($rootScope.aaPinDataArray[j]._HeadX) && $rootScope.jcanvasObjectArray[i].y <= parseInt($rootScope.aaPinDataArray[j]._HeadY)) && (($rootScope.jcanvasObjectArray[i].x + $rootScope.jcanvasObjectArray[i].width) >= parseInt($rootScope.aaPinDataArray[j]._HeadX) && ($rootScope.jcanvasObjectArray[i].y + $rootScope.jcanvasObjectArray[i].height) >= parseInt($rootScope.aaPinDataArray[j]._HeadY)) || ($rootScope.jcanvasObjectArray[i].x <= parseInt($rootScope.aaPinDataArray[j]._PinX) && $rootScope.jcanvasObjectArray[i].y <= parseInt($rootScope.aaPinDataArray[j]._PinY)) && (($rootScope.jcanvasObjectArray[i].x + $rootScope.jcanvasObjectArray[i].width) >= parseInt($rootScope.aaPinDataArray[j]._PinX) && ($rootScope.jcanvasObjectArray[i].y + $rootScope.jcanvasObjectArray[i].height) >= parseInt($rootScope.aaPinDataArray[j]._PinY))) { var pinName = 'Pin_' + $rootScope.aaPinDataArray[j]._PinId; var pinArcName = 'PinArc_' + $rootScope.aaPinDataArray[j]._PinId; $('#aaDetailViewCanvas').setLayer(pinName, { visible: false // set to true instead to show the layer again }).drawLayers(); $('#aaDetailViewCanvas').setLayer(pinArcName, { visible: false // set to true instead to show the layer again }).drawLayers(); } } } } } $rootScope.switchToTransparencycanvas = function () { if ($rootScope.isTBoxModestyVisible == true) { var modestyTransCanvases = $("canvas[id*='modestyTransCanavs']"); if (modestyTransCanvases != null || modestyTransCanvases != undefined && modestyTransCanvases.length > 0) { for (var j = 0; j < modestyTransCanvases.length; j++) { var ctx = document.getElementById(modestyTransCanvases[j].id); if (ctx.style.visibility == "visible") { if ($("#OnIdentify").hasClass("annotationtoolbartab")) { var drawCanvasZindex = $("#canvas").css("z-index"); var paintCanvasZindex = $("#canvasPaint").css("z-index"); var TransCanvasZindex = ctx.style.zIndex; var MaxZindexVal = Math.max(drawCanvasZindex, paintCanvasZindex, TransCanvasZindex); MaxZindexVal = MaxZindexVal + 1; $("#canvas").css("z-index", MaxZindexVal); if ($rootScope.currentBodyViewId == "11") { $(".ui-wrapper").css("z-index", MaxZindexVal + 1); $('#' + ctx.getAttribute("id")).css("z-index", MaxZindexVal); } else { $('#' + ctx.getAttribute("id")).css("z-index", MaxZindexVal); } } else { var drawCanvasZindex = $("#canvas").css("z-index"); var paintCanvasZindex = $("#canvasPaint").css("z-index"); var TransCanvasZindex = ctx.style.zIndex; var MaxZindexVal = Math.max(drawCanvasZindex, paintCanvasZindex, TransCanvasZindex); MaxZindexVal = parseInt(MaxZindexVal + 1); if ($("#annotationpaintbrushsize").hasClass("activebtncolor") || $("#annotationpainteraser").hasClass("activebtncolor")) { $("#canvasPaint").css("z-index", MaxZindexVal); } else { $("#canvas").css("z-index", MaxZindexVal); if ($rootScope.currentBodyViewId == "11") { $(".ui-wrapper").css("z-index", MaxZindexVal); } else { $('#' + ctx.getAttribute("id")).css("z-index", MaxZindexVal); } } } } else { var drawCanvasZindex = $("#canvas").css("z-index"); var paintCanvasZindex = $("#canvasPaint").css("z-index"); drawCanvasZindex = parseInt(drawCanvasZindex) + 1; paintCanvasZindex = parseInt(paintCanvasZindex) + 1; if (drawCanvasZindex > paintCanvasZindex) { $(".ui-wrapper").css("z-index", drawCanvasZindex); $("#canvas").css("z-index", drawCanvasZindex); $rootScope.UIWrapperZIndex = drawCanvasZindex; } else { $(".ui-wrapper").css("z-index", paintCanvasZindex); $("#canvas").css("z-index", paintCanvasZindex); $rootScope.UIWrapperZIndex = paintCanvasZindex; } } } } } else { var drawCanvasZindex = $("#canvas").css("z-index"); var paintCanvasZindex = $("#canvasPaint").css("z-index"); drawCanvasZindex = parseInt(drawCanvasZindex) + 1; paintCanvasZindex = parseInt(paintCanvasZindex) + 1; if (drawCanvasZindex > paintCanvasZindex) { $(".ui-wrapper").css("z-index", drawCanvasZindex); $("#canvas").css("z-index", drawCanvasZindex); $rootScope.UIWrapperZIndex = drawCanvasZindex; } else { $(".ui-wrapper").css("z-index", paintCanvasZindex); $("#canvas").css("z-index", paintCanvasZindex); $rootScope.UIWrapperZIndex = paintCanvasZindex; } } } $rootScope.DrawingMode = function () { //Annotation History $rootScope.isAnnotaionToolBarDrawingModeActive = true; $("#OnIdentify").removeClass("annotationtoolbartab"); $("#DrawMode").addClass("annotationtoolbartab"); $('.btnCursor').addClass('activebtncolor'); $rootScope.switchCanvas(); $("#annotationpaintbrushsize").removeClass("activebtncolor"); $("#annotationpainteraser").removeClass("activebtncolor"); $rootScope.isEraseToolSelected = false; if ($location.url() == "/module-item-view") { $rootScope.switchToAnnotationCanvas(); for (var i = 0; i <= $rootScope.jcanvasObjectArray.length - 1; i++) { for (var j = 0; j <= $rootScope.aaPinDataArray.length - 1; j++) { if (($rootScope.jcanvasObjectArray[i].x <= parseInt($rootScope.aaPinDataArray[j]._HeadX) && $rootScope.jcanvasObjectArray[i].y <= parseInt($rootScope.aaPinDataArray[j]._HeadY)) && (($rootScope.jcanvasObjectArray[i].x + $rootScope.jcanvasObjectArray[i].width) >= parseInt($rootScope.aaPinDataArray[j]._HeadX) && ($rootScope.jcanvasObjectArray[i].y + $rootScope.jcanvasObjectArray[i].height) >= parseInt($rootScope.aaPinDataArray[j]._HeadY)) || ($rootScope.jcanvasObjectArray[i].x <= parseInt($rootScope.aaPinDataArray[j]._PinX) && $rootScope.jcanvasObjectArray[i].y <= parseInt($rootScope.aaPinDataArray[j]._PinY)) && (($rootScope.jcanvasObjectArray[i].x + $rootScope.jcanvasObjectArray[i].width) >= parseInt($rootScope.aaPinDataArray[j]._PinX) && ($rootScope.jcanvasObjectArray[i].y + $rootScope.jcanvasObjectArray[i].height) >= parseInt($rootScope.aaPinDataArray[j]._PinY))) { var pinName = 'Pin_' + $rootScope.aaPinDataArray[j]._PinId; var pinArcName = 'PinArc_' + $rootScope.aaPinDataArray[j]._PinId; $('#aaDetailViewCanvas').setLayer(pinName, { visible: true // set to true instead to show the layer again }).drawLayers(); $('#aaDetailViewCanvas').setLayer(pinArcName, { visible: true // set to true instead to show the layer again }).drawLayers(); } } } } } // Dissectible Anatomy > Settings should be disable if Annotation is Open. $rootScope.ShowSettingWindow = function () { if ($(".annotationTollbar").css("display") == "block") { // alert("already open"); $('#modal-settings').css("display", "none"); $("#modelsettingsbackground").css("display", "none"); } else { $('#modal-settings').css("display", "block"); $("#modelsettingsbackground").css("display", "block"); } $rootScope.lexiconLanguageArrayLength = $rootScope.lexiconLanguageArray.length; $rootScope.lexiconPrimaryLanguage = $("#primarylaxican").val(); $rootScope.primaryLangID = $('#primarylaxican').attr("name"); } //----Annotation Toolbar: Jcanvas----- $rootScope.DrawLine = function (e) { $rootScope.setListManagerZindex = true; $("#canvasPaint").css("display", "block"); $("#canvas").css("display", "block"); $('.btnCursor').removeClass('activebtncolor'); $(".btn-annotation").removeClass("activebtncolor"); $(".btn-annotation-line").addClass("activebtncolor"); $("#OnIdentify").removeClass('annotationtoolbartab'); $("#DrawMode").addClass('annotationtoolbartab'); $rootScope.switchCanvas(); $rootScope.shapeType = "Line"; $rootScope.isAnnotaionToolBarDrawingModeActive = true; if ($location.url() == "/module-item-view") { $rootScope.switchToAnnotationCanvas(); } } $rootScope.switchToAnnotationCanvas = function () { var aaViewCanvasZIndex = $("#aaDetailViewCanvas").css("z-index"); var canvasPaintZIndex = $("#canvasPaint").css("z-index"); if (parseInt(aaViewCanvasZIndex) < parseInt(canvasPaintZIndex)) { canvasPaintZIndex = parseInt(canvasPaintZIndex) + 1; $("#canvas").css("z-index", canvasPaintZIndex); } else { aaViewCanvasZIndex = parseInt(aaViewCanvasZIndex) + 1; $("#canvas").css("z-index", aaViewCanvasZIndex); } } $rootScope.DrawPin = function (e) { $("#canvasPaint").css("display", "block"); $("#canvas").css("display", "block"); $('.btnCursor').removeClass('activebtncolor'); $(".btn-annotation").removeClass("activebtncolor"); $(".btn-annotation-pin").addClass("activebtncolor"); $("#OnIdentify").removeClass('annotationtoolbartab'); $("#DrawMode").addClass('annotationtoolbartab'); $rootScope.switchCanvas(); $rootScope.setListManagerZindex = true; $rootScope.shapeType = "Pin"; $rootScope.isAnnotaionToolBarDrawingModeActive = true; if ($location.url() == "/module-item-view") { $rootScope.switchToAnnotationCanvas(); } } $rootScope.Cursor = function () { $rootScope.switchCanvas(); $rootScope.shapeType = "cursor"; $(".btn-annotation").removeClass("activebtncolor"); // $("#" + e.currentTarget.id).removeClass("activebtncolor"); $('.btnCursor').addClass('activebtncolor'); $("#OnIdentify").removeClass('annotationtoolbartab'); $("#DrawMode").addClass('annotationtoolbartab'); $rootScope.isAnnotaionToolBarDrawingModeActive = true; if ($location.url() == "/module-item-view") { $rootScope.switchToAnnotationCanvas(); } } $rootScope.DrawRectangle = function (e) { $rootScope.setListManagerZindex = true; $("#canvasPaint").css("display", "block"); $("#canvas").css("display", "block"); $('.btnCursor').removeClass('activebtncolor'); $(".btn-annotation").removeClass("activebtncolor"); $(".btn-annotation-rectangle").addClass("activebtncolor"); $("#OnIdentify").removeClass('annotationtoolbartab'); $("#DrawMode").addClass('annotationtoolbartab'); $rootScope.switchCanvas(); $rootScope.shapeType = "Rectangle"; $rootScope.isAnnotaionToolBarDrawingModeActive = true; if ($location.url() == "/module-item-view") { $rootScope.switchToAnnotationCanvas(); } } $rootScope.paintBrush = function () { $('.btnCursor').removeClass('activebtncolor'); $(".btn-annotation").removeClass("activebtncolor"); $(".btn-annotation-brush").addClass("activebtncolor"); $("#OnIdentify").removeClass('annotationtoolbartab'); $("#DrawMode").addClass('annotationtoolbartab'); $rootScope.isAnnotaionToolBarDrawingModeActive = true; if ($rootScope.disableAnnotationtoolOnListManager == true) { $rootScope.switchCanvas(); var canvasPaintZindex = $('#canvasPaint').css("z-index"); //x var canvasZindex = $('#canvas').css("z-index"); //y var listManagerZindex = $('#listManager').css("z-index"); //z if (canvasPaintZindex > canvasZindex) { $('#listManager').css("z-index", canvasPaintZindex); } else { $('#listManager').css("z-index", canvasZindex); } } else { $rootScope.setListManagerZindex = true; $("#canvasPaint").css("display", "block"); $("#canvas").css("display", "block"); if ((document.getElementById('fill-option').checked == false) && ($rootScope.isShapeSyleOkBtnClicked == true)) { $rootScope.switchCanvas(); } else if (($("#editstylebackgroundcolor span.minicolors-swatch-color").css('background-color') == "transparent") || ($("#editstylebackgroundcolor span.minicolors-swatch-color").css('background-color') == "rgba(0, 0, 0, 0)")) { // we are switching canvas from paint to draw to prevent paint because it does not take transparent color and we need control default black color for the case where user has unchecked fill option from Edit Shape Style window $rootScope.switchCanvas(); } else { $rootScope.switchCanvasToPaintCanvas(); } $rootScope.shapeType = "FreeStylePaint"; var btnBrushSizeValue = $("#btnBrushSize").val(); $rootScope.shapeSize = parseInt(btnBrushSizeValue); $("#annotationpaintbrushsize").attr("data-size", $rootScope.shapeSize); $("#annotationpaintbrushsize").attr("data-color", $rootScope.shapestyleColorWithOpacity); if ($rootScope.shapeSize == '') { $('#canvasPaint').sketch({ defaultSize: 1 }); } else { $('#canvasPaint').sketch(); } } } $rootScope.switchCanvasToPaintCanvas = function (e) { if ($rootScope.isTBoxModestyVisible == true) { var modestyTransCanvases = $("canvas[id*='modestyTransCanavs']"); if (modestyTransCanvases != null || modestyTransCanvases != undefined && modestyTransCanvases.length > 0) { for (var j = 0; j < modestyTransCanvases.length; j++) { var ctx = document.getElementById(modestyTransCanvases[j].id); if (ctx.style.visibility == "visible") { var drawCanvasZindex = $("#canvas").css("z-index"); var paintCanvasZindex = $("#canvasPaint").css("z-index"); var TransCanvasZindex = ctx.style.zIndex; var MaxZindexVal = Math.max(drawCanvasZindex, paintCanvasZindex, TransCanvasZindex); MaxZindexVal = MaxZindexVal + 1; if (($("#canvasPaint").css("display") == "block") && ($("#canvas").css("display") == "block")) { if ($("#OnIdentify").hasClass("annotationtoolbartab")) { $("#canvas").css("z-index", MaxZindexVal); $('#' + ctx.getAttribute("id")).css("z-index", MaxZindexVal); } else { if ($("#annotationpaintbrushsize").hasClass("activebtncolor") || $("#annotationpainteraser").hasClass("activebtncolor")) { $("#canvasPaint").css("z-index", MaxZindexVal); } else { $("#canvas").css("z-index", MaxZindexVal); } } } } else { var drawCanvasZindex = $("#canvas").css("z-index"); var paintCanvasZindex = $("#canvasPaint").css("z-index"); var MaxZindexVal = Math.max(drawCanvasZindex, paintCanvasZindex); MaxZindexVal = parseInt(MaxZindexVal + 1); if ($("#annotationpaintbrushsize").hasClass("activebtncolor") || $("#annotationpainteraser").hasClass("activebtncolor")) { $("#canvasPaint").css("z-index", MaxZindexVal); } else { $("#canvas").css("z-index", MaxZindexVal); } } } } } else { var canvasPaint_zIndex = $('#canvasPaint').css("z-index"); var canvas_zIndex = $('#canvas').css("z-index"); if (canvas_zIndex > canvasPaint_zIndex) { canvasPaint_zIndex = parseInt(canvas_zIndex) + 1; } else { canvasPaint_zIndex = parseInt(canvasPaint_zIndex) + 1; } $('#canvasPaint').css("z-index", canvasPaint_zIndex); } } $rootScope.DrawCircle = function (e) { $rootScope.setListManagerZindex = true; $("#canvasPaint").css("display", "block"); $("#canvas").css("display", "block"); $('.btnCursor').removeClass('activebtncolor'); $(".btn-annotation").removeClass("activebtncolor"); $(".btn-annotation-circle").addClass("activebtncolor"); $("#OnIdentify").removeClass('annotationtoolbartab'); $("#DrawMode").addClass('annotationtoolbartab'); $rootScope.switchCanvas(); $rootScope.shapeType = "Circle"; $rootScope.isAnnotaionToolBarDrawingModeActive = true; if ($location.url() == "/module-item-view") { $rootScope.switchToAnnotationCanvas(); } } $rootScope.DrawArrow = function (e) { $rootScope.setListManagerZindex = true; $("#canvasPaint").css("display", "block"); $("#canvas").css("display", "block"); $('.btnCursor').removeClass('activebtncolor'); $(".btn-annotation").removeClass("activebtncolor"); $(".btn-annotation-arrow").addClass("activebtncolor"); $("#OnIdentify").removeClass('annotationtoolbartab'); $("#DrawMode").addClass('annotationtoolbartab'); $rootScope.switchCanvas(); $rootScope.shapeType = "Arrow"; $rootScope.isAnnotaionToolBarDrawingModeActive = true; if ($location.url() == "/module-item-view") { $rootScope.switchToAnnotationCanvas(); } } $rootScope.DrawText = function () { $rootScope.setListManagerZindex = true; $("#canvasPaint").css("display", "block"); $("#canvas").css("display", "block"); $('.btnCursor').removeClass('activebtncolor'); $(".btn-annotation").removeClass("activebtncolor"); $(".btn-annotation-Text").addClass("activebtncolor"); $("#OnIdentify").removeClass('annotationtoolbartab'); $("#DrawMode").addClass('annotationtoolbartab'); $rootScope.switchCanvas(); $rootScope.shapeType = "TextArea"; $rootScope.isAnnotaionToolBarDrawingModeActive = true; if ($location.url() == "/module-item-view") { $rootScope.switchToAnnotationCanvas(); } } $rootScope.DrawPolygon = function () { $rootScope.setListManagerZindex = true; $("#canvasPaint").css("display", "block"); $("#canvas").css("display", "block"); $rootScope.shapeType = "DrawPolygon"; $("#OnIdentify").removeClass('annotationtoolbartab'); $("#DrawMode").addClass('annotationtoolbartab'); $rootScope.isAnnotaionToolBarDrawingModeActive = true; if ($location.url() == "/module-item-view") { $rootScope.switchToAnnotationCanvas(); } } $rootScope.switchCanvas = function () { if ($rootScope.isTBoxModestyVisible == true) { var modestyTransCanvases = $("canvas[id*='modestyTransCanavs']"); if (modestyTransCanvases != null || modestyTransCanvases != undefined && modestyTransCanvases.length > 0) { for (var j = 0; j < modestyTransCanvases.length; j++) { var ctx = document.getElementById(modestyTransCanvases[j].id); if (ctx.style.visibility == "visible") { var drawCanvasZindex = $("#canvas").css("z-index"); var paintCanvasZindex = $("#canvasPaint").css("z-index"); var TransCanvasZindex = ctx.style.zIndex; var MaxZindexVal = Math.max(drawCanvasZindex, paintCanvasZindex, TransCanvasZindex); MaxZindexVal = MaxZindexVal + 1; if ($("#OnIdentify").hasClass("annotationtoolbartab")) { $("#canvas").css("z-index", MaxZindexVal); $('#' + ctx.getAttribute("id")).css("z-index", MaxZindexVal); } else { if ($("#annotationpaintbrushsize").hasClass("activebtncolor") || $("#annotationpainteraser").hasClass("activebtncolor")) { if ($rootScope.currentBodyViewId == "11") { $("#canvasPaint").css("z-index", MaxZindexVal + 1); } else{ $("#canvasPaint").css("z-index", MaxZindexVal);} } else { if ($rootScope.currentBodyViewId == "11") { $("#canvas").css("z-index", MaxZindexVal + 1); } else { $("#canvas").css("z-index", MaxZindexVal); } } } } else { var drawCanvasZindex = $("#canvas").css("z-index"); var paintCanvasZindex = $("#canvasPaint").css("z-index"); var MaxZindexVal = Math.max(drawCanvasZindex, paintCanvasZindex); MaxZindexVal = parseInt(MaxZindexVal + 1); if ($("#annotationpaintbrushsize").hasClass("activebtncolor") || $("#annotationpainteraser").hasClass("activebtncolor")) { $("#canvasPaint").css("z-index", MaxZindexVal); } else { $("#canvas").css("z-index", MaxZindexVal); } } } } } else { var drawCanvasZindex = $("#canvas").css("z-index"); var paintCanvasZindex = $("#canvasPaint").css("z-index"); if (drawCanvasZindex > paintCanvasZindex) { paintCanvasZindex = parseInt(drawCanvasZindex) + 1; } else { paintCanvasZindex = parseInt(paintCanvasZindex) + 1; } $('#canvas').css("z-index", paintCanvasZindex); } } $rootScope.EraseDrawing = function () { $rootScope.isAnnotaionToolBarDrawingModeActive = true; $('.btnCursor').removeClass('activebtncolor'); $(".btn-annotation").removeClass("activebtncolor"); $(".btn-annotation-erase").addClass("activebtncolor"); $("#OnIdentify").removeClass('annotationtoolbartab'); $("#DrawMode").addClass('annotationtoolbartab'); $rootScope.switchCanvasToPaintCanvas(); var btneraseBrushSizeValue = $("#btnBrushSize").val(); $('#canvasPaint').sketch(); $rootScope.eraseshapeSize = parseInt(btneraseBrushSizeValue); $("#annotationpainteraser").attr("data-size", $rootScope.eraseshapeSize); return $.sketch.tools.eraser = { onEvent: function (e) { return $.sketch.tools.marker.onEvent.call(this, e); }, draw: function (action) { var oldcomposite; oldcomposite = this.context.globalCompositeOperation; this.context.globalCompositeOperation = "destination-out"; action.color = "#000000"; $.sketch.tools.marker.draw.call(this, action); return this.context.globalCompositeOperation = oldcomposite; } } } $rootScope.isShapeSyleOkBtnClicked = false; $rootScope.setPropertiesForShapes = function (id) { isfilloptionChecked = document.getElementById('fill-option').checked; isOutlineOptionChecked = document.getElementById('Outline-Option').checked; $rootScope.isShapeSyleOkBtnClicked = true; if ($("#annotationpaintbrushsize").hasClass('activebtncolor')) { $("#annotationpaintbrushsize").removeClass('activebtncolor') $rootScope.switchCanvas(); } if ($("#annotationpainteraser").hasClass('activebtncolor')) { $("#annotationpainteraser").removeClass('activebtncolor') $rootScope.switchCanvas(); } if ((document.getElementById('fill-option').checked == false) && (document.getElementById('Outline-Option').checked == false)) { // $('#btnShapeStyle').attr('disabled', 'disabled'); } else { //$('#btnShapeStyle').removeAttr('disabled', 'disabled'); document.getElementById('modelbackground').style.display = "none"; document.getElementById('modeleditstyle').style.display = "none"; $rootScope.shapestyleOpacity = $("#" + id).css('opacity'); $("#shapeStyleDiv").parent().css("opacity", $rootScope.shapestyleOpacity); $rootScope.shapestyleFillColor = $("#" + id).css('background-color'); $rootScope.shapeStyleColorRGBA = $rootScope.shapestyleFillColor.replace("rgb", "rgba"); $rootScope.shapestyleColorWithOpacity = $rootScope.shapeStyleColorRGBA.substring(0, $rootScope.shapeStyleColorRGBA.length - 1) + " " + "," + $rootScope.shapestyleOpacity + ")"; $("#shapeStyleDiv").css("background-color", $rootScope.shapestyleFillColor); $rootScope.shapestyleborderColor = $("#" + id).parent().css("border-top-color"); // $("#shapeStyleDiv").parent().css("border-color", $rootScope.shapestyleborderColor); $rootScope.borderDimensions = $("#" + id).parent().css("border-top-width"); document.getElementById("shapeStyleDiv").parentNode.style.border = $rootScope.borderDimensions + " " + "solid" + " " + $rootScope.shapestyleborderColor; // $("#shapeStyleDiv").parent().css("border-width", $rootScope.shapestyleborderWidthSeparatingPixel); var borderDimensions = $rootScope.borderDimensions; var borderDimensionSplitArray = borderDimensions.split("p"); $rootScope.shapestyleborderWidth = borderDimensionSplitArray[0]; $rootScope.shapestyleborderStyles = "solid"; $('#editshapestyle').modal('hide'); //Edit Shape Style popup should open at it's default position $("#modeleditstyle").css({ "left": "40%", "right": "0", "top": "70px" }); } } $rootScope.enableAnnotationToolBar = function () { if ($rootScope.disableAnnotationTB == true) { document.getElementById('modelbackground').style.display = "none"; document.getElementById('modeleditstyle').style.display = "none"; } else { document.getElementById('modelbackground').style.display = "block"; document.getElementById('modeleditstyle').style.display = "block"; // alert(document.getElementById('outlinedivId').style.border); // alert(document.getElementById('imgOpacity').style.backgroundColor); $('#editstylebackgroundcolor .minicolors >.minicolors-swatch > .minicolors-swatch-color').css("background-color", document.getElementById('imgOpacity').style.backgroundColor); $('#outlineColor .minicolors >.minicolors-swatch > .minicolors-swatch-color').css("background-color", document.getElementById('outlinedivId').style.border); if ($('#modeleditstyle').css("display") == "block") { //Check if the modal is already showing var previewOpacity = $('#imgOpacity').css("opacity"); $('#slider-range-min-4 div.ui-slider-range-min').css("width", (previewOpacity * 100) + "%"); $('#slider-range-min-4 span.ui-slider-handle').css("left", (previewOpacity * 100) + "%"); }; } } $rootScope.enableEditShapeTooltip = function () { $("#edit-block").addClass("custom-tooltip-annotation"); $(".custom-tooltip-annotation").css('display', 'block'); } $rootScope.disableEditShapeTooltip = function () { $(".custom-tooltip-annotation").css('display', 'none'); $("#edit-block").removeClass("custom-tooltip-annotation"); } $rootScope.disableAnnotationToolBar = function () { if ($rootScope.isShapeSyleOkBtnClicked == false) { $('#editstylebackgroundcolor .minicolors >.minicolors-swatch > .minicolors-swatch-color').css("background-color", "rgb(255,255,255)"); $('#outlineColor .minicolors >.minicolors-swatch > .minicolors-swatch-color').css("background-color", "rgb(0,0,0)"); var previewBorderColor = $("#outlineColor span.minicolors-swatch-color").css('background-color'); $(".marginTopBtm10 div.outlinediv").css("border-color", previewBorderColor); var previewBgColor = $("#editstylebackgroundcolor span.minicolors-swatch-color").css('background-color'); $("#imgOpacity").css("background-color", previewBgColor); $('#borderWidthCanvasElement').val(1); $('.marginTopBtm10 div.outlinediv').css("border-width", 1); $("#imgOpacity").css("opacity", 1); $(".marginTopBtm10 div.outlinediv").css("opacity", 1); document.getElementById("editStyleForm").reset(); isOutlineOptionChecked = document.getElementById('Outline-Option').checked; isfilloptionChecked = document.getElementById('fill-option').checked; if (isOutlineOptionChecked == true) { $(".setEnableDisableForEditShapeStyle").css({ "opacity": "1" }); $("#borderWidthCanvasElement").css({ "pointer-events": "auto" }); $("#outlineColor").css({ "pointer-events": "auto" }); } else { $(".setEnableDisableForEditShapeStyle").css({ "opacity": ".5" }); $("#borderWidthCanvasElement").css({ "pointer-events": "none" }); $("#outlineColor").css({ "pointer-events": "none" }); } if (isfilloptionChecked == true) { $(".enableDisableOpacity label").css({ "cursor": "pointer" }); $(".enableDisableOpacity").css({ "opacity": "1" }); $("#edit-slider-3").css({ "pointer-events": "auto" }); $("#edit-slider-4").css({ "pointer-events": "auto" }); $("#editstylebackgroundcolor").css({ "pointer-events": "auto" }); } else { $(".enableDisableOpacity label").css({ "cursor": "pointer" }); $(".enableDisableOpacity").css({ "opacity": ".5" }); $("#edit-slider-3").css({ "pointer-events": "none" }); $("#edit-slider-4").css({ "pointer-events": "none" }); $("#editstylebackgroundcolor").css({ "pointer-events": "none" }); } } else { document.getElementById('fill-option').checked = isfilloptionChecked; document.getElementById('Outline-Option').checked = isOutlineOptionChecked; if (isfilloptionChecked == true) { $(".enableDisableOpacity label").css({ "cursor": "pointer" }); $(".enableDisableOpacity").css({ "opacity": "1" }); $("#edit-slider-3").css({ "pointer-events": "auto" }); $("#edit-slider-4").css({ "pointer-events": "auto" }); $("#editstylebackgroundcolor").css({ "pointer-events": "auto" }); } else { $(".enableDisableOpacity label").css({ "cursor": "pointer" }); $(".enableDisableOpacity").css({ "opacity": ".5" }); $("#edit-slider-3").css({ "pointer-events": "none" }); $("#edit-slider-4").css({ "pointer-events": "none" }); $("#editstylebackgroundcolor").css({ "pointer-events": "none" }); } if (isOutlineOptionChecked == true) { $(".setEnableDisableForEditShapeStyle").css({ "opacity": "1" }); $("#borderWidthCanvasElement").css({ "pointer-events": "auto" }); $("#outlineColor").css({ "pointer-events": "auto" }); } else { $(".setEnableDisableForEditShapeStyle").css({ "opacity": ".5" }); $("#borderWidthCanvasElement").css({ "pointer-events": "none" }); $("#outlineColor").css({ "pointer-events": "none" }); } if ((isfilloptionChecked == false) && (isOutlineOptionChecked == false)) { $(".setEnableDisableForEditShapeStyle").css({ "opacity": "1" }); $("#borderWidthCanvasElement").css({ "pointer-events": "auto" }); $("#outlineColor").css({ "pointer-events": "auto" }); $(".enableDisableOpacity label").css({ "cursor": "pointer" }); $(".enableDisableOpacity").css({ "opacity": "1" }); $("#edit-slider-3").css({ "pointer-events": "auto" }); $("#edit-slider-4").css({ "pointer-events": "auto" }); $("#editstylebackgroundcolor").css({ "pointer-events": "auto" }); document.getElementById("editStyleForm").reset(); } var previewBgColor = $("#shapeStyleDiv").css('background-color'); var previewBorderColor = $('#previewBorder').css('border-top-color'); var previewBorderWidth = $('#previewBorder').css('border-top-width'); var previewOpacity = $('#previewBorder').css('opacity'); $('#editstylebackgroundcolor .minicolors >.minicolors-swatch > .minicolors-swatch-color').css("background-color", previewBgColor); $("#imgOpacity").css("background-color", previewBgColor); $('#outlineColor .minicolors >.minicolors-swatch > .minicolors-swatch-color').css("background-color", previewBorderColor); $(".marginTopBtm10 div.outlinediv").css("border-color", previewBorderColor); $('.marginTopBtm10 div.outlinediv').css("border-width", previewBorderWidth); $('#borderWidthCanvasElement').val(previewBorderWidth.split("px")); $("#imgOpacity").css("opacity", previewOpacity); $(".marginTopBtm10 div.outlinediv").css("opacity", previewOpacity); } document.getElementById('modelbackground').style.display = "none"; document.getElementById('modeleditstyle').style.display = "none"; //Edit Shape Style popup should open at it's default position $("#modeleditstyle").css({ "left": "40%", "right": "0", "top": "70px" }); } //--Common code of Annotation Toolbar for CI and DA------- $rootScope.DrawLineOnModuleItem = function (canvasId, LineNumber, shapestyleborderColor, shapestyleborderWidth, offsetX1, offsetY1, x, y) { if ($rootScope.isLinePreviewCompleted == true) { $rootScope.isLinePreviewCompleted = false; $(canvasId).addLayer({ name: 'Line_' + LineNumber, layer: true, type: 'line', draggable: true, strokeStyle: shapestyleborderColor, strokeWidth: shapestyleborderWidth, rounded: true, x1: offsetX1, y1: offsetY1, x2: x, y2: y, click: function (layer) { if ($rootScope.isAnnotaionToolBarDrawingModeActive == true) { //jcanvas property layer.draggable = true; $rootScope.canvasLayerNameCollection = []; $rootScope.canvasLayerNameCollection.push(layer.name); $(canvasId).setLayer(layer.name, { handle: { type: 'arc', fillStyle: '#fff', strokeStyle: '#c33', strokeWidth: 2, radius: 3 } }).drawLayers(); } else { //jcanvas property layer.draggable = false; } }, mouseout: function (layer) { if ($rootScope.isAnnotaionToolBarDrawingModeActive == true) { //jcanvas property layer.draggable = true; $rootScope.canvasLayerNameCollection = []; $(canvasId).setLayer(layer.name, { handle: { type: 'arc', fillStyle: '#fff', strokeStyle: '#c33', strokeWidth: 0, radius: 0 } }).drawLayers(); } else { //jcanvas property layer.draggable = false; } }, mouseover: function (layer) { if ($rootScope.isAnnotaionToolBarDrawingModeActive == true) { //jcanvas property layer.draggable = true; $(canvasId).setLayer(layer.name, { handle: { type: 'arc', fillStyle: '#fff', strokeStyle: '#c33', strokeWidth: 2, radius: 3 } }).drawLayers(); } else { //jcanvas property layer.draggable = false; } } }).drawLayers(); } $('.btnCursor').trigger('click'); $(".btn-annotation").removeClass("activebtncolor"); $('.btnCursor').addClass('activebtncolor'); } $rootScope.jcanvasObjectArray = []; $rootScope.DrawRectangleOnModuleItem = function (canvasId, RectNumber, shapestyleFillColor, shapestyleborderColor, shapestyleOpacity, shapestyleborderWidth, offsetX1, offsetY1, x, y) { if ($rootScope.isRectanglePreviewCompleted == true) { $rootScope.isRectanglePreviewCompleted = false; $(canvasId).addLayer({ layer: true, name: 'Rect_' + RectNumber, fillStyle: shapestyleFillColor, type: 'rectangle', draggable: true, strokeStyle: shapestyleborderColor, opacity: shapestyleOpacity, strokeWidth: shapestyleborderWidth, fromCenter: false, x: offsetX1, y: offsetY1, width: Math.abs(x - offsetX1), height: Math.abs(y - offsetY1), resizeFromCenter: false, add: function (layer) { if ($location.path() == "/module-item-view") { $rootScope.jcanvasObjectArray.push({ "name": layer.name, "x": layer.x, "y": layer.y, "width": layer.width, "height": layer.height }); } }, dragstop: function (layer) { if ($location.path() == "/module-item-view") { for (var i = 0; i <= $rootScope.jcanvasObjectArray.length - 1; i++) { if ($rootScope.jcanvasObjectArray[i].name == layer.name) { $rootScope.jcanvasObjectArray[i].x = layer.x; $rootScope.jcanvasObjectArray[i].y = layer.y; $rootScope.jcanvasObjectArray[i].width = layer.width; $rootScope.jcanvasObjectArray[i].height = layer.height; } } } }, change: function (layer) { if ($location.path() == "/module-item-view") { for (var i = 0; i <= $rootScope.jcanvasObjectArray.length - 1; i++) { if ($rootScope.jcanvasObjectArray[i].name == layer.name) { $rootScope.jcanvasObjectArray[i].x = layer.x; $rootScope.jcanvasObjectArray[i].y = layer.y; $rootScope.jcanvasObjectArray[i].width = layer.width; $rootScope.jcanvasObjectArray[i].height = layer.height; } } } }, click: function (layer) { if ($rootScope.isAnnotaionToolBarDrawingModeActive == true) { //jcanvas property layer.draggable = true; $rootScope.canvasLayerNameCollection = []; $rootScope.canvasLayerNameCollection.push(layer.name); $(canvasId).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; } }, mouseout: function (layer) { if ($rootScope.isAnnotaionToolBarDrawingModeActive == true) { //jcanvas property layer.draggable = true; $rootScope.canvasLayerNameCollection = []; $(canvasId).setLayer(layer.name, { handle: { type: 'rectangle', fillStyle: 'pink', strokeStyle: 'yellow', strokeWidth: 0, width: 0, height: 0, cornerRadius: 0, } }).drawLayers(); } else { //jcanvas property layer.draggable = false; } }, mouseover: function (layer) { if ($rootScope.isAnnotaionToolBarDrawingModeActive == true) { //jcanvas property layer.draggable = true; $(canvasId).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; } } }).drawLayers(); } $('.btnCursor').trigger('click'); $(".btn-annotation").removeClass("activebtncolor"); $('.btnCursor').addClass('activebtncolor'); } $rootScope.DrawCircleOnModuleItem = function (canvasId, CircleNumber, shapestyleOpacity, shapestyleborderColor, shapestyleborderWidth, shapestyleFillColor, offsetX1, offsetY1, x, y) { if ($rootScope.isCirclePreviewCompleted == true) { $rootScope.isCirclePreviewCompleted = false; $(canvasId).addLayer({ layer: true, name: 'Circle_' + CircleNumber, type: 'ellipse', opacity: shapestyleOpacity, draggable: true, strokeStyle: shapestyleborderColor, strokeWidth: shapestyleborderWidth, fillStyle: shapestyleFillColor, fromCenter: false, x: (offsetX1), y: (offsetY1), //added abs width: Math.abs(x - offsetX1), height: Math.abs(y - offsetY1), // Place a handle at each side and each corner resizeFromCenter: false, handlePlacement: 'both', add: function (layer) { if ($location.path() == "/module-item-view") { $rootScope.jcanvasObjectArray.push({ "name": layer.name, "x": layer.x, "y": layer.y, "width": layer.width, "height": layer.height }); } }, dragstop: function (layer) { if ($location.path() == "/module-item-view") { for (var i = 0; i <= $rootScope.jcanvasObjectArray.length - 1; i++) { if ($rootScope.jcanvasObjectArray[i].name == layer.name) { $rootScope.jcanvasObjectArray[i].x = layer.x; $rootScope.jcanvasObjectArray[i].y = layer.y; $rootScope.jcanvasObjectArray[i].width = layer.width; $rootScope.jcanvasObjectArray[i].height = layer.height; } } } }, change: function (layer) { if ($location.path() == "/module-item-view") { for (var i = 0; i <= $rootScope.jcanvasObjectArray.length - 1; i++) { if ($rootScope.jcanvasObjectArray[i].name == layer.name) { $rootScope.jcanvasObjectArray[i].x = layer.x; $rootScope.jcanvasObjectArray[i].y = layer.y; $rootScope.jcanvasObjectArray[i].width = layer.width; $rootScope.jcanvasObjectArray[i].height = layer.height; } } } }, click: function (layer) { if ($rootScope.isAnnotaionToolBarDrawingModeActive == true) { //jcanvas property layer.draggable = true; $rootScope.canvasLayerNameCollection = []; $rootScope.canvasLayerNameCollection.push(layer.name); $(canvasId).setLayer(layer.name, { handle: { type: 'arc', fillStyle: '#fff', strokeStyle: '#c33', strokeWidth: 2, radius: 3 } }).drawLayers(); } else { //jcanvas property layer.draggable = false; } }, mouseout: function (layer) { if ($rootScope.isAnnotaionToolBarDrawingModeActive == true) { //jcanvas property layer.draggable = true; $rootScope.canvasLayerNameCollection = []; $(canvasId).setLayer(layer.name, { handle: { type: 'arc', fillStyle: '#fff', strokeStyle: '#c33', strokeWidth: 0, // width: 0, height: 0, radius: 0 } }).drawLayers(); } else { layer.draggable = false; } }, mouseover: function (layer) { if ($rootScope.isAnnotaionToolBarDrawingModeActive == true) { //jcanvas property layer.draggable = true; $(canvasId).setLayer(layer.name, { handle: { type: 'arc', fillStyle: '#fff', strokeStyle: '#c33', strokeWidth: 2, // width: 5, height: 5, radius: 3, } }).drawLayers(); } else { //jcanvas property layer.draggable = false; } } }).drawLayers(); } $('.btnCursor').trigger('click'); $(".btn-annotation").removeClass("activebtncolor"); $('.btnCursor').addClass('activebtncolor'); } $rootScope.DrawArrowOnModuleItem = function (canvasId, ArrowNumber, shapestyleborderColor, shapestyleborderWidth, offsetX1, offsetY1, x, y) { if ($rootScope.isArrowPreviewCompleted == true) { $rootScope.isArrowPreviewCompleted = false; $('#canvas').drawLine({ layer: true, name: 'Arrow_' + ArrowNumber, draggable: true, strokeStyle: shapestyleborderColor, strokeWidth: shapestyleborderWidth, rounded: true, startArrow: true, arrowRadius: 7, arrowAngle: 90, x1: offsetX1, y1: offsetY1, x2: x, y2: y, click: function (layer) { if ($rootScope.isAnnotaionToolBarDrawingModeActive == true) { //jcanvas property layer.draggable = true; $rootScope.canvasLayerNameCollection = []; $rootScope.canvasLayerNameCollection.push(layer.name); $(canvasId).setLayer(layer.name, { handle: { type: 'arc', fillStyle: '#fff', strokeStyle: '#c33', strokeWidth: 2, // width: 5, height: 5, radius: 3 } }).drawLayers(); // $("#canvas").removeLayer(layer.name).drawLayers(); } else { //jcanvas property layer.draggable = false; } }, mouseout: function (layer) { if ($rootScope.isAnnotaionToolBarDrawingModeActive == true) { //jcanvas property layer.draggable = true; $rootScope.canvasLayerNameCollection = []; $(canvasId).setLayer(layer.name, { handle: { type: 'arc', fillStyle: '#fff', strokeStyle: '#c33', strokeWidth: 0, // width: 0, height: 0, radius: 0 } }).drawLayers(); } else { //jcanvas property layer.draggable = false; } }, mouseover: function (layer) { if ($rootScope.isAnnotaionToolBarDrawingModeActive == true) { //jcanvas property layer.draggable = true; $(canvasId).setLayer(layer.name, { handle: { type: 'arc', fillStyle: '#fff', strokeStyle: '#c33', strokeWidth: 2, // width: 5, height: 5, radius: 3 } }).drawLayers(); } else { //jcanvas property layer.draggable = false; } } }); } $('.btnCursor').trigger('click'); $(".btn-annotation").removeClass("activebtncolor"); $('.btnCursor').addClass('activebtncolor'); } $rootScope.DrawPinOnModuleItem = function (canvasId, PinNumber, offsetX1, offsetY1, x, y, PinArcNumber) { if ($rootScope.isPinPreviewCompleted == true) { $rootScope.isPinPreviewCompleted = false; var radial = $('#canvas').createGradient({ x1: 50, y1: 50, x2: 50, y2: 50, r1: 10, r2: 30, c1: 'rgba(100, 50, 0,0)', c2: 'grey' }); $(canvasId).drawLine({ draggable: true, layer: true, name: "Pin_" + PinNumber, groups: ["Pin_" + PinNumber], dragGroups: ["Pin_" + PinNumber], strokeStyle: 'black', strokeWidth: 2, x1: offsetX1, y1: offsetY1, x2: x, y2: y, click: function (layer) { if ($rootScope.isAnnotaionToolBarDrawingModeActive == true) { //jcanvas property layer.draggable = true; $rootScope.shapeTypePin = "Pin"; $rootScope.canvasLayerNameCollection = []; var pinLine_layer = layer.name; var pinLine_layer_split = pinLine_layer.split("_"); var pinArcName = "ArcPin_"; var pinResult = pinArcName.concat(pinLine_layer_split[1]); $rootScope.canvasLayerNameCollection.push({ pinName: layer.name, ArcName: pinResult }); $(canvasId).setLayer(layer.name, { handle: { type: 'arc', fillStyle: '#fff', strokeStyle: '#c33', strokeWidth: 2, // width: 5, height: 5, radius: 3 } }).drawLayers(); } else { //jcanvas property layer.draggable = false; } }, mouseout: function (layer) { if ($rootScope.isAnnotaionToolBarDrawingModeActive == true) { //jcanvas property layer.draggable = true; $rootScope.canvasLayerNameCollection = []; $(canvasId).setLayer(layer.name, { handle: { type: 'arc', fillStyle: '#fff', strokeStyle: '#c33', strokeWidth: 0, // width: 0, height: 0, radius: 0 } }).drawLayers(); } else { //jcanvas property layer.draggable = false; } }, mouseover: function (layer) { if ($rootScope.isAnnotaionToolBarDrawingModeActive == true) { //jcanvas property layer.draggable = true; $(canvasId).setLayer(layer.name, { handle: { type: 'arc', fillStyle: '#fff', strokeStyle: '#c33', strokeWidth: 2, // width: 5, height: 5, radius: 3 } }).drawLayers(); } else { //jcanvas property layer.draggable = false; } } }).drawArc({ draggable: true, name: "ArcPin_" + PinArcNumber, // name: "Pin_" + $rootScope.resetPin, layer: true, groups: ["Pin_" + PinNumber], dragGroups: ["Pin_" + PinNumber], strokeStyle: 'grey', strokeWidth: 2, fillStyle: radial, x: offsetX1, y: offsetY1, radius: 5, add: function (layer) { $rootScope.PinArcNumber = layer.name; // $scope.arr = []; }, }).drawLayers(); } $('.btnCursor').trigger('click'); $(".btn-annotation").removeClass("activebtncolor"); $('.btnCursor').addClass('activebtncolor'); } $rootScope.TextEditorFunctionality = function (canvasId, TextNumber, offsetX1, offsetY1, resetTextRect, shapestyleOpacity, shapestyleborderColor, shapestyleborderWidth, shapestyleFillColor, x, y) { if ($rootScope.isTextAreaPreviewCompleted == true) { $rootScope.isTextAreaPreviewCompleted = false; $('#canvas').drawText({ layer: true, draggable: true, // opacity: $rootScope.shapestyleOpacity, name: 'TextArea_' + $rootScope.TextNumber, groups: ['TextArea_' + $rootScope.TextNumber], dragGroups: ['TextArea_' + $rootScope.TextNumber], fillStyle: '#36c', strokeWidth: 0, x: $rootScope.offsetX1, y: $rootScope.offsetY1, fromCenter: false, fontSize: '14pt', align: "left", fontFamily: 'Verdana, sans-serif', text: '', add: function (layer) { $rootScope.TextID = layer.name; } }) // Draw rect as wide as the text .drawRect({ layer: true, name: "TextRect_" + $rootScope.TextNumber, dragGroups: ['shapes'], opacity: $rootScope.shapestyleOpacity, strokeStyle: $rootScope.shapestyleborderColor, fromCenter: false, strokeWidth: $rootScope.shapestyleborderWidth, fillStyle: $rootScope.shapestyleFillColor, x: $rootScope.offsetX1, y: $rootScope.offsetY1, width: Math.abs($rootScope.x - $rootScope.offsetX1), height: Math.abs($rootScope.y - $rootScope.offsetY1), resizeFromCenter: false, add: function (layer) { $rootScope.TextAreaRectID = layer.name; $rootScope.rectDimension.push({ width: layer.width, height: layer.height, x: layer.x, y: layer.y }); if ($location.path() == "/module-item-view") { $rootScope.initialTextAreaName = layer.name; $rootScope.jcanvasObjectArray.push({ "name": layer.name, "x": layer.x, "y": layer.y, "width": layer.width, "height": layer.height }); } }, dragstop: function (layer) { if ($location.path() == "/module-item-view") { for (var i = 0; i <= $rootScope.jcanvasObjectArray.length - 1; i++) { if ($rootScope.jcanvasObjectArray[i].name == layer.name) { $rootScope.jcanvasObjectArray[i].x = layer.x; $rootScope.jcanvasObjectArray[i].y = layer.y; $rootScope.jcanvasObjectArray[i].width = layer.width; $rootScope.jcanvasObjectArray[i].height = layer.height; } } } }, change: function (layer) { if ($location.path() == "/module-item-view") { for (var i = 0; i <= $rootScope.jcanvasObjectArray.length - 1; i++) { if ($rootScope.jcanvasObjectArray[i].name == layer.name) { $rootScope.jcanvasObjectArray[i].x = layer.x; $rootScope.jcanvasObjectArray[i].y = layer.y; $rootScope.jcanvasObjectArray[i].width = layer.width; $rootScope.jcanvasObjectArray[i].height = layer.height; } } } }, click: function (layer) { 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; } }, dblclick: function (layer) { 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 layer.draggable = true; $rootScope.canvasLayerNameCollection = []; $('#canvas').setLayer(layer.name, { handle: { type: 'rectangle', fillStyle: 'pink', strokeStyle: 'yellow', strokeWidth: 0, width: 0, height: 0, cornerRadius: 0 } }).drawLayers(); } else { //jcanvas property layer.draggable = false; } }, mouseover: function (layer) { if ($rootScope.isAnnotaionToolBarDrawingModeActive == true) { //jcanvas property layer.draggable = true; $('#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; } } }); // Annotation: Edit Text option is missing. $("#annotationTextModal").css("padding-right", "0px"); $("#annotationTextModal").modal("toggle"); document.getElementById('modelbackground').style.display = "block"; } $('.btnCursor').trigger('click'); $("#font-color .minicolors .minicolors-swatch .minicolors-swatch-color").css({ "background-color": "#000000" }); $("#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" }); $("#selected-font-family option:eq(0)").prop('selected', true); $("#selected-font-size option:eq(0)").prop('selected', true); // $("#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" }); $("#text-italic").removeClass("ActiveFormattingButtonClass"); $("#text-bold").removeClass("ActiveFormattingButtonClass"); $("#text-underline").removeClass("ActiveFormattingButtonClass"); $("#text-left").removeClass("ActiveFormattingButtonClass"); $("#text-right").removeClass("ActiveFormattingButtonClass"); $("#text-center").removeClass("ActiveFormattingButtonClass"); $(".btn-annotation").removeClass("activebtncolor"); $('.btnCursor').addClass('activebtncolor'); } $rootScope.clicked = true; $rootScope.offsetX1 = 0; $rootScope.offsetY1 = 0; $rootScope.x = 0; $rootScope.y = 0; $rootScope.mousePressed = false; $rootScope.lastX; $rootScope.lastY; var ctx; $rootScope.OnPaintCanvasMouseDown = function (event) { if ($rootScope.isAnnotatiomToolBarPopupClosed == false) { var canvasElement = document.getElementById("canvas"); var ctx = canvasElement.getContext("2d"); // var x = event.clientX; // var y = event.clientY; $rootScope.offsetX1 = 0; $rootScope.offsetY1 = 0; //alert($location.path()); var canvasDiv = document.getElementById('canvasDiv'); var verticalScrollPosition = canvasDiv.scrollTop; var horizontlScrollPosition = canvasDiv.scrollLeft; $rootScope.offsetX1 = event.offsetX; $rootScope.offsetY1 = event.offsetY; ctx.clearRect(0, 0, 2277, 3248); $rootScope.clicked = true; // alert("x:"+$rootScope.offsetX1 + " y:" + $rootScope.offsetY1); canvasElement.addEventListener('mousemove', $rootScope.OnPaintCanvasMouseMove, false); } } $rootScope.rectNumber = 0; $rootScope.LineNumber = 0; $rootScope.CircleNumber = 0; $rootScope.ArrowNumber = 0; $rootScope.PinNumber = 0; $rootScope.PinArcNumber = 0; $rootScope.ObjectIndex = 0; $rootScope.ArcObjectIndex = 0; $rootScope.PinObjectIndex = 0; $rootScope.TextNumber = 0; $rootScope.resetTextSave = 0; $rootScope.ObjectIndexSave = 0; var arrayRect = {}; var storeLine = ''; $rootScope.OnPaintCanvasMouseUp = function (event) { if (!$rootScope.clicked) { return; } if ($rootScope.isAnnotatiomToolBarPopupClosed == false) { var AnnotationCanvas = document.getElementById('canvas'); AnnotationCanvas.removeEventListener('mousemove', $rootScope.OnPaintCanvasMouseMove, false); $(".line").remove(); $(".arrow").remove(); $(".pin").remove(); $(".circle").remove(); $(".rectangle").remove(); $(".textarea").remove(); $rootScope.clicked = false; $rootScope.x = 0; $rootScope.y = 0; var canvasDiv = document.getElementById('canvasDiv'); var verticalScrollPosition = canvasDiv.scrollTop; var horizontlScrollPosition = canvasDiv.scrollLeft; $rootScope.x = event.pageX + horizontlScrollPosition - $('#canvasDiv').offset().left; $rootScope.y = event.pageY + verticalScrollPosition - $('#canvasDiv').offset().top; var canvasElement = document.getElementById("canvas"); var ctx = canvasElement.getContext("2d"); var canvasPaintElement = document.getElementById("canvasPaint"); var PaintCanvasctx = canvasPaintElement.getContext("2d"); switch ($rootScope.shapeType) { case "cursor": ctx.beginPath(); PaintCanvasctx.beginPath(); break; case "Line": $rootScope.isAnnotaionToolBarDrawingModeActive = true; $rootScope.LineNumber = $rootScope.ObjectIndex++; // $rootScope.isLinePreviewCompleted = true; $rootScope.DrawLineOnModuleItem('#canvas', $rootScope.LineNumber, $rootScope.shapestyleborderColor, $rootScope.shapestyleborderWidth, $rootScope.offsetX1, $rootScope.offsetY1, $rootScope.x, $rootScope.y) break; case "Rectangle": $rootScope.isAnnotaionToolBarDrawingModeActive = true; $rootScope.rectNumber = $rootScope.ObjectIndex++; // $rootScope.isRectanglePreviewCompleted = true; $rootScope.DrawRectangleOnModuleItem('#canvas', $rootScope.rectNumber, $rootScope.shapestyleFillColor, $rootScope.shapestyleborderColor, $rootScope.shapestyleOpacity, $rootScope.shapestyleborderWidth, $rootScope.offsetX1, $rootScope.offsetY1, $rootScope.x, $rootScope.y); break; case "Circle": $rootScope.isAnnotaionToolBarDrawingModeActive = true; $rootScope.CircleNumber = $rootScope.ObjectIndex++; // $rootScope.isCirclePreviewCompleted = true; $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.isAnnotaionToolBarDrawingModeActive = true; $rootScope.ArrowNumber = $rootScope.ObjectIndex++; //$rootScope.isArrowPreviewCompleted = true; $rootScope.DrawArrowOnModuleItem('#canvas', $rootScope.ArrowNumber, $rootScope.shapestyleborderColor, $rootScope.shapestyleborderWidth, $rootScope.offsetX1, $rootScope.offsetY1, $rootScope.x, $rootScope.y); break; case "Pin": $rootScope.isAnnotaionToolBarDrawingModeActive = true; $rootScope.PinNumber = $rootScope.PinObjectIndex++; $rootScope.PinArcNumber = $rootScope.ArcObjectIndex++; //$rootScope.isPinPreviewCompleted = true; $rootScope.DrawPinOnModuleItem('#canvas', $rootScope.PinNumber, $rootScope.offsetX1, $rootScope.offsetY1, $rootScope.x, $rootScope.y, $rootScope.PinArcNumber); break; case "TextArea": $rootScope.isAnnotaionToolBarDrawingModeActive = true; $rootScope.IsTextAlreadySave = false; $("#text_area").val(''); // Draw text $rootScope.resetTextRect = $rootScope.ObjectIndex++; $rootScope.TextNumber = $rootScope.ObjectIndex++; // $rootScope.isTextAreaPreviewCompleted = true; $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": break; } } //} } $rootScope.OnPaintCanvasMouseMove = function (event) { var canvasDiv = document.getElementById('canvasDiv'); var verticalScrollPosition = canvasDiv.scrollTop; var horizontlScrollPosition = canvasDiv.scrollLeft; $rootScope.MouseMoveXAxis = event.pageX + horizontlScrollPosition - $('#canvasDiv').offset().left; $rootScope.MouseMoveYAxis = event.pageY + verticalScrollPosition - $('#canvasDiv').offset().top; switch ($rootScope.shapeType) { case "Line": $(".line").remove(); $rootScope.isLinePreviewCompleted = true; $("#canvasDiv").append("
"); $rootScope.Annotationangle(); break; case "Arrow": $(".arrow").remove(); $rootScope.isArrowPreviewCompleted = true; $("#canvasDiv").append("