{"version":3,"sources":["../js/GreenlightEvents.js"],"names":["$","bTicking","dtLastScroll","bLastScrollCanvas","iaKeysPressed","bIsMarqueeZoomLastTool","mouseWheelRedraw","oCanvas","oSyncCanvas","Date","g_szCanvasId","g_bIsDragging","redraw","i","length","isCurrentDocumentThreeDPreview","oApprovalFiles","g_oApprovalFiles","g_oControlIndex","comboControl_GetControlById","iCurrentDocumentIndex","g_iCurrentDocIndex","g_Docs","document","Approval3DViewId","ConfirmApprove","g_oApproval","ApprovalConditionsMet","SetApproverStatus","eApproverStatus","Approved","ConfirmConditionalApprove","ApprovedChanges","ConfirmReject","RejectionConditionsMet","ConfirmRejectMultiple","toggle","lockScreen","oJSON","ApprovalId","greenlightApprovalId","post","url","data","JSON","stringify","contentType","dataType","cache","success","oResponse","Status","jqXHR","Success","Contents","Rejected","g_oGreenlightMessages","displayWarningBubble","c_szMissingAnnotationsWarning","displayErrorBubble","displayErrorContentHTML","Errors","always","unlockScreen","window","on","event","requestAnimationFrame","mouseWheelEvent","preventDefault","stopPropagation","g_oViewer","getCanvas","target","id","g_iCanvasType","eCanvasType","Annotation","getLinkedArtworkCanvas","g_bIsAnimating","g_oCompare","getSyncCanvas","g_oCompareMode","eCompareMode","SideBySide","bWheelUp","originalEvent","deltaY","shiftKey","g_iDragOffset_y","g_iCenterShift_y","setTimeout","altKey","g_iDragOffset_x","g_iCenterShift_x","ctrlKey","g_oCanvasZoom","scrollZoom","parseInt","g_oSettings","g_oUserSettings","ScrollPreference","scrollZoomOut","e","click","g_oArtworkViewer","g_iCurrentPage","g_oAnnotations","checkForUnsavedAnnotation","changeCurrentPage","EventService","publish","g_oAnnotationViewer","thisParent","this","parent","highlightSelectedButton","clearHighlightSelectedButton","g_oDoc","pages","g_oTextTools","g_bHighlightInProgress","changeCanvasFunction","endhighlight","removeClass","currentTimeoutListClear","highlightButtonClearingAllIcons","g_oAnnotationsMade","g_bClosed","g_oTechTools","pan","g_oCompareViewer","iRotDegrees","rotate","g_oTextCompare","g_bDifferencesCalculated","g_bArtworkTextDataLoaded","g_bCompareTextDataLoaded","parents","remove","g_bAutoActivatePanTool","g_bTextCompareDivShown","toggleTextCompareDiv","initialiseTextCompareHighlight","initialiseTextCompareParagraphHighlight","initialiseTextCompareAreaHighlight","zoomIn","zoomOut","zoomReset","marqueeZoom","clearTextData","displayConfirmBubble","g_oThreeDView","c_szThreeDViewApprovalDecision","bOpen","find","is","slideToggle","className","indexOf","zindex","oArtworkCanvas","attr","oAnnotationCanvas","g_oAnnotationCanvas","css","origCoords","getClickCoords","currentPos","that","coords","left","c_iDPI","top","addClass","g_oContext","clearRect","g_oCanvas","width","height","documentType","eDocumentTypes","ThreeD","redrawAnnotations","redraw3DAnnotations","repositionSpeechBubbles","off","toggleAnnotationsDiv","toggleSeparationsDiv","g_oSVGCopyMagic","toggleCopyMagicSlideOut","g_oSeparations","ResetAllCanvasImages","StepThroughCanvasImages","g_bNonAnnotationActionInProgress","bAnnotationMode","g_iApprovalType","g_oaComboControls","documents","selectedDocumentIndex","initiateAnnotationDraw","hide","updateAnnotationMode","toolTypeChange","keyCode","g_szPrevCursorStyle","removeExistingHighlights","bTextHighlightEnded","checkIfNewSpeechBubbleExists","c_szUnsavedAnnotation","g_iSelectedMeasurementType","g_eMeasurementTypes","NONE","clearBarcodeMeasurementArray","dragDiscontinue","g_oTempAnnotationArray","getCanvasByName","AnnotationAction","prototype","mouseMoveLite","g_oTextCompare_AutoSelection","isAutoSelectionEnabled","closeBubbles","toggleHighlightDirection","Blink","Overlay","g_bSliderVertical","eSliderType","SliderVertical","SliderHorizontal","bKeepDocuments","SideBySideDiff","toolTypeClear","g_bIsAnimateDifferencesOn","show","toggleDifferences","annotationColourChange","oColourGrid","getElementById","cloneNode","style","background","c_iSkinType","display","zIndex","classList","add","appendChild","getStringColour","AnnotationColour","ShowAnnotations","closeActiveAnnotations","c_bFindSVGText","g_oCompareAnnotationViewer","NoCompare","updateSettingShowAnnotations","val","updateSettingScrollPreference","ZoomSpeed","updateSettingZoomSpeed","g_oActiveCanvasList","isThreeDCanvas","g_iAnimateFrames","getAnimationFramesForZoomSpeed","ZoomIncrements","updateSettingZoomIncrements","g_iZoomMultiplier","getZoomMultiplierForZoomIncrement","AlignmentPreference","updateSettingAlignmentPreference","HighlightPreference","updateSettingHighlightPreference","displayHighlightInfo","TextComparisonHighlightColour","updateTextCompareHighlightColour","getAttribute","TextComparisonAccuracy","updateSettingTextComparisonAccuracy","updateTextCompareSettings","TextComparisonCaseSensitivity","updateSettingTextComparisonCaseSensitivity","TextComparisonBoldItalicDetection","updateSettingTextComparisonBoldItalicDetection","TextComparisonWhitespaceDetection","updateSettingTextComparisonWhitespaceDetection","TextComparisonAutoSelection","updateSettingTextComparisonAutoSelection","tooltipster","c_szAutoSelectionDisabled","c_szAutoSelectionEnabled","szId","iId","getIdFromElementId","result","grep","annotation","children","g_iParentAnnotationId","g_bSaved","g_oRenderer","render","g_oScene","g_oCamera","g_iAnnotationType","eAnnotationTypes","TextMeasurement","setTextMeasurementWordVisibility","g_oTextMeasurementWordsArray","rebuildAnnotationList","ann","relatedResult","concat","deleteAnnotation","annotationReplyId","split","annotationReplyExists","deleteAnnotationReply","parentContainer","slideUp","filter","some","g_oReplies","annotationReply","iAnnotationId","bSVGAnnotation","g_bSVGTextAnnotation","LeftMenuCollapse","slideDiv","g_oAudit","getAnnotationAudit","closeAnnotationAudit","oMatchingAnnotation","g_oAnnotationData","renderAnnotationData","closeAnnotationData","g_oAnnotationAttachments","szSessionId","g_szSessionId","displaySuccessBubble","g_oMultiView","c_szCopyAnnotationSuccess","copiedAnnotationIds","merge","parse","AnnotationIds","sync","substring","oData","oAnnotation","existingAnnotationDivs","hasClass","panToAnnotation","createAnnotationDiv","eAnnotationDivType","Popup","newZPosition","markup","child","Id","lookAt","position","z","set","x","y","renderPopupAttachments","displayUploadPopUp","hidePopupWindow","RemoveLastColourSelection","szStatus","iStatusCode","eAnnotationStatuses","Query","ToDo","getAnnotationCanvasId","iExistingStatus","g_oStatuses","status","g_iAuthor","g_oUserDetails","UserId","g_bUnlocked","iStatusChangeAction","setAnnotationStatusUpdateAction","eAnnotationStatusUpdateType","addStatus","oNewAnnotationStatus","createAnnotationStatus","g_iApprovalUserAnnotId","g_szAuthorEmail","EmailAddress","g_iAnnotationStatus","annotationStatusDateTime","now","statusContainerId","createAnnotationTextArea","statusContainerListId","push","updateStatus","iOriginalAuthorId","iNewAuthorId","relatedPopups","textContent","setAttribute","prev","getDisplayName","formatDate","relatedAnnotationListItems","g_iApprovalId","deleteStatus","annotationSaveStatus","deleteAnnotationStatus","renderAnnotationStatusTooltips","ScrollStatusAnnotationList","stepThroughAnnotations","ShowAnnotationNumbers","fadeOut","fadeIn","updateSettingShowAnnotationNumbers","bUseCompareApproval","prop","oDocs","CreateAnnotationsReport","g_oFilter","toggleAnnotationFilters","value","trim","resetFilterOptions","updateFilterOptions","toLowerCase","which","clickFilterOption","selectNextFilterOption","selectPreviousFilterOption","match","c_szFilter_Message_UnableToFilter","resetActiveFilters","animate","szSearchContent","g_oSVGSearch","searchSVGText","g_oSVGText","removeSVGSearchAnnotations","removeSVGHoverAnnotations","clearSVGSearch","zoomSlide","RenderThreeDViews","RenderModels","szThreeDControlDownArrow","szThreeDControlRightArrow","g_oSavedCalipers","SelectivelyShowCaliperFlexArrows","POINTTOPOINT","g_oMarquee","initiateMarqueeDraw","PointToPointMeasurement","currentTarget","measurementMarqueeDraw","measurementPointerUp","AREA","AreaMeasurement","CaliperMeasurementOptionHover","HORIZONTAL","HorizontalCalliperMeasurement","VERTICAL","VerticalCalliperMeasurement","hover","CaliperMeasurementOptionHoverLeave","TechToolsHoverLeave","GetElementId","ClearSavedMeasurementsDiv","BARCODE","BarcodeMeasurement","COLOURDENSITY","ColourDensityMeasurement","TEXT","forceToggleAnnotationDocument","g_oLastUsedTool","eAnnotationCreationType","parentElement","TextClassification","TextHighlight","g_oTextData","loadTextData","documentId","g_iExistingAnnotationId","g_oAnnotationText","initialiseTextTool","g_eToolTypes","g_oAnnotationColSelected","UseMetricUnits","g_bIgnoreNextClickEvent","SkinType","updateSettingSkinType","DateFormat","updateSettingDateFormat","oCompareOffsetPixels","oAlignmentOffsetPixels_Viewer","oAlignmentOffsetPixels_Compare","oAlignmentOffsetPixels_Saved","oAlignmentGuidencePixels_Tolerance","convertMeasurementToPixels","g_oAlignment_SavedCompareOffsetX","g_oAlignment_SavedCompareOffsetY","oCompareOffsetMeasurement","convertPixelsToMeasurement","oAlignmentOffsetMeasurement_Viewer","oAlignmentOffsetMeasurement_Compare","oAlignmentOffsetMeasurement_Saved","oAlignmentGuidenceMeasurement_Tolerance","updateSettingMeasurementPreference","clearToolType","g_oDifferencesAnnotationViewer","SpinnerElementName","c_szSeparationPercentageElementName","c_szSeparationPercentage_BarcodeElementName","updateTolerance","updateGhosting","updateBlinkSpeed","toggleAnnotationDocument","ToggleOverprintPreview","getimagePNGData","OverprintColour","updateSettingOverprintColour","setupCanvasForAlignment","g_oAutomaticAlignmentRequest","GetCompareDocumentDetails","activateCompare","g_oCompareDocument","g_oComparePage","updateGuidedTolerance","performManualAlignment","performGuidedAlignment","hideAlignmentInformation","toggleToleranceMenu","bClockwise","updateCompareRotation","g_iCompareRotationDegrees","oValidatedPosition","validateComparePositions","xPos","yPos","g_bManualAlignmentSet","updateCompareOffset","g_szLastAlignmentTool","markerPlacement","markerFineTune","updateMarkerAlignment","confirmMarkerPositions","cancelMarkerPositions","resetAlignmentMode","toggleAlignmentInformation","setupCanvasForTextCompare","resetDifferences","resetTextCompareHiddenSeparations","storeActiveTextSelectionGroups","hideTextCompareInformation","hideTextCompareSeparations","hideTextCompareDiv","exitTextCompareMode","calculateDifferences","g_oConsumerSettings","LockTextComparisonAutoSelection","c_szSettingLocked","isNaN","TextComparisonAutoSelectionFuzzyThreshold","updateSettingTextComparisonFuzzyThreshold","toggleTextCompareInformation","toggleTextCompareFullDocumentSelectionOptions","toggleTextCompareSeparations","toggleTextCompareHighlightColour","keyup","iKeycode","bPerformKeyboardShortcut","iKeyboardShortcutBehaviour","splice","g_bTextCompareInProgress","eKeyboardShorcutBehaviours","PanTextCompare","Pan","activeElement","contentEditable","nodeName","oaCanvasObjects","getArtworkCanvas","Canvas","setActiveTextSelectionTool","keydown","metaKey","ZoomIn","ZoomOut","ZoomReset","storeActiveTextSelectionTool","contains","bAllowShortcut","g_bAlignmentModeActive","debounce","resize","g_bDocNotChanged","orientation","resizeWindow","updateTextCompareDiv","IsCaliperRedrawMode","RebindCaliperRedrawEvent","modalOverlayResize","ResizeColourSelection"],"mappings":"AAaAA,EAAE,WAED,aAGA,IAAIC,UAAW,EAGXC,cAAe,EACfC,kBAAoB,KAGpBC,cAAgB,GAGhBC,wBAAyB,EAgL7B,SAASC,iBAAiBC,QAASC,aAMlC,GAAsC,GAH1B,IAAIC,KAGFP,cAAgB,KAAaC,mBAAqBI,QAAQG,aAAc,CAGrFH,QAAQI,eAAgB,EACxBJ,QAAQK,QAAO,GAGf,IAAK,IAAIC,EAAI,EAAGA,EAAIL,YAAYM,OAAQD,IACvCL,YAAYK,GAAGF,eAAgB,EAC/BH,YAAYK,GAAGD,QAAO,IA+bzB,SAASG,iCAER,IAAIC,eAAiBC,iBAAiBC,gBAAgBC,4BAA4B,4BAA4B,IAE1GC,sBAAwBJ,eAAeK,mBAG3C,OAAiF,EAA1EL,eAAeM,OAAOF,uBAAuBG,SAASC,iBAM9D,SAASC,iBAGHC,YAAYC,uBAAsB,IAKvCD,YAAYE,kBAAkBC,gBAAgBC,UAM/C,SAASC,4BAGHL,YAAYC,uBAAsB,IAKvCD,YAAYE,kBAAkBC,gBAAgBG,iBAM/C,SAASC,gBAGHP,YAAYQ,wBAAuB,KAML,EADdjB,iBAAiBC,gBAAgBC,4BAA4B,4BAA4B,IAC3FG,OAAOR,OAY3B,SAASqB,wBAGR,IAAInB,eAAiBC,iBAAiBC,gBAAgBC,4BAA4B,4BAA4B,IAG9GnB,EAAE,yBAAyBoC,QAAO,GAGlCC,aAIA,IAAIC,MAAQ,CAC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EAAEgE,QAAQC,GAAG,SAAUmhB,SAAS,SAASC,SACxC3jB,YAAY4jB,kBAAmB,OAGG,IAAvBthB,OAAOuhB,cAKdhhB,UAAUW,gBAAkBC,aAAa2K,UAG5CvL,UAAUihB,eAGFld,eAAe0b,0BAGvB1b,eAAeqa,iCAGf3d,WAAW+b,gBAAgBxc,UAAUW,eAAgBF,WAAWgc,mBAAoBhc,WAAWic,gBAG/F3Y,eAAemd,wBAMfzgB,WAAW+b,gBAAgBxc,UAAUW,eAAgBF,WAAWgc,mBAAoBhc,WAAWic,gBAI5FhZ,aAAayd,uBAChBxJ,iBAAiByJ,2BAIlB5Q,yBAAyB6Q,qBAGzB/gB,WAAW6I,UAAUmY,uBAAsB,KACzC,MAGH7lB,EAAEgE,QAAQC,GAAG,oBAAqBmhB,SAAS,SAASC,SACnD3jB,YAAY4jB,kBAAmB,EAE3B/gB,UAAUW,gBAAkBC,aAAa2K,UAG5CvL,UAAUihB,eAMVxgB,WAAW+b,gBAAgBxc,UAAUW,eAAgBF,WAAWgc,mBAAoBhc,WAAWic,iBAE9F","file":"GreenlightEvents-90dec243b3.js","sourcesContent":["/*\r\n* Copyright (c) 2017 SGS Europe. All rights reserved.\r\n*\r\n* This program is the CONFIDENTIAL and PROPRIETARY property of 2017 SGS Europe.\r\n* Any unauthorised use, reproduction, or transfer of this program is strictly\r\n* prohibited.\r\n*\r\n* File Name:\tGreenlightEvents.js\r\n*\r\n* Description:\tContains the code for the Greenlight Events.\r\n* \r\n*/\r\n\r\n$(function () {\r\n\r\n\t\"use strict\";\r\n\r\n\t// Determines if we are currently calling to try and reduce the amount of calls.\r\n\tvar bTicking = false;\r\n\r\n\t// Determines the last time the scroll was used to move the canvas.\r\n\tvar dtLastScroll = false;\r\n\tvar bLastScrollCanvas = null;\r\n\r\n\t// Store the valid key(s) which have been pressed.\r\n\tvar iaKeysPressed = [];\r\n\r\n\t// Flag to determine if the marquee zoom was the last used tool.\r\n\tvar bIsMarqueeZoomLastTool = false;\r\n\r\n\t/**\r\n\t * Mouse wheel event.\r\n\t */\r\n\t$(window).on('wheel', function (event) {\r\n\t\tif (!bTicking) {\r\n\t\t\twindow.requestAnimationFrame(function () {\r\n\t\t\t\ttry {\r\n\t\t\t\t\tmouseWheelEvent(event);\r\n\t\t\t\t}\r\n\t\t\t\tcatch (e) {\r\n\t\t\t\t\t// Error is thrown here when we try to zoom when the image is not loaded.\r\n\t\t\t\t\t// we don't have anything to return to the user when we catch the error,\r\n\t\t\t\t\t// we just want to ensure bTicking is set to False to allow zooming to continue functioning.\r\n\t\t\t\t}\r\n\t\t\t\tfinally {\r\n\t\t\t\t\tbTicking = false;\r\n\t\t\t\t}\r\n\t\t\t});\r\n\t\t}\r\n\t\tbTicking = true;\r\n\t});\r\n\r\n\t/**\r\n\t * Called on mouse wheel event.\r\n\t * @param {object} event - The calling event.\r\n\t */\r\n\tfunction mouseWheelEvent(event) {\r\n\t\tevent.preventDefault();\r\n\t\tevent.stopPropagation();\r\n\t\t\r\n\t\t// Try to get the canvas using the id.\r\n\t\tvar oCanvas = g_oViewer.getCanvas(event.target.id);\r\n\r\n\t\t// If we have found a suitable canvas.\r\n\t\tif (oCanvas != null) {\r\n\r\n\t\t\t// If the canvas is an annotation canvas.\r\n\t\t\tif (oCanvas.g_iCanvasType == eCanvasType.Annotation) {\r\n\r\n\t\t\t\t// Get the linked artwork canvas.\r\n\t\t\t\toCanvas = g_oViewer.getLinkedArtworkCanvas(oCanvas.g_szCanvasId);\r\n\t\t\t}\r\n\r\n\t\t\t// Perform no actions if we are currently zooming.\r\n\t\t\tif (oCanvas.g_bIsAnimating) {\r\n\t\t\t\treturn;\r\n\t\t\t}\r\n\r\n\t\t\t// Get a list of any sync canvas.\r\n\t\t\tvar oSyncCanvas = g_oCompare.getSyncCanvas(oCanvas);\r\n\r\n\t\t\t// If we are in side by side, we allow individual movement of canvas.\r\n\t\t\tif (g_oViewer.g_oCompareMode == eCompareMode.SideBySide) {\r\n\t\t\t\toSyncCanvas = [];\r\n\t\t\t}\r\n\r\n\t\t\t// Determine if we have wheeled up or down.\r\n\t\t\tvar bWheelUp = event.originalEvent.deltaY < 0; // DeltaY records vertical scroll, DeltaX and DeltaZ exist too.\r\n\r\n\t\t\t// Update the last scroll time and canvas.\r\n\t\t\tdtLastScroll = new Date();\r\n\t\t\tbLastScrollCanvas = oCanvas.g_szCanvasId;\r\n\r\n\t\t\t// If we are holding the shift key.\r\n\t\t\tif (event.shiftKey) {\r\n\r\n\t\t\t\t// Wheeled up.\r\n\t\t\t\tif (bWheelUp) {\r\n\r\n\t\t\t\t\t// Pan up.\r\n\t\t\t\t\toCanvas.g_iDragOffset_y -= 10;\r\n\t\t\t\t\toCanvas.g_iCenterShift_y -= 10;\r\n\t\t\t\t\toCanvas.g_bIsDragging = true;\r\n\t\t\t\t\toCanvas.redraw(true);\r\n\r\n\t\t\t\t\t// Pan up each sync canvas.\r\n\t\t\t\t\tfor (var i = 0; i < oSyncCanvas.length; i++) {\r\n\t\t\t\t\t\toSyncCanvas[i].g_iDragOffset_y -= 10;\r\n\t\t\t\t\t\toSyncCanvas[i].g_iCenterShift_y -= 10;\r\n\t\t\t\t\t\toSyncCanvas[i].g_bIsDragging = true;\r\n\t\t\t\t\t\toSyncCanvas[i].redraw(true);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\t// Wheeled down.\r\n\t\t\t\telse {\r\n\r\n\t\t\t\t\t// Pan down.\r\n\t\t\t\t\toCanvas.g_iDragOffset_y += 10;\r\n\t\t\t\t\toCanvas.g_iCenterShift_y += 10;\r\n\t\t\t\t\toCanvas.g_bIsDragging = true;\r\n\t\t\t\t\toCanvas.redraw(true);\r\n\r\n\t\t\t\t\t// Pan down each sync canvas.\r\n\t\t\t\t\tfor (var i = 0; i < oSyncCanvas.length; i++) {\r\n\t\t\t\t\t\toSyncCanvas[i].g_iDragOffset_y += 10;\r\n\t\t\t\t\t\toSyncCanvas[i].g_iCenterShift_y += 10;\r\n\t\t\t\t\t\toSyncCanvas[i].g_bIsDragging = true;\r\n\t\t\t\t\t\toSyncCanvas[i].redraw(true);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\r\n\t\t\t\t// Attempt to redraw the canvas after 1 second.\r\n\t\t\t\tsetTimeout(function () { mouseWheelRedraw(oCanvas, oSyncCanvas); }, 1000);\r\n\t\t\t}\r\n\t\t\t// If we are holding the ALT key.\r\n\t\t\telse if (event.altKey) {\r\n\r\n\t\t\t\t// Wheeled up.\r\n\t\t\t\tif (bWheelUp) {\r\n\r\n\t\t\t\t\t// Pan left.\r\n\t\t\t\t\toCanvas.g_iDragOffset_x -= 10;\r\n\t\t\t\t\toCanvas.g_iCenterShift_x -= 10;\r\n\t\t\t\t\toCanvas.g_bIsDragging = true;\r\n\t\t\t\t\toCanvas.redraw(true);\r\n\r\n\t\t\t\t\t// Pan left each sync canvas.\r\n\t\t\t\t\tfor (var i = 0; i < oSyncCanvas.length; i++) {\r\n\t\t\t\t\t\toSyncCanvas[i].g_iDragOffset_x -= 10;\r\n\t\t\t\t\t\toSyncCanvas[i].g_iCenterShift_x -= 10;\r\n\t\t\t\t\t\toSyncCanvas[i].g_bIsDragging = true;\r\n\t\t\t\t\t\toSyncCanvas[i].redraw(true);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\t// Wheeled down.\r\n\t\t\t\telse {\r\n\r\n\t\t\t\t\t// Pan right.\r\n\t\t\t\t\toCanvas.g_iDragOffset_x += 10;\r\n\t\t\t\t\toCanvas.g_iCenterShift_x += 10;\r\n\t\t\t\t\toCanvas.g_bIsDragging = true;\r\n\t\t\t\t\toCanvas.redraw(true);\r\n\r\n\t\t\t\t\t// Pan right each sync canvas.\r\n\t\t\t\t\tfor (var i = 0; i < oSyncCanvas.length; i++) {\r\n\t\t\t\t\t\toSyncCanvas[i].g_iDragOffset_x += 10;\r\n\t\t\t\t\t\toSyncCanvas[i].g_iCenterShift_x += 10;\r\n\t\t\t\t\t\toSyncCanvas[i].g_bIsDragging = true;\r\n\t\t\t\t\t\toSyncCanvas[i].redraw(true);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\r\n\t\t\t\t// Attempt to redraw the canvas after 1 second.\r\n\t\t\t\tsetTimeout(function () { mouseWheelRedraw(oCanvas, oSyncCanvas); }, 1000);\r\n\t\t\t}\r\n\t\t\t// If we are not holding any action key.\r\n\t\t\telse if (!event.ctrlKey) {\r\n\r\n\t\t\t\t// If we are currently dragging, do not zoom.\r\n\t\t\t\tif (oCanvas.g_bIsDragging) {\r\n\t\t\t\t\treturn;\r\n\t\t\t\t}\r\n\r\n\t\t\t\t// Wheeled up and we can zoom in.\r\n\t\t\t\tif (bWheelUp) {\r\n\t\t\t\t\t\r\n\t\t\t\t\t// Perform the scroll zoom.\r\n\t\t\t\t\toCanvas.g_oCanvasZoom.scrollZoom(event, oSyncCanvas, parseInt(g_oSettings.g_oUserSettings.ScrollPreference));\r\n\t\t\t\t}\r\n\t\t\t\t// Wheeled down and we can zoom out.\r\n\t\t\t\telse if (!bWheelUp) {\r\n\r\n\t\t\t\t\t// Perform the scroll zoom out.\r\n\t\t\t\t\toCanvas.g_oCanvasZoom.scrollZoomOut(event, oSyncCanvas, parseInt(g_oSettings.g_oUserSettings.ScrollPreference));\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\t/**\r\n\t * Redraw the canvas if a second has passed since the last scroll event.\r\n\t * @param {object} oCanvas - The canvas object to be redrawn.\r\n\t * @param {object} oSyncCanvas - An array of synchronised canvases that also need redrawing.\r\n\t */\r\n\tfunction mouseWheelRedraw(oCanvas, oSyncCanvas) {\r\n\r\n\t\t// Get the current date time.\r\n\t\tvar dtNow = new Date();\r\n\r\n\t\t// If it has been 1 second since the last scroll, or we have changed the scroll canvas.\r\n\t\tif (((dtNow - dtLastScroll) / 1000) > 1 || bLastScrollCanvas != oCanvas.g_szCanvasId) {\r\n\r\n\t\t\t// Redraw the canvas.\r\n\t\t\toCanvas.g_bIsDragging = false;\r\n\t\t\toCanvas.redraw(true);\r\n\r\n\t\t\t// Redraw each sync canvas.\r\n\t\t\tfor (var i = 0; i < oSyncCanvas.length; i++) {\r\n\t\t\t\toSyncCanvas[i].g_bIsDragging = false;\r\n\t\t\t\toSyncCanvas[i].redraw(true);\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\t/*\r\n\t * Page Navigation.\r\n\t */\r\n\r\n\t$(\"#btnPageBack\").click(function () {\r\n\t\tif (g_oViewer.g_oArtworkViewer.g_iCurrentPage !== 1) {\r\n\t\t\tif (!g_oAnnotations.checkForUnsavedAnnotation()) {\r\n\t\t\t\tg_oViewer.g_oArtworkViewer.g_iCurrentPage--;\r\n\t\t\t\tg_oViewer.g_oArtworkViewer.changeCurrentPage();\r\n\t\t\t\tEventService.publish(\"changeCurrentPage\", g_oViewer.g_oArtworkViewer, g_oViewer.g_oAnnotationViewer);\r\n\t\t\t\tvar thisParent = $(this).parent();\r\n\t\t\t\thighlightSelectedButton(thisParent, false);\r\n\t\t\t\tsetTimeout(function () { clearHighlightSelectedButton(thisParent); }, 500);\r\n\t\t\t}\r\n\t\t}\r\n\t});\r\n\r\n\t$(\"#btnPageForward\").click(function () {\r\n\t\tif (g_oViewer.g_oArtworkViewer.g_iCurrentPage !== g_oViewer.g_oArtworkViewer.g_oDoc.pages.length) {\r\n\t\t\tif (!g_oAnnotations.checkForUnsavedAnnotation()) {\r\n\t\t\t\tg_oViewer.g_oArtworkViewer.g_iCurrentPage++;\r\n\t\t\t\tg_oViewer.g_oArtworkViewer.changeCurrentPage();\r\n\t\t\t\tEventService.publish(\"changeCurrentPage\", g_oViewer.g_oArtworkViewer, g_oViewer.g_oAnnotationViewer);\r\n\t\t\t\tvar thisParent = $(this).parent();\r\n\t\t\t\thighlightSelectedButton(thisParent, false);\r\n\t\t\t\tsetTimeout(function () { clearHighlightSelectedButton(thisParent); }, 500);\r\n\t\t\t}\r\n\t\t}\r\n\t});\r\n\r\n\t/*\r\n\t * Artwork Navigation.\r\n\t */\r\n\r\n\t$(\"#btnPan\").click(function () {\r\n\r\n\t\t// If we have an active text highlight, end this and switch to the pan tool.\r\n\t\tif (g_oTextTools.g_bHighlightInProgress) {\r\n\t\t\tchangeCanvasFunction($(\"#AnnotationViewer\"), 'pointermove.annotationUI', function (event) {});\r\n\t\t\tg_oTextTools.endhighlight(g_oViewer.g_oArtworkViewer, g_oViewer.g_oAnnotationViewer, true);\r\n\t\t}\r\n\r\n\t\t// Setup the icon.\r\n\t\t$(\"#tblNavTools .selectedButton\").removeClass(\"selectedButton\");\r\n\t\tg_oAnnotations.currentTimeoutListClear();\t// Ensure that an annotation save action doesn't overwrite this function's event handlers.\r\n\t\t$(\"#tblViewerNavTools .selectedButton\").removeClass(\"selectedButton\");\r\n\t\t$(\"#tblCompareNavTools .selectedButton\").removeClass(\"selectedButton\");\r\n\t\t$(\"#tblTextCompareTools .selectedButton\").removeClass(\"selectedButton\");\r\n\r\n\t\tvar thisParent = $(this).parent();\r\n\t\thighlightButtonClearingAllIcons(thisParent, true);\r\n\r\n\t\t// Close all annotations.\r\n\t\tfor (var i = 0; i < g_oAnnotations.g_oAnnotationsMade.length; i++) {\r\n\t\t\tg_oAnnotations.g_oAnnotationsMade[i].g_bClosed = true;\r\n\t\t}\r\n\t\tg_oTechTools.g_oAnnotationViewer.redraw(false);\r\n\r\n\t\t// Setup the pan on the main canvas.\r\n\t\tg_oViewer.pan(g_oCompare.getSyncCanvas(g_oViewer.g_oArtworkViewer));\r\n\t\tg_oCompare.pan(g_oCompare.getSyncCanvas(g_oCompare.g_oCompareViewer));\r\n\t});\r\n\r\n\t// Individual pan buttons.\r\n\t$(\"#btnPan_Viewer, #btnPan_Compare, #btnPan_Viewer_TextCompare, #btnPan_Compare_TextCompare\").click(function () {\r\n\r\n\t\t// If we have an active text highlight, end this and switch to the marquee tool.\r\n\t\tif (g_oTextTools.g_bHighlightInProgress) {\r\n\t\t\tchangeCanvasFunction($(\"#AnnotationViewer\"), 'pointermove.annotationUI', function (event) { });\r\n\t\t\tg_oTextTools.endhighlight(g_oViewer.g_oArtworkViewer, g_oViewer.g_oAnnotationViewer, true);\r\n\t\t}\r\n\r\n\t\t// Setup the icon.\r\n\t\t$(\"#tblNavTools .selectedButton\").removeClass(\"selectedButton\");\r\n\t\t$(\"#tblViewerNavTools .selectedButton\").removeClass(\"selectedButton\");\r\n\t\t$(\"#tblCompareNavTools .selectedButton\").removeClass(\"selectedButton\");\r\n\t\t$(\"#tblTextCompareTools .selectedButton\").removeClass(\"selectedButton\");\r\n\r\n\t\t// Highlight the icons.\r\n\t\tswitch (this.id) {\r\n\t\t\tcase \"btnPan_Viewer\":\r\n\t\t\tcase \"btnPan_Compare\":\r\n\t\t\t\thighlightSelectedButton($(\"#btnPan_Viewer\"), false);\r\n\t\t\t\thighlightSelectedButton($(\"#btnPan_Compare\"), false);\r\n\t\t\t\tbreak;\r\n\t\t\tcase \"btnPan_Viewer_TextCompare\":\r\n\t\t\tcase \"btnPan_Compare_TextCompare\":\r\n\t\t\t\thighlightSelectedButton($(\"#btnPan_Viewer_TextCompare\"), false);\r\n\t\t\t\thighlightSelectedButton($(\"#btnPan_Compare_TextCompare\"), false);\r\n\t\t\t\tbreak;\r\n\t\t}\r\n\r\n\t\t// Setup the pan on the main and compare canvas.\r\n\t\tg_oViewer.pan([]);\r\n\t\tg_oCompare.pan([]);\r\n\t});\r\n\r\n\t// Individual rotate buttons.\r\n\t$(\"#btnRotate, #btnRotateAnti, #btnRotate_Viewer, #btnRotate_Viewer_Anti, #btnRotate_Compare, #btnRotate_Compare_Anti, #btnRotate_Viewer_Anti_TextCompare, #btnRotate_Viewer_TextCompare, #btnRotate_Compare_Anti_TextCompare, #btnRotate_Compare_TextCompare\").click(function () {\r\n\t\t\r\n\t\t// If we have an active text highlight, end this and switch to the marquee tool.\r\n\t\tif (g_oTextTools.g_bHighlightInProgress) {\r\n\t\t\tchangeCanvasFunction($(\"#AnnotationViewer\"), 'pointermove.annotationUI', function (event) { });\r\n\t\t\tg_oTextTools.endhighlight(g_oViewer.g_oArtworkViewer, g_oViewer.g_oAnnotationViewer, true);\r\n\t\t}\r\n\r\n\t\t// Setup the icon.\r\n\t\tvar thisParent = $(this).parent();\r\n\t\thighlightSelectedButton(thisParent, false);\r\n\t\tsetTimeout(function () { clearHighlightSelectedButton(thisParent); }, 500);\r\n\r\n\t\t// Determine direction\r\n\t\tvar iRotDegrees = $(this).data('rotation');\r\n\r\n\t\t// Perform the rotation.\r\n\t\tswitch (this.id) {\r\n\t\t\tcase \"btnRotate\":\r\n\t\t\tcase \"btnRotateAnti\":\r\n\t\t\t\tg_oViewer.rotate(g_oCompare.getSyncCanvas(g_oViewer.g_oArtworkViewer), iRotDegrees);\r\n\t\t\t\tbreak;\r\n\t\t\tcase \"btnRotate_Viewer\":\r\n\t\t\tcase \"btnRotate_Viewer_Anti\":\r\n\t\t\tcase \"btnRotate_Viewer_TextCompare\":\r\n\t\t\tcase \"btnRotate_Viewer_Anti_TextCompare\":\r\n\t\t\t\tg_oViewer.rotate([], iRotDegrees);\r\n\t\t\t\tbreak;\r\n\t\t\tcase \"btnRotate_Compare\":\r\n\t\t\tcase \"btnRotate_Compare_Anti\":\r\n\t\t\tcase \"btnRotate_Compare_TextCompare\":\r\n\t\t\tcase \"btnRotate_Compare_Anti_TextCompare\":\r\n\t\t\t\tg_oCompare.rotate([], iRotDegrees);\r\n\t\t\t\tbreak;\r\n\t\t}\r\n\t});\r\n\r\n\t// Individual text highlight buttons.\r\n\t$(\"#btnTextHighlight_Viewer_TextCompare, #btnTextHighlight_Compare_TextCompare, #btnParagraphHighlight_Viewer_TextCompare, #btnParagraphHighlight_Compare_TextCompare, #btnAreaTextHighlight_Viewer_TextCompare, #btnAreaTextHighlight_Compare_TextCompare\").click(function (event) {\r\n\t\t\r\n\t\t// If we have calculated differences, this can not be used.\r\n\t\tif (g_oTextCompare.g_bDifferencesCalculated) {\r\n\t\t\tg_oGreenlightMessages.displayWarningBubble(\"Cannot use when in differences mode.\");\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\t// If text has not been loaded for one or more canvas, this can not be used.\r\n\t\tif (!g_oTextCompare.g_bArtworkTextDataLoaded || !g_oTextCompare.g_bCompareTextDataLoaded) {\r\n\t\t\tg_oGreenlightMessages.displayErrorBubble(\"One or more documents have no live text.\");\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\t// Remove any existing text highlight info bubbles.\r\n\t\t$(\".speechbubble__texthighlight\").parents(\".bubbleInfo\").remove();\r\n\r\n\t\t// If we are in a text highlight, this must be ended first, without automatically activating the pan tool.\r\n\t\tif (g_oTextTools.g_bHighlightInProgress) {\r\n\t\t\tg_oTextCompare.g_bAutoActivatePanTool = false;\r\n\t\t\tg_oTextTools.endhighlight(g_oViewer.g_oArtworkViewer, g_oViewer.g_oAnnotationViewer, true);\r\n\t\t\tg_oTextCompare.g_bAutoActivatePanTool = true;\r\n\t\t}\r\n\r\n\t\t// If the review screen is open, close this.\r\n\t\tif (g_oTextCompare.g_bTextCompareDivShown) {\r\n\t\t\tg_oTextCompare.toggleTextCompareDiv();\r\n\t\t}\r\n\r\n\t\t// Clear the selected button.\r\n\t\t$(\"#tblNavTools .selectedButton\").removeClass(\"selectedButton\");\r\n\t\t$(\"#tblViewerNavTools .selectedButton\").removeClass(\"selectedButton\");\r\n\t\t$(\"#tblCompareNavTools .selectedButton\").removeClass(\"selectedButton\");\r\n\t\t$(\"#tblTextCompareTools .selectedButton\").removeClass(\"selectedButton\");\r\n\r\n\t\t// Highlight the selected button.\r\n\t\thighlightSelectedButton($(\"#\" + this.id), false);\r\n\r\n\t\t// Activate the text compare highlight.\r\n\t\tswitch (this.id) {\r\n\t\t\tcase \"btnTextHighlight_Viewer_TextCompare\":\r\n\t\t\t\tg_oTextCompare.initialiseTextCompareHighlight(false, null);\r\n\t\t\t\tbreak;\r\n\t\t\tcase \"btnTextHighlight_Compare_TextCompare\":\r\n\t\t\t\tg_oTextCompare.initialiseTextCompareHighlight(true, null);\r\n\t\t\t\tbreak;\r\n\t\t\tcase \"btnParagraphHighlight_Viewer_TextCompare\":\r\n\t\t\t\tg_oTextCompare.initialiseTextCompareParagraphHighlight(false, null);\r\n\t\t\t\tbreak;\r\n\t\t\tcase \"btnParagraphHighlight_Compare_TextCompare\":\r\n\t\t\t\tg_oTextCompare.initialiseTextCompareParagraphHighlight(true, null);\r\n\t\t\t\tbreak;\r\n\t\t\tcase \"btnAreaTextHighlight_Viewer_TextCompare\":\r\n\t\t\t\tg_oTextCompare.initialiseTextCompareAreaHighlight(false, null);\r\n\t\t\t\tbreak;\r\n\t\t\tcase \"btnAreaTextHighlight_Compare_TextCompare\":\r\n\t\t\t\tg_oTextCompare.initialiseTextCompareAreaHighlight(true, null);\r\n\t\t\t\tbreak;\r\n\t\t}\r\n\t});\r\n\r\n\t$(\"#btnZoomIn\").click(function (event) {\r\n\r\n\t\t// Setup the icon.\r\n\t\tvar thisParent = $(this).parent();\r\n\t\thighlightSelectedButton(thisParent, false);\r\n\t\tsetTimeout(function () { clearHighlightSelectedButton(thisParent); }, 500);\r\n\r\n\t\t// Perform the zoom in.\r\n\t\tg_oViewer.zoomIn(g_oCompare.getSyncCanvas(g_oViewer.g_oArtworkViewer));\r\n\t});\r\n\r\n\t$(\"#btnZoomOut\").click(function () {\r\n\r\n\t\t// Setup the icon.\r\n\t\tvar thisParent = $(this).parent();\r\n\t\thighlightSelectedButton(thisParent, false);\r\n\t\tsetTimeout(function () { clearHighlightSelectedButton(thisParent); }, 500);\r\n\r\n\t\t// Perform the zoom out.\r\n\t\tg_oViewer.zoomOut(g_oCompare.getSyncCanvas(g_oViewer.g_oArtworkViewer));\r\n\t});\r\n\r\n\t$(\"#btnZoomIn_Viewer, #btnZoomIn_Compare, #btnZoomIn_Viewer_TextCompare, #btnZoomIn_Compare_TextCompare\").click(function (event) {\r\n\t\t\r\n\t\t// Setup the icon.\r\n\t\tvar thisParent = $(this).parent();\r\n\t\thighlightSelectedButton(thisParent, false);\r\n\t\tsetTimeout(function () { clearHighlightSelectedButton(thisParent); }, 500);\r\n\r\n\t\t// Perform the zoom in.\r\n\t\tswitch (this.id) {\r\n\t\t\tcase \"btnZoomIn_Viewer\":\r\n\t\t\tcase \"btnZoomIn_Viewer_TextCompare\":\r\n\t\t\t\tg_oViewer.zoomIn([]);\r\n\t\t\t\tbreak;\r\n\t\t\tcase \"btnZoomIn_Compare\":\r\n\t\t\tcase \"btnZoomIn_Compare_TextCompare\":\r\n\t\t\t\tg_oCompare.zoomIn([]);\r\n\t\t\t\tbreak;\r\n\t\t}\r\n\t});\r\n\r\n\t$(\"#btnZoomOut_Viewer, #btnZoomOut_Compare, #btnZoomOut_Viewer_TextCompare, #btnZoomOut_Compare_TextCompare\").click(function () {\r\n\r\n\t\t// Setup the icon.\r\n\t\tvar thisParent = $(this).parent();\r\n\t\thighlightSelectedButton(thisParent, false);\r\n\t\tsetTimeout(function () { clearHighlightSelectedButton(thisParent); }, 500);\r\n\r\n\t\t// Perform the zoom out.\r\n\t\tswitch (this.id) {\r\n\t\t\tcase \"btnZoomOut_Viewer\":\r\n\t\t\tcase \"btnZoomOut_Viewer_TextCompare\":\r\n\t\t\t\tg_oViewer.zoomOut([]);\r\n\t\t\t\tbreak;\r\n\t\t\tcase \"btnZoomOut_Compare\":\r\n\t\t\tcase \"btnZoomOut_Compare_TextCompare\":\r\n\t\t\t\tg_oCompare.zoomOut([]);\r\n\t\t\t\tbreak;\r\n\t\t}\r\n\t});\r\n\r\n\t$(\"#btnZoomReset\").click(function () {\r\n\r\n\t\t// Setup the icon.\r\n\t\tvar thisParent = $(this).parent();\r\n\t\thighlightSelectedButton(thisParent, false);\r\n\t\tsetTimeout(function () { clearHighlightSelectedButton(thisParent); }, 500);\r\n\r\n\t\t// Perform the zoom reset.\r\n\t\tg_oViewer.zoomReset(g_oCompare.getSyncCanvas(g_oViewer.g_oArtworkViewer));\r\n\t});\r\n\r\n\t$(\"#btnZoomReset_Viewer, #btnZoomReset_Compare, #btnZoomReset_Viewer_TextCompare, #btnZoomReset_Compare_TextCompare\").click(function () {\r\n\r\n\t\t// Setup the icon.\r\n\t\tvar thisParent = $(this).parent();\r\n\t\thighlightSelectedButton(thisParent, false);\r\n\t\tsetTimeout(function () { clearHighlightSelectedButton(thisParent); }, 500);\r\n\r\n\t\t// Perform the zoom reset.\r\n\t\tswitch (this.id) {\r\n\t\t\tcase \"btnZoomReset_Viewer\":\r\n\t\t\tcase \"btnZoomReset_Viewer_TextCompare\":\r\n\t\t\t\tg_oViewer.zoomReset([]);\r\n\t\t\t\tbreak;\r\n\t\t\tcase \"btnZoomReset_Compare\":\r\n\t\t\tcase \"btnZoomReset_Compare_TextCompare\":\r\n\t\t\t\tg_oCompare.zoomReset([]);\r\n\t\t\t\tbreak;\r\n\t\t}\r\n\t});\r\n\r\n\t$(\"#btnZoomMarquee\").click(function (event) {\r\n\r\n\t\t// If we have an active text highlight, end this and switch to the marquee tool.\r\n\t\tif (g_oTextTools.g_bHighlightInProgress) {\r\n\t\t\tchangeCanvasFunction($(\"#AnnotationViewer\"), 'pointermove.annotationUI', function (event) { });\r\n\t\t\tg_oTextTools.endhighlight(g_oViewer.g_oArtworkViewer, g_oViewer.g_oAnnotationViewer, true);\r\n\t\t}\r\n\r\n\t\t// Setup the icon.\r\n\t\t$(\"#tblNavTools .selectedButton\").removeClass(\"selectedButton\");\r\n\t\tg_oAnnotations.currentTimeoutListClear();\t// Ensure that an annotation save action doesn't overwrite this function's event handlers.\r\n\t\t$(\"#tblViewerNavTools .selectedButton\").removeClass(\"selectedButton\");\r\n\t\t$(\"#tblCompareNavTools .selectedButton\").removeClass(\"selectedButton\");\r\n\t\t$(\"#tblTextCompareTools .selectedButton\").removeClass(\"selectedButton\");\r\n\t\tvar thisParent = $(this).parent();\r\n\t\thighlightButtonClearingAllIcons(thisParent, true);\r\n\r\n\t\t// Setup the marquee zoom.\r\n\t\tg_oViewer.marqueeZoom(g_oCompare.getSyncCanvas(g_oViewer.g_oArtworkViewer));\r\n\t\tg_oCompare.marqueeZoom(g_oCompare.getSyncCanvas(g_oCompare.g_oCompareViewer));\r\n\t});\r\n\r\n\t$(\"#btnZoomMarquee_Viewer, #btnZoomMarquee_Compare, #btnZoomMarquee_Viewer_TextCompare, #btnZoomMarquee_Compare_TextCompare\").click(function (event) {\r\n\r\n\t\t// If we have an active text highlight, end this and switch to the marquee tool.\r\n\t\tif (g_oTextTools.g_bHighlightInProgress) {\r\n\t\t\tchangeCanvasFunction($(\"#AnnotationViewer\"), 'pointermove.annotationUI', function (event) { });\r\n\t\t\tg_oTextTools.endhighlight(g_oViewer.g_oArtworkViewer, g_oViewer.g_oAnnotationViewer, true);\r\n\t\t}\r\n\r\n\t\t// Setup the icon.\r\n\t\t$(\"#tblNavTools .selectedButton\").removeClass(\"selectedButton\");\r\n\t\t$(\"#tblViewerNavTools .selectedButton\").removeClass(\"selectedButton\");\r\n\t\t$(\"#tblCompareNavTools .selectedButton\").removeClass(\"selectedButton\");\r\n\t\t$(\"#tblTextCompareTools .selectedButton\").removeClass(\"selectedButton\");\r\n\r\n\t\t// Highlight the correct icons.\r\n\t\tswitch (this.id) {\r\n\t\t\tcase \"btnZoomMarquee_Viewer\":\r\n\t\t\tcase \"btnZoomMarquee_Compare\":\r\n\t\t\t\thighlightSelectedButton($(\"#btnZoomMarquee_Viewer\"), false);\r\n\t\t\t\thighlightSelectedButton($(\"#btnZoomMarquee_Compare\"), false);\r\n\t\t\t\tbreak;\r\n\t\t\tcase \"btnZoomMarquee_Viewer_TextCompare\":\r\n\t\t\tcase \"btnZoomMarquee_Compare_TextCompare\":\r\n\t\t\t\thighlightSelectedButton($(\"#btnZoomMarquee_Viewer_TextCompare\"), false);\r\n\t\t\t\thighlightSelectedButton($(\"#btnZoomMarquee_Compare_TextCompare\"), false);\r\n\t\t\t\tbreak;\r\n\t\t}\r\n\r\n\t\t// Setup the marquee zoom.\r\n\t\tg_oViewer.marqueeZoom([]);\r\n\t\tg_oCompare.marqueeZoom([]);\r\n\t});\r\n\r\n\t// Clear text functionality.\r\n\t$(\"#btnTextClear_Viewer_TextCompare, #btnTextClear_Compare_TextCompare, #btnTextClear_Common_TextCompare\").click(function () {\r\n\r\n\t\t// If we have calculated differences, this can not be used.\r\n\t\tif (g_oTextCompare.g_bDifferencesCalculated) {\r\n\t\t\tg_oGreenlightMessages.displayWarningBubble(\"Cannot use when in differences mode.\");\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\t// If we have an active text highlight, do not allow this.\r\n\t\tif (g_oTextTools.g_bHighlightInProgress) {\r\n\t\t\tg_oGreenlightMessages.displayWarningBubble(\"Cannot use when highlighting.\");\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\t// Setup the icon.\r\n\t\tvar thisParent = $(this).parent();\r\n\t\thighlightSelectedButton(thisParent, false);\r\n\t\tsetTimeout(function () { clearHighlightSelectedButton(thisParent); }, 500);\r\n\r\n\t\t// Perform the zoom reset.\r\n\t\tswitch (this.id) {\r\n\t\t\tcase \"btnTextClear_Viewer_TextCompare\":\r\n\t\t\t\tg_oTextCompare.clearTextData(true, false, false);\r\n\t\t\t\tbreak;\r\n\t\t\tcase \"btnTextClear_Compare_TextCompare\":\r\n\t\t\t\tg_oTextCompare.clearTextData(false, true, false);\r\n\t\t\t\tbreak;\r\n\t\t\tcase \"btnTextClear_Common_TextCompare\":\r\n\t\t\t\tg_oTextCompare.clearTextData(true, true, false);\r\n\t\t\t\tbreak;\r\n\t\t}\r\n\t});\r\n\r\n\t/**\r\n\t * Approve Button.\r\n\t */\r\n\t$(\"#btnConfirmApprove\").click(function () {\r\n\r\n\t\t// If the current document is a 3D preview, we need to confirm the approval.\r\n\t\tif (isCurrentDocumentThreeDPreview()) {\r\n\t\t\tvar UserHasConfirmed = function () {\r\n\t\t\t\tConfirmApprove();\r\n\t\t\t};\r\n\r\n\t\t\t// Your decision will be applied to the parent 2D document. Continue?\r\n\t\t\tg_oGreenlightMessages.displayConfirmBubble(g_oThreeDView.c_szThreeDViewApprovalDecision, UserHasConfirmed, unlockScreen);\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\t// Confirm the approval.\r\n\t\tConfirmApprove();\r\n\t});\r\n\r\n\t/**\r\n\t * Conditional Approve Button.\r\n\t */\r\n\t$(\"#btnConfirmConditionalApprove\").click(function () {\r\n\r\n\t\t// If the current document is a 3D preview, we need to confirm the approval.\r\n\t\tif (isCurrentDocumentThreeDPreview()) {\r\n\t\t\tvar UserHasConfirmed = function () {\r\n\t\t\t\tConfirmConditionalApprove();\r\n\t\t\t};\r\n\r\n\t\t\t// Your decision will be applied to the parent 2D document. Continue?\r\n\t\t\tg_oGreenlightMessages.displayConfirmBubble(g_oThreeDView.c_szThreeDViewApprovalDecision, UserHasConfirmed, unlockScreen);\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\t// Confirm the conditional approval.\r\n\t\tConfirmConditionalApprove();\r\n\t});\r\n\r\n\t/**\r\n\t * Reject Button.\r\n\t */\r\n\t$(\"#btnConfirmReject\").click(function () {\r\n\r\n\t\t// If the current document is a 3D preview, we need to confirm the rejection.\r\n\t\tif (isCurrentDocumentThreeDPreview()) {\r\n\t\t\tvar UserHasConfirmed = function () {\r\n\t\t\t\tConfirmReject();\r\n\t\t\t};\r\n\r\n\t\t\t// Your decision will be applied to the parent 2D document. Continue?\r\n\t\t\tg_oGreenlightMessages.displayConfirmBubble(g_oThreeDView.c_szThreeDViewApprovalDecision, UserHasConfirmed, unlockScreen);\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\t// Confirm the rejection.\r\n\t\tConfirmReject();\r\n\t});\r\n\r\n\t/*\r\n\t * Checks if the active document is a 3D Preview.\r\n\t */\r\n\tfunction isCurrentDocumentThreeDPreview() {\r\n\t\t// All documents on the approval will be in this object.\r\n\t\tvar oApprovalFiles = g_oApprovalFiles.g_oControlIndex[comboControl_GetControlById(\"approvalNameComboControl\", true)];\r\n\t\t// The index of the currently active document.\r\n\t\tvar iCurrentDocumentIndex = oApprovalFiles.g_iCurrentDocIndex;\r\n\r\n\t\t//If the currently active document is a 3D Preview, add a confirmation box\r\n\t\treturn oApprovalFiles.g_Docs[iCurrentDocumentIndex].document.Approval3DViewId > -1;\r\n\t}\r\n\r\n\t/*\r\n\t * Approve Approval function.\r\n\t */\r\n\tfunction ConfirmApprove() {\r\n\r\n\t\t// Ensure the approval conditions have been met.\r\n\t\tif (!g_oApproval.ApprovalConditionsMet(true)) {\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\t// Set the approver status.\r\n\t\tg_oApproval.SetApproverStatus(eApproverStatus.Approved);\r\n\t}\r\n\r\n\t/**\r\n\t * Approve Conditional function.\r\n\t */\r\n\tfunction ConfirmConditionalApprove() {\r\n\r\n\t\t// Ensure the approval conditions have been met.\r\n\t\tif (!g_oApproval.ApprovalConditionsMet(true)) {\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\t// Set the approver status.\r\n\t\tg_oApproval.SetApproverStatus(eApproverStatus.ApprovedChanges);\r\n\t}\r\n\r\n\t/*\r\n\t * Reject Approval function.\r\n\t */\r\n\tfunction ConfirmReject() {\r\n\r\n\t\t// Ensure the rejection conditions have been met.\r\n\t\tif (!g_oApproval.RejectionConditionsMet(true)) {\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\t// If this is a multi file approval, we need to check for annotations on other documents.\r\n\t\tvar oApprovalFiles = g_oApprovalFiles.g_oControlIndex[comboControl_GetControlById(\"approvalNameComboControl\", true)];\r\n\t\tif (oApprovalFiles.g_Docs.length > 1) {\r\n\t\t\tConfirmRejectMultiple();\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\t// Set the approver status.\r\n\t\tg_oApproval.SetApproverStatus(eApproverStatus.Rejected);\r\n\t}\r\n\r\n\t/*\r\n\t * Reject Multiple Approval function.\r\n\t */\r\n\tfunction ConfirmRejectMultiple() {\r\n\r\n\t\t// Get the approval files.\r\n\t\tvar oApprovalFiles = g_oApprovalFiles.g_oControlIndex[comboControl_GetControlById(\"approvalNameComboControl\", true)];\r\n\r\n\t\t// Hide the reject button.\r\n\t\t$(\"#divRejectionDropDown\").toggle(false);\r\n\r\n\t\t// Lock the screen.\r\n\t\tlockScreen();\r\n\r\n\t\t// Create Server Call for the data.\r\n\t\t// Get the first doc's approval id (all should be the same).\r\n\t\tvar oJSON = {\r\n\t\t\tApprovalId: oApprovalFiles.g_Docs[0].greenlightApprovalId\r\n\t\t};\r\n\r\n\t\t// Call to check for approval annotations.\r\n\t\t$.post({\r\n\t\t\turl: \"GreenlightApproval/CheckApprovalAnnotations\",\r\n\t\t\tdata: JSON.stringify(oJSON),\r\n\t\t\tcontentType: \"application/json; charset=utf-8\",\r\n\t\t\tdataType: \"json\",\r\n\t\t\tcache: false,\r\n\t\t\tsuccess: function (oResponse, Status, jqXHR) {\r\n\t\t\t\tif (oResponse.Success) {\r\n\t\t\t\t\tif (oResponse.Contents === \"True\") {\r\n\t\t\t\t\t\tg_oApproval.SetApproverStatus(eApproverStatus.Rejected);\r\n\t\t\t\t\t}\r\n\t\t\t\t\telse {\r\n\t\t\t\t\t\tg_oGreenlightMessages.displayWarningBubble(c_szMissingAnnotationsWarning);\r\n\t\t\t\t\t}\r\n\t\t\t\t} else {\r\n\t\t\t\t\tg_oGreenlightMessages.displayErrorBubble(displayErrorContentHTML(oResponse.Errors));\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t})\r\n\t\t.always(function () {\r\n\t\t\tunlockScreen();\r\n\t\t});\r\n\t}\r\n\r\n\t/**\r\n\t * Approvers Info.\r\n\t*/\r\n\r\n\t$(\"#btnInfo\").click(function () {\r\n\t\tvar thisParent = $(this).parent();\r\n\t\tvar bOpen = thisParent.find(\".dropdown-content\").is(\":visible\");\r\n\t\thighlightSelectedButton(thisParent, true);\r\n\t\tif (!bOpen) {\r\n\t\t\t$(\"#divInfoDropDown\").slideToggle(200);\r\n\t\t} else {\r\n\t\t\tclearHighlightSelectedButton(thisParent);\r\n\t\t}\r\n\t});\r\n\r\n\t/**\r\n\t* Drag and drop for speech bubbles\r\n\t*/\r\n\r\n\t$(\"#divViewerCell\").on(\"pointerdown\", \".speechbubble\", function (e) {\r\n\t\t\r\n\t\t// If the target is a JQTE tool, ignore this pointer down event.\r\n\t\tif (e.target.className.indexOf(\"jqte_tool_icon\") !== -1) {\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\t// Due to the popup content being a scrollable area, we do not was to drag when clicking the scrollbar.\r\n\t\tif (e.target.className.indexOf(\"popup-content\") !== -1) {\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\t// Check if the colour selection has been selected, if so we don't want to enable dragging.\r\n\t\tif (e.target.className.indexOf(\"annotationColorSelection\") !== -1) {\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\t// Check if text classification data has been selected, if so we don't want to enable dragging.\r\n\t\tif (e.target.className.indexOf(\"TextClassificationAnnotationText\") !== -1 || ($(e.target).parents(\".TextClassificationAnnotationText\").length > 0)) {\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\t// Increment the annotation z-index.\r\n\t\tg_oAnnotations.zindex++;\r\n\r\n\t\t// Get the artwork and annotation canvas based on the speech bubble.\r\n\t\tvar oArtworkCanvas = g_oViewer.getCanvas($(this).attr(\"data-artworkCanvas\"));\r\n\t\tvar oAnnotationCanvas = oArtworkCanvas.g_oAnnotationCanvas;\r\n\r\n\t\t$(this).css(\"z-index\", g_oAnnotations.zindex);\r\n\t\tvar origCoords = getClickCoords(e, oAnnotationCanvas);\r\n\t\tvar currentPos = [parseInt($(this).css(\"left\")), parseInt($(this).css(\"top\"))];\r\n\t\tvar that = this;\r\n\r\n\t\t$(\"#divViewerCell\").on(\"pointermove\", function (e) {\r\n\t\t\tvar coords = getClickCoords(e, oAnnotationCanvas);\r\n\t\t\t$(that).css({\r\n\t\t\t\t\"left\": ((coords[0] - origCoords[0]) / g_oViewer.c_iDPI) + currentPos[0],\r\n\t\t\t\t\"top\": ((coords[1] - origCoords[1]) / g_oViewer.c_iDPI) + currentPos[1]\r\n\t\t\t});\r\n\t\t\t// Get rid of the :after triangle once dragged\r\n\t\t\t$(that).addClass(\"noAfter\");\r\n\t\t\toAnnotationCanvas.g_oContext.clearRect(0, 0, oAnnotationCanvas.g_oCanvas.width, oAnnotationCanvas.g_oCanvas.height);\r\n\r\n\t\t\tif (oArtworkCanvas.g_oDoc.documentType != eDocumentTypes.ThreeD) {\r\n\t\t\t\tg_oAnnotations.redrawAnnotations(oArtworkCanvas, oAnnotationCanvas);\r\n\t\t\t}\r\n\t\t\telse {\r\n\t\t\t\tg_oAnnotations.redraw3DAnnotations(oArtworkCanvas, oAnnotationCanvas);\r\n\t\t\t}\r\n\r\n\t\t\t// Reposition the speech bubbles.\r\n\t\t\tg_oAnnotations.repositionSpeechBubbles(oArtworkCanvas, oAnnotationCanvas);\r\n\r\n\t\t\t// If this is not a threeD approval, redraw the annotation canvas.\r\n\t\t\tif (oArtworkCanvas.g_oDoc.documentType != eDocumentTypes.ThreeD) {\r\n\t\t\t\toAnnotationCanvas.redraw(false);\r\n\t\t\t}\r\n\r\n\t\t\t$(this).on(\"pointerup\", function (e) {\r\n\t\t\t\t$(this).off(\"pointermove\");\r\n\t\t\t});\r\n\t\t});\r\n\t});\r\n\r\n\t// Prevents moving of the speech bubble div in SVG approval mode when highlighting text in the text area element\r\n\t$(\"#divViewerCell\").on(\"pointerdown\", \"textarea\", function (e) {\r\n\t\t$(\"textarea\").off(\"pointermove\");\r\n\t\te.stopPropagation();\r\n\t});\r\n\r\n\t$(\"#divViewerCell\").on(\"pointerdown\", \"input\", function (e) {\r\n\t\t$(\"textarea\").off(\"pointermove\");\r\n\t\te.stopPropagation();\r\n\t});\r\n\r\n\t/**\r\n\t* Annotations panel.\r\n\t*/\r\n\r\n\t$(\"#divAnnButton\").click(function () {\r\n\t\tg_oViewer.toggleAnnotationsDiv();\r\n\t});\r\n\r\n\t/**\r\n\t* Separation panel.\r\n\t*/\r\n\r\n\t$(\"#divSepButton\").click(function () {\r\n\t\tg_oViewer.toggleSeparationsDiv();\r\n\t});\r\n\r\n\t/**\r\n\t* CopyMagic panel.\r\n\t*/\r\n\r\n\t$(\"#divCopyMagicButton\").click(function () {\r\n\t\tg_oSVGCopyMagic.toggleCopyMagicSlideOut();\r\n\t});\r\n\r\n\t// Enable all canvas images.\r\n\t$(\"#ResetSeparations\").click(function () {\r\n\r\n\t\t// Enable all canvas images for the approval document.\r\n\t\tg_oSeparations.ResetAllCanvasImages(g_oViewer.g_oArtworkViewer);\r\n\r\n\t\t// Get any sync canvas.\r\n\t\tvar oSyncCanvas = g_oCompare.getSyncCanvas(g_oViewer.g_oArtworkViewer);\r\n\r\n\t\t// Enable all canvas images for each of the sync canvas.\r\n\t\tfor (var i = 0; i < oSyncCanvas.length; i++) {\r\n\t\t\tg_oSeparations.ResetAllCanvasImages(oSyncCanvas[i]);\r\n\t\t}\r\n\t});\r\n\r\n\t// Step through the separations.\r\n\t$(\"#imgStepThroughSeparations\").click(function () {\r\n\r\n\t\t// Get any sync canvas.\r\n\t\tvar oSyncCanvas = g_oCompare.getSyncCanvas(g_oViewer.g_oArtworkViewer);\r\n\r\n\t\t// Step through the separations.\r\n\t\tg_oSeparations.StepThroughCanvasImages(g_oViewer.g_oArtworkViewer, oSyncCanvas);\r\n\t});\r\n\r\n\t/**\r\n\t* Annotation Menu\r\n\t*/\r\n\r\n\t$(\"#btnAnnotate\").click(function () {\r\n\r\n\t\t// If we have an active text highlight, prevent the drop down.\r\n\t\tif (g_oTextTools.g_bHighlightInProgress) {\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\t// Reset flag as we're about to create an annotation.\r\n\t\tg_oAnnotations.g_bNonAnnotationActionInProgress = false;\r\n\r\n\t\tvar thisParent = $(this).parent();\r\n\t\tvar bOpen = thisParent.find(\".dropdown-content\").is(\":visible\");\r\n\t\thighlightButtonClearingAllIcons(thisParent, true);\r\n\t\tvar bAnnotationMode = !bOpen;\r\n\r\n\t\tif (!bOpen) {\r\n\t\t\t$(\"#annotationDropDown\").slideToggle(200);\r\n\r\n\t\t\tif (g_oAnnotations.g_iApprovalType !== eDocumentTypes.ThreeD\r\n\t\t\t\t|| g_oaComboControls[0].documents[g_oaComboControls[0].selectedDocumentIndex].document.documentType !== eDocumentTypes.ThreeD\r\n\t\t\t\t&& g_oViewer.g_oArtworkViewer.g_oDoc.documentType !== eDocumentTypes.ThreeD) {\r\n\t\t\t\tg_oAnnotations.initiateAnnotationDraw(0, g_oViewer.g_oArtworkViewer, g_oViewer.g_oAnnotationViewer);\r\n\t\t\t}\r\n\t\t\telse {\r\n\t\t\t\t$(\".annotationType\").hide();\r\n\t\t\t}\r\n\t\t}\r\n\t\telse {\r\n\t\t\tclearHighlightSelectedButton(thisParent);\r\n\t\t}\r\n\r\n\t\t// Set or unset the annotation mode if it's 3D.\r\n\t\tif (g_oViewer.g_oArtworkViewer.g_oDoc.documentType === eDocumentTypes.ThreeD) {\r\n\t\t\t// Make sure we are looking at the correct combo control.\r\n\t\t\tif (g_oaComboControls[0].documents[g_oaComboControls[0].selectedDocumentIndex].document.documentType === eDocumentTypes.ThreeD) {\r\n\t\t\t\tg_oViewer.g_oArtworkViewer.updateAnnotationMode(bAnnotationMode);\r\n\t\t\t}\r\n\t\t}\r\n\t});\r\n\r\n\r\n\t/**\r\n\t* Annotation Tool tip changes.\r\n\t*/\r\n\r\n\t$(\"#Postit\").on(\"click\", function () {\r\n\t\tg_oAnnotations.toolTypeChange(this, 0);\r\n\t\tg_oAnnotations.initiateAnnotationDraw(0, g_oViewer.g_oArtworkViewer, g_oViewer.g_oAnnotationViewer);\r\n\t});\r\n\r\n\t$(\"#Freedraw\").on(\"click\", function () {\r\n\t\tg_oAnnotations.toolTypeChange(this, 1);\r\n\t\tg_oAnnotations.initiateAnnotationDraw(0, g_oViewer.g_oArtworkViewer, g_oViewer.g_oAnnotationViewer);\r\n\t});\r\n\r\n\t$(\"#Rectangle\").on(\"click\", function () {\r\n\t\tg_oAnnotations.toolTypeChange(this, 2);\r\n\t\tg_oAnnotations.initiateAnnotationDraw(0, g_oViewer.g_oArtworkViewer, g_oViewer.g_oAnnotationViewer);\r\n\t});\r\n\r\n\t$(\"#Ellipse\").on(\"click\", function () {\r\n\t\tg_oAnnotations.toolTypeChange(this, 3);\r\n\t\tg_oAnnotations.initiateAnnotationDraw(0, g_oViewer.g_oArtworkViewer, g_oViewer.g_oAnnotationViewer);\r\n\t});\r\n\r\n\t$(\"#Line\").on(\"click\", function () {\r\n\t\tg_oAnnotations.toolTypeChange(this, 4);\r\n\t\tg_oAnnotations.initiateAnnotationDraw(0, g_oViewer.g_oArtworkViewer, g_oViewer.g_oAnnotationViewer);\r\n\t});\r\n\r\n\t$(\"#Global\").on(\"click\", function () {\r\n\t\tg_oAnnotations.toolTypeChange(this, 5);\r\n\t\tg_oAnnotations.initiateAnnotationDraw(0, g_oViewer.g_oArtworkViewer, g_oViewer.g_oAnnotationViewer);\r\n\t});\r\n\r\n\t/**\r\n\t * Binding Key events\r\n\t */\r\n\t$(document).on(\"keyup\", function (e) {\r\n\t\tswitch (e.keyCode) {\r\n\t\t\tcase 27: // ESC\r\n\t\t\t\t// Reset the mouse cursor.\r\n\t\t\t\t$(\"#AnnotationViewer\").css(\"cursor\", \"default\");\r\n\t\t\t\t$(\"#CompareAnnotationViewer\").css(\"cursor\", \"default\");\r\n\t\t\t\tg_oAnnotations.g_szPrevCursorStyle = \"default\";\r\n\r\n\t\t\t\t// Remove all highlighted buttons.\r\n\t\t\t\t$(\".techToolType\").css(\"background-color\", \"\");\r\n\t\t\t\tremoveExistingHighlights(null);\r\n\r\n\t\t\t\t// If we are in the process of a text highlight, end the highlight.\r\n\t\t\t\tvar bTextHighlightEnded = false;\r\n\t\t\t\tif (g_oTextTools.g_bHighlightInProgress) {\r\n\t\t\t\t\tbTextHighlightEnded = true;\r\n\t\t\t\t\tg_oTextTools.endhighlight(g_oViewer.g_oArtworkViewer, g_oViewer.g_oAnnotationViewer, true);\r\n\t\t\t\t}\r\n\r\n\t\t\t\t// Don't rebind the mouse logic if there are open editable speech bubbles\r\n\t\t\t\tif (!g_oAnnotations.checkIfNewSpeechBubbleExists()) {\r\n\r\n\t\t\t\t\t// Unselect all tech tools.\r\n\t\t\t\t\tg_oTechTools.g_iSelectedMeasurementType = g_oTechTools.g_eMeasurementTypes.NONE;\r\n\t\t\t\t\tg_oTechTools.clearBarcodeMeasurementArray();\r\n\t\t\t\t\t$(\"#divTechToolsClearCanvas\").click();\r\n\r\n\t\t\t\t\t// Close all annotations.\r\n\t\t\t\t\t$(\".speechbubble\").remove();\r\n\t\t\t\t\tfor (var i = 0; i < g_oAnnotations.g_oAnnotationsMade.length; i++) {\r\n\t\t\t\t\t\tg_oAnnotations.g_oAnnotationsMade[i].g_bClosed = true;\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tg_oTechTools.g_oAnnotationViewer.redraw(false);\r\n\t\t\t\t\tg_oViewer.g_oArtworkViewer.dragDiscontinue(false, []);\r\n\t\t\t\t\tg_oAnnotations.g_oTempAnnotationArray.length = 0;\r\n\r\n\t\t\t\t\t// Redraw the compare canvas just in case.\r\n\t\t\t\t\tif (typeof g_oViewer.getCanvasByName(\"CompareAnnotationViewer\") !== \"undefined\" && g_oViewer.getLinkedArtworkCanvas(\"CompareAnnotationViewer\").g_oDoc !== null) {\r\n\t\t\t\t\t\tg_oViewer.getCanvasByName(\"CompareAnnotationViewer\").redraw(false);\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\t// Rebind mouseHover\r\n\t\t\t\t\tchangeCanvasFunction();\r\n\t\t\t\t\tchangeCanvasFunction(\"#AnnotationViewer\", \"pointermove.annotationUI\", function (e) {\r\n\t\t\t\t\t\tAnnotationAction.prototype.mouseMoveLite(e, g_oViewer.g_oArtworkViewer, g_oViewer.g_oAnnotationViewer);\r\n\t\t\t\t\t});\r\n\r\n\t\t\t\t\tvar bAutoSelect = g_oTextCompare_AutoSelection.isAutoSelectionEnabled();\r\n\r\n\t\t\t\t\tif (!bAutoSelect) {\r\n\t\t\t\t\t\t// Close any open info bubbles.\r\n\t\t\t\t\t\tg_oGreenlightMessages.closeBubbles();\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\t// If a new speech bubble exists, and we have not just ended a text highlight.\r\n\t\t\t\telse if (!bTextHighlightEnded) {\r\n\r\n\t\t\t\t\t// Display a warning.\r\n\t\t\t\t\tg_oGreenlightMessages.displayWarningBubble(g_oAnnotations.c_szUnsavedAnnotation);\r\n\t\t\t\t}\r\n\r\n\t\t\t\t// Prevent default.\r\n\t\t\t\te.preventDefault();\r\n\t\t\t\tbreak;\r\n\t\t\tcase 16: // Shift\r\n\t\t\t\t// If we are in the process of a text highlight, toggle the highlight direction.\r\n\t\t\t\tif (g_oTextTools.g_bHighlightInProgress) {\r\n\t\t\t\t\tg_oTextTools.toggleHighlightDirection();\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tdefault:\r\n\t\t\t\tbreak;\r\n\t\t}\r\n\t});\r\n\r\n\t/**\r\n\t* Compare Menu\r\n\t*/\r\n\r\n\t$(\"#btnCompare\").click(function () {\r\n\r\n\t\t// If we have an active text highlight, prevent the drop down.\r\n\t\tif (g_oTextTools.g_bHighlightInProgress) {\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\tvar thisParent = $(this).parent();\r\n\t\tvar bOpen = thisParent.find(\".dropdown-content\").is(\":visible\");\r\n\t\thighlightSelectedButton(thisParent, true);\r\n\t\tif (!bOpen) {\r\n\t\t\t$(\"#compareDropDown\").slideToggle(200);\r\n\t\t}\r\n\t\telse {\r\n\t\t\tclearHighlightSelectedButton(thisParent);\r\n\t\t}\r\n\t});\r\n\r\n\t/**\r\n\t* Compare Tool tip changes.\r\n\t*/\r\n\r\n\t$(\"#Blink\").on(\"click\", function () {\r\n\t\tg_oCompare.toolTypeChange(this, eCompareMode.Blink, false);\r\n\t});\r\n\r\n\t$(\"#Overlay\").on(\"click\", function () {\r\n\t\tg_oCompare.toolTypeChange(this, eCompareMode.Overlay, false);\r\n\t});\r\n\r\n\t$(\"#Slider\").on(\"click\", function (event) {\r\n\r\n\t\t// Determine the slider we have selected.\r\n\t\tg_oCompare.g_bSliderVertical = (event.target.id === \"SliderImgVertical\" ? true : false);\r\n\r\n\t\t// Set the slider type.\r\n\t\tvar eSliderType = g_oCompare.g_bSliderVertical ? eCompareMode.SliderVertical : eCompareMode.SliderHorizontal;\r\n\r\n\t\t// Determine if we want to keep the current documents.\r\n\t\tvar bKeepDocuments = (g_oViewer.g_oCompareMode == eCompareMode.SliderVertical || g_oViewer.g_oCompareMode == eCompareMode.SliderHorizontal);\r\n\r\n\t\t// Since we have seperated the horizontal / vertical into two seperate elements we now replace with the clickAction representing the required slider.\r\n\t\tg_oCompare.toolTypeChange(this, eSliderType, bKeepDocuments);\r\n\t});\r\n\r\n\t$(\"#SideBySide\").on(\"click\", function () {\r\n\t\tg_oCompare.toolTypeChange(this, eCompareMode.SideBySide, false);\r\n\t});\r\n\r\n\t$(\"#SideBySideDifference\").on(\"click\", function () {\r\n\t\tg_oCompare.toolTypeChange(this, eCompareMode.SideBySideDiff, false);\r\n\t});\r\n\r\n\t$(\"#DeactivateCompare\").on(\"click\", function () {\r\n\t\t// Close all annotations.\r\n\t\t$(\".speechbubble\").remove();\r\n\t\tfor (var i = 0; i < g_oAnnotations.g_oAnnotationsMade.length; i++) {\r\n\t\t\tg_oAnnotations.g_oAnnotationsMade[i].g_bClosed = true;\r\n\t\t}\r\n\t\tg_oCompare.toolTypeClear(true);\r\n\t\tchangeCanvasFunction();\r\n\t});\r\n\r\n\t$(\"#AnimateDifferencesToggle\").on(\"click\", function () {\r\n\r\n\t\t// Setup the Icon\r\n\t\tvar thisParent = $(this).parent();\r\n\t\tvar bOpen = thisParent.find(\".dropdown-content\").is(\":visible\");\r\n\t\thighlightSelectedButton(thisParent, true);\r\n\r\n\t\t// Check if on or off\r\n\t\tif (!g_oCompare.g_bIsAnimateDifferencesOn) {\r\n\r\n\t\t\t// Set the toggle to On & toggle image source\r\n\t\t\tg_oCompare.g_bIsAnimateDifferencesOn = true;\r\n\t\t\t$(this).attr(\"src\", \"img/Pause_32.png\");\r\n\t\t\t$(\"#DiffSpeedSlider\").show();\r\n\r\n\t\t\t// Toggle Animation\r\n\t\t\tg_oCompare.toggleDifferences();\r\n\t\t}\r\n\t\telse {\r\n\r\n\t\t\t// Set the toggle to Off & toggle image source.\r\n\t\t\tg_oCompare.g_bIsAnimateDifferencesOn = false;\r\n\t\t\t$(this).attr(\"src\", \"img/Play_32.png\");\r\n\r\n\t\t\t$(\"#DiffSpeedSlider\").hide();\r\n\t\t}\r\n\t});\r\n\r\n\t/*\r\n\t* Annotation Colour Change functions\r\n\t*/\r\n\r\n\t//-------------Annotation Colour Change Functions---------------\r\n\r\n\t// Blue\r\n\t$(\"#annotateBlue\").on(\"click\", function () {\r\n\t\tg_oAnnotations.annotationColourChange(\"blue\");\r\n\t});\r\n\r\n\t// Red\r\n\t$(\"#annotateRed\").on(\"click\", function () {\r\n\t\tg_oAnnotations.annotationColourChange(\"red\");\r\n\t});\r\n\r\n\t// Green\r\n\t$(\"#annotateGreen\").on(\"click\", function () {\r\n\t\tg_oAnnotations.annotationColourChange(\"green\");\r\n\t});\r\n\r\n\t// Orange\r\n\t$(\"#annotateOrange\").on(\"click\", function () {\r\n\t\tg_oAnnotations.annotationColourChange(\"orange\");\r\n\t});\r\n\r\n\t// Purple\r\n\t$(\"#annotatePurple\").on(\"click\", function () {\r\n\t\tg_oAnnotations.annotationColourChange(\"purple\");\r\n\t});\r\n\r\n\t// Cyan\r\n\t$(\"#annotateCyan\").on(\"click\", function () {\r\n\t\tg_oAnnotations.annotationColourChange(\"cyan\");\r\n\t});\r\n\r\n\t// Magenta\r\n\t$(\"#annotateMagenta\").on(\"click\", function () {\r\n\t\tg_oAnnotations.annotationColourChange(\"magenta\");\r\n\t});\r\n\r\n\t// Yellow\r\n\t$(\"#annotateYellow\").on(\"click\", function () {\r\n\t\tg_oAnnotations.annotationColourChange(\"yellow\");\r\n\t});\r\n\r\n\t// Grey\r\n\t$(\"#annotateGrey\").on(\"click\", function () {\r\n\t\tg_oAnnotations.annotationColourChange(\"grey\");\r\n\t});\r\n\r\n\t// Annotation Colour Setting.\r\n\t$(\"#setting_AnnotationColour\").on(\"click\", function (event) {\r\n\t\t\r\n\t\t// Stop any default behaviour.\r\n\t\tevent.preventDefault();\r\n\t\tevent.stopPropagation();\r\n\r\n\t\t// Hide the colour grid if already shown.\r\n\t\tif ($(\"#settingAnnotationColourPopup\").length > 0) {\r\n\t\t\t$(\"#settingAnnotationColourPopup\").remove();\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\t// Get the original table to clone from.\r\n\t\tvar oColourGrid = document.getElementById(\"colourSelectionGridTable\").cloneNode(true);\r\n\r\n\t\t// Update the grid settings.\r\n\t\toColourGrid.id = \"settingAnnotationColourPopup\";\r\n\t\toColourGrid.style.background = (g_oSettings.c_iSkinType == 0) ? \"black\" : \"white\";\r\n\t\toColourGrid.style.display = \"block\";\r\n\t\toColourGrid.style.zIndex = 1002;\r\n\r\n\t\t// Set the margin of the colour grid.\r\n\t\toColourGrid.style['margin-top'] = \"4px\";\r\n\t\toColourGrid.style['margin-left'] = \"21px\";\r\n\r\n\t\t// Add the required classes if we are on the light interface.\r\n\t\tif (g_oSettings.c_iSkinType == 1) {\r\n\t\t\toColourGrid.classList.add(\"dvPopupAnnotationWhiteColour\");\r\n\t\t\toColourGrid.classList.add(\"colorWhiteSelection\");\r\n\t\t}\r\n\r\n\t\t// Append the grid to the setting.\r\n\t\t$(\"#setting_AnnotationColour\").parent()[0].appendChild(oColourGrid);\r\n\t\t\r\n\t\t// Set the selected colour.\r\n\t\t$(\"#settingAnnotationColourPopup\").find(\".annotationColorSelection\").css(\"border-color\", \"transparent\");\r\n\t\t$(\"#settingAnnotationColourPopup\").find(\".annotationColorSelection.\" + g_oAnnotations.getStringColour(g_oSettings.g_oUserSettings.AnnotationColour)).css(\"border-color\", g_oSettings.c_iSkinType == 0 ? \"white\" : \"black\");\r\n\t});\r\n\r\n\t/**\r\n\t* Annotation events.\r\n\t*/\r\n\r\n\t// Hides our annotations.\r\n\t$(\"#HideAnnotations, #settings_ShowAnnotationsToggle\").on(\"click\", function () {\r\n\r\n\t\t// Toggle the annotation setting.\r\n\t\tg_oSettings.g_oUserSettings.ShowAnnotations = !g_oSettings.g_oUserSettings.ShowAnnotations;\r\n\r\n\t\t// If annotations are now hidden.\r\n\t\tif (!g_oSettings.g_oUserSettings.ShowAnnotations) {\r\n\r\n\t\t\t// Close any active annotations.\r\n\t\t\tg_oAnnotations.closeActiveAnnotations();\r\n\r\n\t\t\t// If we are currently finding SVG text.\r\n\t\t\tif (g_oViewer.c_bFindSVGText) {\r\n\r\n\t\t\t\t// Toggle this off.\r\n\t\t\t\t$(\"#btnSVGFindText\").click();\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t// Redraw the annotations based on the change.\r\n\t\tif (g_oAnnotations.g_iApprovalType === eDocumentTypes.ThreeD) {\r\n\t\t\tg_oAnnotations.redraw3DAnnotations(g_oAnnotations.g_oArtworkViewer, g_oAnnotations.g_oAnnotationViewer);\r\n\t\t\tg_oAnnotations.redraw3DAnnotations(g_oCompare.g_oCompareViewer, g_oCompare.g_oCompareAnnotationViewer);\r\n\t\t}\r\n\t\telse {\r\n\t\t\tg_oAnnotations.g_oAnnotationViewer.redraw(false);\r\n\t\t\tif (g_oViewer.g_oCompareMode != eCompareMode.NoCompare) {\r\n\t\t\t\tg_oCompare.g_oCompareAnnotationViewer.redraw(false);\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t// Update the setting.\r\n\t\tg_oSettings.updateSettingShowAnnotations(true);\r\n\t});\r\n\r\n\t$(\"#ViewerCell\").on(\"click\", \".speechbubble\", function (e) {\r\n\t\t$(this).css(\"z-index\", g_oAnnotations.zindex + 1);\r\n\t\tg_oAnnotations.zindex++;\r\n\t});\r\n\r\n\t// Change function for the scroll type.\r\n\t$(\"#setting_ScrollPreference\").on(\"change\", function (e) {\r\n\r\n\t\t// Update the scroll preference.\r\n\t\tg_oSettings.g_oUserSettings.ScrollPreference = $(\"#setting_ScrollPreference\").val();\r\n\r\n\t\t// Update the setting.\r\n\t\tg_oSettings.updateSettingScrollPreference(true);\r\n\t});\r\n\r\n\t// Change function for the zoom speed.\r\n\t$(\"#setting_ZoomSpeed\").on(\"change\", function (e) {\r\n\r\n\t\t// Update the zoom speed.\r\n\t\tg_oSettings.g_oUserSettings.ZoomSpeed = parseInt($(\"#setting_ZoomSpeed\").val());\r\n\r\n\t\t// Update the setting.\r\n\t\tg_oSettings.updateSettingZoomSpeed(true);\r\n\r\n\t\t// Update the animation frames for each canvas. (3D Canvas do not use animation frames)\r\n\t\tfor (var i = 0; i < g_oViewer.g_oActiveCanvasList.length; i++) {\r\n\t\t\tif (!g_oViewer.g_oActiveCanvasList[i].isThreeDCanvas) {\r\n\t\t\t\tg_oViewer.g_oActiveCanvasList[i].g_iAnimateFrames = getAnimationFramesForZoomSpeed(g_oSettings.g_oUserSettings.ZoomSpeed);\r\n\t\t\t}\r\n\t\t}\r\n\t});\r\n\r\n\t// Change function for the zoom increments.\r\n\t$(\"#setting_ZoomIncrements\").on(\"change\", function (e) {\r\n\r\n\t\t// Update the zoom increments.\r\n\t\tg_oSettings.g_oUserSettings.ZoomIncrements = parseInt($(\"#setting_ZoomIncrements\").val());\r\n\r\n\t\t// Update the setting.\r\n\t\tg_oSettings.updateSettingZoomIncrements(true);\r\n\r\n\t\t// Update the zoom multipler for each canvas. (3D Canvas do not use zoom multipliers)\r\n\t\tfor (var i = 0; i < g_oViewer.g_oActiveCanvasList.length; i++) {\r\n\t\t\tif (!g_oViewer.g_oActiveCanvasList[i].isThreeDCanvas) {\r\n\t\t\t\tg_oViewer.g_oActiveCanvasList[i].g_oCanvasZoom.g_iZoomMultiplier = getZoomMultiplierForZoomIncrement(g_oSettings.g_oUserSettings.ZoomIncrements);\r\n\t\t\t}\r\n\t\t}\r\n\t});\r\n\r\n\t// Change function for the alignment type.\r\n\t$(\"#setting_AlignmentPreference\").on(\"change\", function () {\r\n\r\n\t\t// Update the alignment preference.\r\n\t\tg_oSettings.g_oUserSettings.AlignmentPreference = $(\"#setting_AlignmentPreference\").val();\r\n\r\n\t\t// Update the setting.\r\n\t\tg_oSettings.updateSettingAlignmentPreference(true);\r\n\t});\r\n\r\n\t// Change function for the highlight type.\r\n\t$(\"#setting_HighlightPreference\").on(\"change\", function () {\r\n\r\n\t\t// Update the highlight preference.\r\n\t\tg_oSettings.g_oUserSettings.HighlightPreference = $(\"#setting_HighlightPreference\").val();\r\n\r\n\t\t// Update the setting.\r\n\t\tg_oSettings.updateSettingHighlightPreference(true);\r\n\r\n\t\t// If a text highlight is in progress, update the info bubble.\r\n\t\tif (g_oTextTools.g_bHighlightInProgress) {\r\n\t\t\tg_oTextTools.displayHighlightInfo();\r\n\t\t}\r\n\t});\r\n\r\n\t// Text Comparison Highlight Colour Setting.\r\n\t$(\"#setting_TextComparisonHighlightColour\").on(\"click\", function (event) {\r\n\r\n\t\t// Stop any default behaviour.\r\n\t\tevent.preventDefault();\r\n\t\tevent.stopPropagation();\r\n\r\n\t\t// Hide the colour grid if already shown.\r\n\t\tif ($(\"#settingTextComparisonHighlightColourPopup\").length > 0) {\r\n\t\t\t$(\"#settingTextComparisonHighlightColourPopup\").remove();\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\t// Get the original table to clone from.\r\n\t\tvar oColourGrid = document.getElementById(\"colourSelectionGridTable\").cloneNode(true);\r\n\r\n\t\t// Update the grid settings.\r\n\t\toColourGrid.id = \"settingTextComparisonHighlightColourPopup\";\r\n\t\toColourGrid.style.background = (g_oSettings.c_iSkinType == 0) ? \"black\" : \"white\";\r\n\t\toColourGrid.style.display = \"block\";\r\n\t\toColourGrid.style.zIndex = 1002;\r\n\r\n\t\t// Set the margin of the colour grid.\r\n\t\toColourGrid.style['margin-top'] = \"4px\";\r\n\t\toColourGrid.style['margin-left'] = \"21px\";\r\n\r\n\t\t// Add the required classes if we are on the light interface.\r\n\t\tif (g_oSettings.c_iSkinType == 1) {\r\n\t\t\toColourGrid.classList.add(\"dvPopupAnnotationWhiteColour\");\r\n\t\t\toColourGrid.classList.add(\"colorWhiteSelection\");\r\n\t\t}\r\n\r\n\t\t// Append the grid to the setting.\r\n\t\t$(\"#setting_TextComparisonHighlightColour\").parent()[0].appendChild(oColourGrid);\r\n\r\n\t\t// Set the selected colour.\r\n\t\t$(\"#settingTextComparisonHighlightColourPopup\").find(\".annotationColorSelection\").css(\"border-color\", \"transparent\");\r\n\t\t$(\"#settingTextComparisonHighlightColourPopup\").find(\".annotationColorSelection.\" + g_oAnnotations.getStringColour(g_oSettings.g_oUserSettings.TextComparisonHighlightColour)).css(\"border-color\", g_oSettings.c_iSkinType == 0 ? \"white\" : \"black\");\r\n\r\n\t\t// Update the click event of the colour tiles.\r\n\t\t$(\"#settingTextComparisonHighlightColourPopup\").find(\".annotationColorSelection\").off('click').on('click', function () {\r\n\t\t\tg_oTextCompare.updateTextCompareHighlightColour(this.getAttribute('data-annotationcolour'));\r\n\t\t});\r\n\t});\r\n\r\n\t// Change function for the text comaprison accuracy setting.\r\n\t$(\"#setting_TextComparisonAccuracy\").on(\"change\", function () {\r\n\r\n\t\t// Update the text comparison accuracy.\r\n\t\tg_oSettings.g_oUserSettings.TextComparisonAccuracy = $(\"#setting_TextComparisonAccuracy\").val();\r\n\r\n\t\t// Update the setting.\r\n\t\tg_oSettings.updateSettingTextComparisonAccuracy(true);\r\n\r\n\t\t// If we are not actively in a text comaprison, update the text comparison accuracy.\r\n\t\tif (!g_oTextCompare.g_bDifferencesCalculated) {\r\n\t\t\t$(\"#divTextComparisonAccuracy\").val(g_oSettings.g_oUserSettings.TextComparisonAccuracy);\r\n\t\t\tg_oTextCompare.updateTextCompareSettings();\r\n\t\t}\r\n\t});\r\n\r\n\t// Change function for the text comaprison sensitivity setting.\r\n\t$(\"#setting_TextComparisonCaseSensitivity\").on(\"change\", function () {\r\n\r\n\t\t// Update the text comparison accuracy.\r\n\t\tg_oSettings.g_oUserSettings.TextComparisonCaseSensitivity = $(\"#setting_TextComparisonCaseSensitivity\").val();\r\n\r\n\t\t// Update the setting.\r\n\t\tg_oSettings.updateSettingTextComparisonCaseSensitivity(true);\r\n\r\n\t\t// If we are not actively in a text comaprison, update the text comparison sensitivity.\r\n\t\tif (!g_oTextCompare.g_bDifferencesCalculated) {\r\n\t\t\t$(\"#divTextComparisonCaseSensitivity\").val(g_oSettings.g_oUserSettings.TextComparisonCaseSensitivity);\r\n\t\t}\r\n\t});\r\n\r\n\t// Change function for the text comaprison bold italic detection setting.\r\n\t$(\"#setting_TextComparisonBoldItalicDetection\").on(\"change\", function () {\r\n\r\n\t\t// Update the text comparison bold italic detection.\r\n\t\tg_oSettings.g_oUserSettings.TextComparisonBoldItalicDetection = $(\"#setting_TextComparisonBoldItalicDetection\").val();\r\n\r\n\t\t// Update the setting.\r\n\t\tg_oSettings.updateSettingTextComparisonBoldItalicDetection(true);\r\n\r\n\t\t// If we are not actively in a text comaprison, update the text comparison bold italic detection.\r\n\t\tif (!g_oTextCompare.g_bDifferencesCalculated) {\r\n\t\t\t$(\"#divTextComparisonBoldItalicDetection\").val(g_oSettings.g_oUserSettings.TextComparisonBoldItalicDetection);\r\n\t\t}\r\n\t});\r\n\r\n\t// Change function for the text comaprison whitespace detection setting.\r\n\t$(\"#setting_TextComparisonWhitespaceDetection\").on(\"change\", function () {\r\n\r\n\t\t// Update the text comparison whitespace detection.\r\n\t\tg_oSettings.g_oUserSettings.TextComparisonWhitespaceDetection = $(\"#setting_TextComparisonWhitespaceDetection\").val();\r\n\r\n\t\t// Update the setting.\r\n\t\tg_oSettings.updateSettingTextComparisonWhitespaceDetection(true);\r\n\r\n\t\t// If we are not actively in a text comaprison, update the text comparison whitespace detection.\r\n\t\tif (!g_oTextCompare.g_bDifferencesCalculated) {\r\n\t\t\t$(\"#divTextComparisonWhitespaceDetection\").val(g_oSettings.g_oUserSettings.TextComparisonWhitespaceDetection);\r\n\t\t}\r\n\t});\r\n\r\n\t// Change function for the text comaprison auto selection setting.\r\n\t$(\"#setting_TextComparisonAutoSelection\").on(\"change\", function () {\r\n\r\n\t\t// Update the text comparison whitespace detection.\r\n\t\tg_oSettings.g_oUserSettings.TextComparisonAutoSelection = $(\"#setting_TextComparisonAutoSelection\").val();\r\n\r\n\t\t// Update the setting.\r\n\t\tg_oSettings.updateSettingTextComparisonAutoSelection(true);\r\n\r\n\t\t// If we are not actively in a text comaprison, update the text comparison whitespace detection.\r\n\t\tif (!g_oTextCompare.g_bDifferencesCalculated) {\r\n\t\t\t$(\"#divTextComparisonAutoSelection\").val(g_oSettings.g_oUserSettings.TextComparisonAutoSelection);\r\n\t\t}\r\n\r\n\t\t// Update the auto select toggle button.\r\n\t\t$(\"#btnAuto_Select_Toggle_TextCompare\")\r\n\t\t\t.attr(\"src\", g_oSettings.g_oUserSettings.TextComparisonAutoSelection == '2' ? \"img/MagicWand_24_Blue.png\" : \"img/MagicWand_24_Grey.png\")\r\n\t\t\t.tooltipster('content', g_oSettings.g_oUserSettings.TextComparisonAutoSelection == '2' ? g_oTextCompare_AutoSelection.c_szAutoSelectionDisabled : g_oTextCompare_AutoSelection.c_szAutoSelectionEnabled);\r\n\t});\r\n\r\n\t// Change function for the text comaprison accuracy.\r\n\t$(\"#divTextComparisonAccuracy\").on(\"change\", function () {\r\n\r\n\t\t// Update the text comparison accuracy setting.\r\n\t\tg_oSettings.g_oUserSettings.TextComparisonAccuracy = $(\"#divTextComparisonAccuracy\").val();\r\n\r\n\t\t// Update the setting.\r\n\t\tg_oSettings.updateSettingTextComparisonAccuracy(true);\r\n\r\n\t\t// If we are in text compare mode and have not calculated the differences yet, update the settings.\r\n\t\tif (g_oTextCompare.g_bTextCompareDivShown && !g_oTextCompare.g_bDifferencesCalculated) {\r\n\t\t\tg_oTextCompare.updateTextCompareSettings();\r\n\t\t}\r\n\t});\r\n\r\n\t// Change function for the text comparison sensitivity.\r\n\t$(\"#divTextComparisonCaseSensitivity\").on(\"change\", function () {\r\n\r\n\t\t// Update the text comparison sensitivity setting.\r\n\t\tg_oSettings.g_oUserSettings.TextComparisonCaseSensitivity = $(\"#divTextComparisonCaseSensitivity\").val();\r\n\r\n\t\t// Update the setting.\r\n\t\tg_oSettings.updateSettingTextComparisonCaseSensitivity(true);\r\n\r\n\t\t// If we are in text compare mode and have not calculated the differences yet, update the settings.\r\n\t\tif (g_oTextCompare.g_bTextCompareDivShown && !g_oTextCompare.g_bDifferencesCalculated) {\r\n\t\t\tg_oTextCompare.updateTextCompareSettings();\r\n\t\t}\r\n\t});\r\n\r\n\t// Change function for the bold italic detection.\r\n\t$(\"#divTextComparisonBoldItalicDetection\").on(\"change\", function () {\r\n\r\n\t\t// Update the text comparison bold italic detection setting.\r\n\t\tg_oSettings.g_oUserSettings.TextComparisonBoldItalicDetection = $(\"#divTextComparisonBoldItalicDetection\").val();\r\n\r\n\t\t// Update the setting.\r\n\t\tg_oSettings.updateSettingTextComparisonBoldItalicDetection(true);\r\n\r\n\t\t// If we are in text compare mode and have not calculated the differences yet, update the settings.\r\n\t\tif (g_oTextCompare.g_bTextCompareDivShown && !g_oTextCompare.g_bDifferencesCalculated) {\r\n\t\t\tg_oTextCompare.updateTextCompareSettings();\r\n\t\t}\r\n\t});\r\n\r\n\t// Change function for the whitespace detection.\r\n\t$(\"#divTextComparisonWhitespaceDetection\").on(\"change\", function () {\r\n\r\n\t\t// Update the text comparison whitespace detection setting.\r\n\t\tg_oSettings.g_oUserSettings.TextComparisonWhitespaceDetection = $(\"#divTextComparisonWhitespaceDetection\").val();\r\n\r\n\t\t// Update the setting.\r\n\t\tg_oSettings.updateSettingTextComparisonWhitespaceDetection(true);\r\n\r\n\t\t// If we are in text compare mode and have not calculated the differences yet, update the settings.\r\n\t\tif (g_oTextCompare.g_bTextCompareDivShown && !g_oTextCompare.g_bDifferencesCalculated) {\r\n\t\t\tg_oTextCompare.updateTextCompareSettings();\r\n\t\t}\r\n\t});\r\n\r\n\t// Change function for the auto selection.\r\n\t$(\"#divTextComparisonAutoSelection\").on(\"change\", function () {\r\n\r\n\t\t// Update the text comparison whitespace detection setting.\r\n\t\tg_oSettings.g_oUserSettings.TextComparisonAutoSelection = $(\"#divTextComparisonAutoSelection\").val();\r\n\r\n\t\t// Update the setting.\r\n\t\tg_oSettings.updateSettingTextComparisonAutoSelection(true);\r\n\r\n\t\t// If we are in text compare mode and have not calculated the differences yet, update the settings.\r\n\t\tif (g_oTextCompare.g_bTextCompareDivShown && !g_oTextCompare.g_bDifferencesCalculated) {\r\n\t\t\tg_oTextCompare.updateTextCompareSettings();\r\n\t\t}\r\n\t});\r\n\r\n\t// Close button pop-up functionality.\r\n\t$(\"#divViewerCell\").on(\"pointerdown\", \".closebutton\", function (e) {\r\n\t\te.stopPropagation();\r\n\t});\r\n\r\n\t$(\"#divViewerCell\").on(\"click\", \".closebutton\", function (e) {\r\n\t\te.preventDefault();\r\n\r\n\t\t// If the element being closed is an annotation then we're going to remove the div.\r\n\t\t// We'll get it back again if the user clicks on the annotation.\r\n\t\tvar szId = $(this).parent().attr(\"id\");\r\n\t\tvar iId = g_oAnnotations.getIdFromElementId(szId);\r\n\r\n\t\tvar result = $.grep(g_oAnnotations.g_oAnnotationsMade, function (annotation) { return annotation.id == iId; });\r\n\r\n\t\t// Iterate through the annotations and set all children to closed\r\n\t\tvar children = $.grep(g_oAnnotations.g_oAnnotationsMade, function (annotation) { return annotation.g_iParentAnnotationId == iId; });\r\n\t\tfor (var i = 0; i < children.length; i++) {\r\n\t\t\tchildren[i].g_bClosed = true;\r\n\t\t}\r\n\r\n\t\t// Get the artwork and annotation canvas based on the speech bubble.\r\n\t\tvar oArtworkCanvas = g_oViewer.getCanvas($(this).parent().attr(\"data-artworkCanvas\"));\r\n\t\tvar oAnnotationCanvas = oArtworkCanvas.g_oAnnotationCanvas;\r\n\r\n\t\tif (result.length) {\r\n\t\t\tresult[0].g_bClosed = true;\r\n\t\t\tresult[0].g_bSaved = true;\r\n\r\n\t\t\t$(\"#\" + iId).remove();\r\n\t\t\tif (oArtworkCanvas.g_oDoc.documentType == eDocumentTypes.ThreeD) {\r\n\t\t\t\tg_oAnnotations.redraw3DAnnotations(oArtworkCanvas, oAnnotationCanvas);\r\n\t\t\t\toArtworkCanvas.g_oRenderer.render(oArtworkCanvas.g_oScene, oArtworkCanvas.g_oCamera);\r\n\t\t\t}\r\n\t\t\telse {\r\n\t\t\t\tif (result[0].g_iAnnotationType === eAnnotationTypes.TextMeasurement) {\r\n\t\t\t\t\tg_oTechTools.setTextMeasurementWordVisibility(result[0].g_oTextMeasurementWordsArray, false);\r\n\t\t\t\t}\r\n\r\n\t\t\t\t// If this annotation has an active jqte text box in the list, rebuild the list.\r\n\t\t\t\tif ($(\"#li_\" + result[0].id).find(\".jqte\").length) {\r\n\t\t\t\t\tg_oAnnotations.rebuildAnnotationList(oArtworkCanvas, oAnnotationCanvas);\r\n\t\t\t\t}\r\n\r\n\t\t\t\toAnnotationCanvas.redraw(false);\r\n\t\t\t}\r\n\r\n\t\t\t// Only unhook the pointerdown event if there are no unsaved annotations as they will need it to be able to trigger saveAnnotation function.\r\n\t\t\tif (!g_oAnnotations.checkForUnsavedAnnotation()) {\r\n\t\t\t\t$(document).off(\"pointerdown\");\t\t// Remove the PointerDown event to allow other controls to register click events.\r\n\t\t\t}\r\n\t\t}\r\n\t});\r\n\r\n\t// Binds the delete button.\r\n\t$(\"#divViewerCell\").on(\"click\", \".deletebutton\", function (e) {\r\n\t\te.preventDefault();\r\n\t\te.stopPropagation();\r\n\r\n\t\tvar iId = g_oAnnotations.getIdFromElementId($(this)[0].id);\r\n\r\n\t\t// Find all of the annotations that share the same ID.\r\n\t\tvar result = $.grep(g_oAnnotations.g_oAnnotationsMade, function (ann) { return ann.id == iId; });\r\n\t\tvar relatedResult = $.grep(g_oAnnotations.g_oAnnotationsMade, function (ann) { return ann.g_iParentAnnotationId == iId; });\r\n\r\n\t\t// Get the artwork and annotation canvas based on the speech bubble.\r\n\t\tvar oArtworkCanvas = g_oViewer.getCanvas($(this).parent().attr(\"data-artworkCanvas\"));\r\n\t\tvar oAnnotationCanvas = oArtworkCanvas.g_oAnnotationCanvas;\r\n\r\n\t\t// Merge the two arrays together.\r\n\t\tresult = result.concat(relatedResult);\r\n\r\n\t\tg_oAnnotations.deleteAnnotation(iId, result, false, oArtworkCanvas, oAnnotationCanvas);\r\n\t\t$(document).off(\"pointerdown\");\t\t// Remove the PointerDown event to allow other controls to register click events.\r\n\r\n\t\t// Redraw if this is a 2D Canvas.\r\n\t\tif (oArtworkCanvas.g_oDoc.documentType != eDocumentTypes.ThreeD) {\r\n\t\t\toAnnotationCanvas.redraw(false);\r\n\t\t}\r\n\t});\r\n\r\n\t$(\"#divViewerCell\").on(\"click\", \".deleteAnnotationReplyButton\", function (e) {\r\n\t\te.preventDefault();\r\n\t\te.stopPropagation();\r\n\r\n\t\tvar annotationReplyId = parseInt($(this)[0].id.split(\"_\"));\r\n\r\n\t\tif (!annotationReplyExists(annotationReplyId)) {\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\t// Get the artwork and annotation canvas based on the speechbubble.\r\n\t\tvar oArtworkCanvas = g_oViewer.getCanvas($(this).parent().attr(\"data-artworkCanvas\"));\r\n\t\tvar oAnnotationCanvas = oArtworkCanvas.g_oAnnotationCanvas;\r\n\r\n\t\tg_oAnnotations.deleteAnnotationReply(annotationReplyId, oArtworkCanvas, oAnnotationCanvas);\r\n\t\t$(document).off(\"pointerdown\");\t\t// Remove the PointerDown event to allow other controls to register click events.\r\n\t});\r\n\r\n\t$(\"#divViewerCell\").on(\"click\", \".cancelAnnotationReplyButton\", function (e) {\r\n\t\te.preventDefault();\r\n\t\te.stopPropagation();\r\n\r\n\t\t// Hide + remove container.\r\n\t\tvar parentContainer = $(\".jqte\").parent();\r\n\t\tparentContainer.slideUp();\r\n\t\tsetTimeout(function () { parentContainer.remove(); }, 400);\r\n\r\n\t\tvar annotationReplyId = parseInt($(this)[0].id.split(\"_\"));\r\n\t\tvar annotation = g_oAnnotations.g_oAnnotationsMade.filter(function (annotation) {\r\n\t\t\treturn annotation.id === annotationReplyId;\r\n\t\t})[0];\r\n\r\n\t\t// Aside from this message, nothing else in this annotation can be unsaved - so it is safe to revert to saved state.\r\n\t\tannotation.g_bSaved = true;\r\n\r\n\t\t$(\".jqte_editor\").off(\"pointermove\");\r\n\t\t$(document).off(\"pointerdown\");\t\t// Remove the PointerDown event to allow other controls to register click events.\r\n\t\tchangeCanvasFunction();\r\n\t});\r\n\r\n\t/**\r\n\t * Checks to see whether an annotation reply with that ID exists within the approval.\r\n\t * @param {int} annotationReplyId - The annotation reply identifier\r\n\t * @returns {boolean} Does the annotation reply exist?\r\n\t */\r\n\tvar annotationReplyExists = function (annotationReplyId) {\r\n\t\treturn g_oAnnotations.g_oAnnotationsMade.some(function (annotation) {\r\n\t\t\treturn annotation.g_oReplies.some(function (annotationReply) {\r\n\t\t\t\treturn annotationReply.id === annotationReplyId;\r\n\t\t\t});\r\n\t\t});\r\n\t};\r\n\r\n\t// Bind the annotation audit button.\r\n\t$(\"#divViewerCell\").on(\"click\", \".annotationauditbutton\", function (e) {\r\n\t\te.preventDefault();\r\n\t\te.stopPropagation();\r\n\r\n\t\t// Get the id of the annotation.\r\n\t\tvar iAnnotationId = g_oAnnotations.getIdFromElementId($(this)[0].id);\r\n\r\n\t\t// Get the matching annotation.\r\n\t\tvar oMatchingAnnotation = $.grep(g_oAnnotations.g_oAnnotationsMade, function (annotation) { return annotation.id === iAnnotationId; })[0];\r\n\r\n\t\t// Determine if the annotation is an SVG annotation.\r\n\t\tvar bSVGAnnotation = oMatchingAnnotation.g_bSVGTextAnnotation;\r\n\r\n\t\t// If the annotation slide out is collapsed, open it.\r\n\t\tif (g_oSettings.g_oUserSettings.LeftMenuCollapse) {\r\n\r\n\t\t\t// Slide the menu to the correct position.\r\n\t\t\tslideDiv($(\"#divAnnotationsContainer\"), true, true);\r\n\t\t}\r\n\r\n\t\t// Get the annotation audit trail.\r\n\t\tg_oAudit.getAnnotationAudit(iAnnotationId, bSVGAnnotation);\r\n\t});\r\n\r\n\t// Bind the close annotation audit button.\r\n\t$(\"#divViewerCell\").on(\"click\", \".closeannotationauditbutton\", function (e) {\r\n\t\te.preventDefault();\r\n\t\te.stopPropagation();\r\n\r\n\t\t// Get the id of the annotation.\r\n\t\tvar iAnnotationId = g_oAnnotations.getIdFromElementId($(this)[0].id);\r\n\r\n\t\t// Close the annotation audit trail.\r\n\t\tg_oAudit.closeAnnotationAudit(iAnnotationId, true);\r\n\t});\r\n\r\n\t// Bind the annotation data button.\r\n\t$(\"#divViewerCell\").on(\"click\", \".annotationdatabutton\", function (e) {\r\n\t\te.preventDefault();\r\n\t\te.stopPropagation();\r\n\r\n\t\t// Get the id of the annotation.\r\n\t\tvar iAnnotationId = g_oAnnotations.getIdFromElementId($(this)[0].id);\r\n\r\n\t\t// Get the matching annotation.\r\n\t\tvar oMatchingAnnotation = $.grep(g_oAnnotations.g_oAnnotationsMade, function (annotation) { return annotation.id === iAnnotationId; })[0];\r\n\r\n\t\t// If the annotation slide out is collapsed, open it.\r\n\t\tif (g_oSettings.g_oUserSettings.LeftMenuCollapse) {\r\n\r\n\t\t\t// Slide the menu to the correct position.\r\n\t\t\tslideDiv($(\"#divAnnotationsContainer\"), true, true);\r\n\t\t}\r\n\r\n\t\t// Get the annotation audit trail.\r\n\t\tg_oAnnotationData.renderAnnotationData(iAnnotationId, oMatchingAnnotation.g_iAnnotationType, oMatchingAnnotation.g_oAnnotationData);\r\n\t});\r\n\r\n\t// Bind the close annotation data button.\r\n\t$(\"#divViewerCell\").on(\"click\", \".closeannotationdatabutton\", function (e) {\r\n\t\te.preventDefault();\r\n\t\te.stopPropagation();\r\n\r\n\t\t// Get the id of the annotation.\r\n\t\tvar iAnnotationId = g_oAnnotations.getIdFromElementId($(this)[0].id);\r\n\r\n\t\t// Close the annotation data.\r\n\t\tg_oAnnotationData.closeAnnotationData(iAnnotationId, true);\r\n\t});\r\n\r\n\t// Bind the annotation attachments list deletion button to stop default event propagation\r\n\t$(\"#divViewerCell\").on(\"click\", \".attachmentDeletionButton\", function (e) {\r\n\t\te.preventDefault();\r\n\t\te.stopPropagation();\r\n\t\t// Set the id of the annotation.\r\n\t\tg_oAnnotationAttachments.iAnnotationId = g_oAnnotations.getIdFromElementId($(this)[0].id);\r\n\t});\r\n\r\n\t// Bind the annotation attachments list deletion button to stop default event propagation\r\n\t$(\"#divViewerCell\").on(\"click\", \".attachmentLink\", function (e) {\r\n\t\te.preventDefault();\r\n\t\te.stopPropagation();\r\n\t});\r\n\r\n\t// Bind the batch clone button.\r\n\t$(\"#divViewerCell\").on(\"click\", \".copybatchbutton\", function (e) {\r\n\t\te.preventDefault();\r\n\t\te.stopPropagation();\r\n\r\n\t\tvar iId = g_oAnnotations.getIdFromElementId($(this)[0].id);\r\n\r\n\t\t// Lock the screen.\r\n\t\tlockScreen();\r\n\r\n\t\t// Create Server Call for the data.\r\n\t\tvar oJSON = {\r\n\t\t\tszSessionId: g_szSessionId,\r\n\t\t\tiAnnotationId: iId\r\n\t\t};\r\n\r\n\t\t// Clone.\r\n\t\t$.post({\r\n\t\t\turl: \"internal/GreenlightAnnotation/CopyBatchAnnotations\",\r\n\t\t\tdata: JSON.stringify(oJSON),\r\n\t\t\tcontentType: \"application/json; charset=utf-8\",\r\n\t\t\tdataType: \"json\",\r\n\t\t\tcache: false,\r\n\t\t\tsuccess: function (oResponse) {\r\n\t\t\t\tif (oResponse.Success) {\r\n\t\t\t\t\tg_oGreenlightMessages.displaySuccessBubble(g_oMultiView.c_szCopyAnnotationSuccess);\r\n\t\t\t\t\t// Add the annotations to be blocked from copy.\r\n\t\t\t\t\tg_oMultiView.copiedAnnotationIds = $.merge(g_oMultiView.copiedAnnotationIds, JSON.parse(oResponse.Contents).AnnotationIds);\r\n\t\t\t\t\t// Hide the current annotation used.\r\n\t\t\t\t\t$(\"input[id=\" + iId + \"_batchAdd]\").hide();\r\n\r\n\t\t\t\t} else {\r\n\t\t\t\t\tg_oGreenlightMessages.displayErrorBubble(displayErrorContentHTML(oResponse.Errors));\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t})\r\n\t\t\t.always(function () {\r\n\t\t\t\tunlockScreen();\r\n\t\t\t\t$(document).off(\"pointerdown\");\t// Remove the PointerDown event to allow other controls to register click events.\r\n\t\t\t});\r\n\t});\r\n\r\n\t// Renders an annotation bubble on the canvas when clicked.\r\n\t$(\"#divViewerCell\").on(\"click\", \".annotationListItem\", function (e) {\r\n\r\n\t\te.preventDefault();\r\n\r\n\t\t// Highlight the annotation list item.\r\n\t\t$(\".annotationListItem\").removeClass(\"annotationListItemSelected\");\r\n\t\t$(this).addClass(\"annotationListItemSelected\");\r\n\r\n\t\t// Get the artwork and annotation canvas based on the speech bubble.\r\n\t\tvar oArtworkCanvas = g_oViewer.getCanvas($(this).attr(\"data-artworkCanvas\"));\r\n\t\tvar oAnnotationCanvas = oArtworkCanvas.g_oAnnotationCanvas;\r\n\r\n\t\t// Get the sync canvases\r\n\t\tvar oSyncCanvas = g_oCompare.getSyncCanvas(g_oViewer.g_oArtworkViewer);\r\n\r\n\t\tfor (var sync in oSyncCanvas) {\r\n\t\t\tif (oSyncCanvas[sync] == oArtworkCanvas) {\r\n\t\t\t\t// Annotation is on the compare viewer, so the sync canvas should be the original artwork viewer\r\n\t\t\t\toSyncCanvas[sync] = g_oViewer.g_oArtworkViewer;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\r\n\t\t// Find the annotation we have just clicked on.\r\n\t\tvar id = $(this).attr(\"id\");\r\n\t\tid = id.substring(3);\r\n\r\n\t\t// Get the matching annotation.\r\n\t\tvar oMatchingAnnotation = $.grep(g_oAnnotations.g_oAnnotationsMade, function (ann) { return ann.id == id; });\r\n\r\n\t\t// If the matching annotation has been found.\r\n\t\tif (oMatchingAnnotation.length > 0) {\r\n\r\n\t\t\t// If this is a text measurement with no words.\r\n\t\t\tif (oMatchingAnnotation[0].g_iAnnotationType === eAnnotationTypes.TextMeasurement &&\r\n\t\t\t\toMatchingAnnotation[0].g_oTextMeasurementWordsArray.length === 0) {\r\n\t\t\t\tvar oData = {\r\n\t\t\t\t\toAnnotation: oMatchingAnnotation[0],\r\n\t\t\t\t\toArtworkCanvas: oArtworkCanvas,\r\n\t\t\t\t\toAnnotationCanvas: oAnnotationCanvas\r\n\t\t\t\t};\r\n\t\t\t\tEventService.publish(\"getTextMeasurementText\", oData);\r\n\t\t\t}\r\n\r\n\t\t\tvar existingAnnotationDivs = $(\"#\" + id);\r\n\t\t\tif (!$(existingAnnotationDivs).hasClass(\"speechbubble\")) {\r\n\t\t\t\tif (oArtworkCanvas.g_oDoc.documentType != eDocumentTypes.ThreeD) {\r\n\t\t\t\t\toMatchingAnnotation[0].createAnnotationDiv(eAnnotationDivType.Popup, true, null, oArtworkCanvas, oAnnotationCanvas);\r\n\t\t\t\t\toMatchingAnnotation[0].panToAnnotation(oArtworkCanvas, oAnnotationCanvas, oSyncCanvas);\r\n\r\n\t\t\t\t\tif (oMatchingAnnotation[0].g_iAnnotationType === eAnnotationTypes.TextMeasurement) {\r\n\t\t\t\t\t\tg_oTechTools.setTextMeasurementWordVisibility(oMatchingAnnotation[0].g_oTextMeasurementWordsArray, true);\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\toMatchingAnnotation[0].g_bClosed = false;\r\n\t\t\t\t\toAnnotationCanvas.redraw(false);\r\n\t\t\t\t}\r\n\t\t\t\telse {\r\n\t\t\t\t\t// If its a 3d artwork.\r\n\t\t\t\t\toMatchingAnnotation[0].createAnnotationDiv(eAnnotationDivType.Popup, 1, [400, 100], oArtworkCanvas, oAnnotationCanvas);\r\n\r\n\t\t\t\t\t// Setup the camera to point to the annotation. This will move the 3D image to show the annotation on screen.\r\n\t\t\t\t\tvar markup = $.grep(oArtworkCanvas.g_oScene.children, function (child) { return child.Id == id; });\r\n\t\t\t\t\t// Reset colour on each annotation mark-up\r\n\t\t\t\t\tg_oAnnotations.redraw3DAnnotations(oArtworkCanvas, oAnnotationCanvas);\r\n\t\t\t\t\t// Then highlight the selected mark-up\r\n\t\t\t\t\tif (markup.length) {\r\n\t\t\t\t\t\toArtworkCanvas.g_oCamera.lookAt(markup[0].position);\r\n\t\t\t\t\t\tvar newZPosition;\r\n\t\t\t\t\t\tif (markup[0].position.z < 0) {\r\n\t\t\t\t\t\t\tnewZPosition = markup[0].position.z - 0.15;\r\n\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\tnewZPosition = markup[0].position.z + 0.15;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\toArtworkCanvas.g_oCamera.position.set(markup[0].position.x, markup[0].position.y, newZPosition);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\t// Otherwise, if this is not a threeD document.\r\n\t\t\telse if (oArtworkCanvas.g_oDoc.documentType != eDocumentTypes.ThreeD) {\r\n\r\n\t\t\t\t// Pan to the annotation.\r\n\t\t\t\toMatchingAnnotation[0].panToAnnotation(oArtworkCanvas, oAnnotationCanvas, oSyncCanvas);\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\te.stopPropagation();\r\n\t});\r\n\r\n\t// Bind the annotation attachment icon on click.\r\n\t$(\"#divViewerCell\").on(\"click\", \".annotationattachmentbutton\", function (e) {\r\n\r\n\t\te.preventDefault();\r\n\t\te.stopPropagation();\r\n\r\n\t\t// Get the id of the annotation.\r\n\t\tvar iAnnotationId = g_oAnnotations.getIdFromElementId($(this)[0].id);\r\n\r\n\t\tg_oAnnotationAttachments.iAnnotationId = iAnnotationId;\r\n\t\tg_oAnnotationAttachments.renderPopupAttachments(iAnnotationId);\r\n\r\n\t\tg_oAnnotationAttachments.displayUploadPopUp();\r\n\t});\r\n\r\n\t// Bind the annotation attachment close icon on click.\r\n\t$('#divCloseUploadOverlay').click(function () {\r\n\t\tg_oAnnotationAttachments.iAnnotationId = null;\r\n\t\thidePopupWindow(\"divUploadOverlay\");\r\n\t});\r\n\r\n\t// Updates/set an annotation status.\r\n\t$(\"#divViewerCell\").on(\"click\", \".addStatusButton\", function (e) {\r\n\t\te.preventDefault();\r\n\t\te.stopPropagation();\r\n\r\n\t\t// Close any open annotation color pallets.\r\n\t\tAnnotation.prototype.RemoveLastColourSelection();\r\n\r\n\t\t// Work out the id of the annotation we have clicked on.\r\n\t\tvar szIsListItemPrefix = \"\";\r\n\t\tvar id = $(this).parent().attr(\"id\");\r\n\t\tif (id.indexOf(\"li_\") !== -1) {\r\n\t\t\tid = id.substring(3);\r\n\t\t\tszIsListItemPrefix = \"li_\";\r\n\t\t}\r\n\r\n\t\t// Get the clicked annotations status.\r\n\t\tvar szStatus = this.getAttribute(\"data-annotationstatus\");\r\n\r\n\t\t// Get the status code from the status.\r\n\t\tvar iStatusCode = 0;\r\n\t\tswitch (szStatus) {\r\n\t\t\tcase \"Approved\":\r\n\t\t\t\tiStatusCode = eAnnotationStatuses.Approved;\r\n\t\t\t\tbreak;\r\n\t\t\tcase \"Rejected\":\r\n\t\t\t\tiStatusCode = eAnnotationStatuses.Rejected;\r\n\t\t\t\tbreak;\r\n\t\t\tcase \"Query\":\r\n\t\t\t\tiStatusCode = eAnnotationStatuses.Query;\r\n\t\t\t\tbreak;\r\n\t\t\tcase \"ToDo\":\r\n\t\t\t\tiStatusCode = eAnnotationStatuses.ToDo;\r\n\t\t\t\tbreak;\r\n\t\t}\r\n\t\t\r\n\t\t// Determine the canvas to used for rendering based on the annotation.\r\n\t\tvar oAnnotationCanvas = g_oViewer.getCanvas(g_oCompare.getAnnotationCanvasId());\r\n\t\tvar oArtworkCanvas = g_oViewer.getLinkedArtworkCanvas(oAnnotationCanvas.g_szCanvasId);\r\n\r\n\t\t// Find the matching Annotation.\r\n\t\tvar oMatchingAnnotation = $.grep(g_oAnnotations.g_oAnnotationsMade, function (annotation) { return annotation.id == id; });\r\n\r\n\t\t// If the annotation audit trail is open, close the annotation audit trail.\r\n\t\tif ($(\"#\" + oMatchingAnnotation[0].id + \"_annotationAuditContainer\").css(\"display\") != \"none\") {\r\n\t\t\tg_oAudit.closeAnnotationAudit(oMatchingAnnotation[0].id, false);\r\n\t\t}\r\n\r\n\t\t// Has the author already left an existing status on the annotation.\r\n\t\tvar iExistingStatus = $.grep(oMatchingAnnotation[0].g_oStatuses, function (status) { return status.g_iAuthor == g_oUserDetails.UserId; });\r\n\r\n\t\t// If this is an unlocked annotation, all users share the same annotation status.\r\n\t\tif (oMatchingAnnotation[0].g_bUnlocked) {\r\n\t\t\tiExistingStatus = oMatchingAnnotation[0].g_oStatuses;\r\n\t\t}\r\n\r\n\t\t// We should work out what annotation status change action to perform.\r\n\t\tvar iStatusChangeAction = g_oAnnotations.setAnnotationStatusUpdateAction(iExistingStatus, iStatusCode);\r\n\r\n\t\t// Process the annotation status action.\r\n\t\tswitch (iStatusChangeAction) {\r\n\t\t\tcase eAnnotationStatusUpdateType.addStatus:\r\n\r\n\t\t\t\t// There is no status, we need to create the status text area and create a new Annotation Status object.\r\n\t\t\t\tvar oNewAnnotationStatus = g_oAnnotations.createAnnotationStatus();\r\n\t\t\t\toNewAnnotationStatus.g_iApprovalUserAnnotId = oMatchingAnnotation[0].id;\r\n\t\t\t\toNewAnnotationStatus.g_iAuthor = g_oUserDetails.UserId;\r\n\t\t\t\toNewAnnotationStatus.g_szAuthorEmail = g_oUserDetails.EmailAddress;\r\n\t\t\t\toNewAnnotationStatus.g_iAnnotationStatus = iStatusCode;\r\n\t\t\t\toNewAnnotationStatus.annotationStatusDateTime = Date.now();\r\n\r\n\t\t\t\t// Update any list items.\r\n\t\t\t\tszIsListItemPrefix = \"li_\";\r\n\t\t\t\tvar statusContainerId = \"sc_\" + szIsListItemPrefix + oMatchingAnnotation[0].id;\r\n\t\t\t\toMatchingAnnotation[0].createAnnotationTextArea(\"st_\" + oMatchingAnnotation[0].id, oNewAnnotationStatus.g_iAuthor, g_oUserDetails.EmailAddress, \"\", 2, true, szStatus, document.getElementById(statusContainerId), Date.now(), null, oArtworkCanvas);\r\n\r\n\t\t\t\t// Update any pop-up if it exists.\r\n\t\t\t\tvar statusContainerListId = \"sc_\" + oMatchingAnnotation[0].id;\r\n\t\t\t\toMatchingAnnotation[0].createAnnotationTextArea(\"st_\" + oMatchingAnnotation[0].id, oNewAnnotationStatus.g_iAuthor, g_oUserDetails.EmailAddress, \"\", 2, true, szStatus, document.getElementById(statusContainerListId), Date.now(), null, oArtworkCanvas);\r\n\r\n\t\t\t\t// Push the new status to the annotation.\r\n\t\t\t\toMatchingAnnotation[0].g_oStatuses.push(oNewAnnotationStatus);\r\n\t\t\t\tbreak;\r\n\r\n\t\t\tcase eAnnotationStatusUpdateType.updateStatus:\r\n\r\n\t\t\t\t// Keep track of the original and new author of the annotation.\r\n\t\t\t\tvar iOriginalAuthorId = iExistingStatus[0].g_iAuthor;\r\n\t\t\t\tvar iNewAuthorId = g_oUserDetails.UserId;\r\n\r\n\t\t\t\t// Update the details of the annotation status.\r\n\t\t\t\tiExistingStatus[0].g_iAnnotationStatus = iStatusCode;\r\n\t\t\t\tiExistingStatus[0].g_iAuthor = iNewAuthorId;\r\n\t\t\t\tiExistingStatus[0].g_szAuthorEmail = g_oUserDetails.EmailAddress;\r\n\t\t\t\tiExistingStatus[0].annotationStatusDateTime = Date.now();\r\n\r\n\t\t\t\t// Find the pop-up and update the status value and author.\r\n\t\t\t\tvar relatedPopups = $(\"#\" + oMatchingAnnotation[0].id).find(\"[data-statusfield=\\\"statusValue\\\"]\" + \"[data-authorid =\\\"\" + iOriginalAuthorId + \"\\\"]\");\r\n\t\t\t\tif (relatedPopups.length !== 0) {\r\n\t\t\t\t\trelatedPopups[0].textContent = szStatus;\r\n\t\t\t\t\trelatedPopups[0].setAttribute(\"data-authorid\", iNewAuthorId);\r\n\t\t\t\t\tif (relatedPopups.prev(\".HeaderTextStatus\").children(\"[data-statusfield=\\\"statusAuthor\\\"]\").length !== 0) {\r\n\t\t\t\t\t\trelatedPopups.prev(\".HeaderTextStatus\").children(\"[data-statusfield=\\\"statusAuthor\\\"]\")[0].textContent = g_oAnnotations.getDisplayName(g_oUserDetails.EmailAddress, \"\") + \" \" + formatDate(iExistingStatus[0].annotationStatusDateTime);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\r\n\t\t\t\t// Find the list item and update the status value and author.\r\n\t\t\t\tvar relatedAnnotationListItems = $(\"#li_\" + oMatchingAnnotation[0].id).find(\"[data-statusfield=\\\"statusValue\\\"]\" + \"[data-authorid =\\\"\" + iOriginalAuthorId + \"\\\"]\");\r\n\t\t\t\tif (relatedAnnotationListItems.length !== 0) {\r\n\t\t\t\t\trelatedAnnotationListItems[0].textContent = szStatus;\r\n\t\t\t\t\trelatedAnnotationListItems[0].setAttribute(\"data-authorid\", iNewAuthorId);\r\n\t\t\t\t\tif (relatedAnnotationListItems.prev(\".HeaderTextStatus\").children(\"[data-statusfield=\\\"statusAuthor\\\"]\").length !== 0) {\r\n\t\t\t\t\t\trelatedAnnotationListItems.prev(\".HeaderTextStatus\").children(\"[data-statusfield=\\\"statusAuthor\\\"]\")[0].textContent = g_oAnnotations.getDisplayName(g_oUserDetails.EmailAddress, \"\") + \" \" + formatDate(iExistingStatus[0].annotationStatusDateTime);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t}\r\n\t\t\r\n\t\t// Save directly.\r\n\t\tif (g_szSessionId !== 0 && g_oAnnotations.g_iApprovalId === oMatchingAnnotation[0].g_iApprovalId) {\r\n\r\n\t\t\t// If we are updating an existing status.\r\n\t\t\tif (iExistingStatus.length && iStatusChangeAction !== eAnnotationStatusUpdateType.deleteStatus) {\r\n\r\n\t\t\t\t// Update the existing status.\r\n\t\t\t\tiExistingStatus[0].annotationSaveStatus(oMatchingAnnotation[0]);\r\n\t\t\t}\r\n\t\t\t// If we are removing a status.\r\n\t\t\telse if (iExistingStatus.length && iStatusChangeAction === eAnnotationStatusUpdateType.deleteStatus) {\r\n\t\t\t\tiExistingStatus[0].deleteAnnotationStatus(oMatchingAnnotation[0], iExistingStatus[0].id, oArtworkCanvas, oAnnotationCanvas, true, true, true);\r\n\t\t\t}\r\n\t\t\t// If we are adding a new status.\r\n\t\t\telse {\r\n\t\t\t\toNewAnnotationStatus.annotationSaveStatus(oMatchingAnnotation[0]);\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\t// Update the status icons.\r\n\t\t\t$(\".Approved_statusGroup_\" + id).attr(\"src\", (iStatusCode == eAnnotationStatuses.Approved && iStatusChangeAction != eAnnotationStatusUpdateType.deleteStatus ? \"img/Status_Approved_Inverted_16.svg\" : \"img/Status_Approved_White_16.svg\"));\r\n\t\t\t$(\".Rejected_statusGroup_\" + id).attr(\"src\", (iStatusCode == eAnnotationStatuses.Rejected && iStatusChangeAction != eAnnotationStatusUpdateType.deleteStatus ? \"img/Status_Rejected_Inverted_16.svg\" : \"img/Status_Rejected_White_16.svg\"));\r\n\t\t\t$(\".Query_statusGroup_\" + id).attr(\"src\", (iStatusCode == eAnnotationStatuses.Query && iStatusChangeAction != eAnnotationStatusUpdateType.deleteStatus ? \"img/Status_Query_Inverted_16.svg\" : \"img/Status_Query_White_16.svg\"));\r\n\t\t\t$(\".ToDo_statusGroup_\" + id).attr(\"src\", (iStatusCode == eAnnotationStatuses.ToDo && iStatusChangeAction != eAnnotationStatusUpdateType.deleteStatus ? \"img/Status_ToDo_Inverted_16.svg\" : \"img/Status_ToDo_White_16.svg\"));\r\n\r\n\t\t\t// Update the status icon tooltips.\r\n\t\t\tAnnotation.prototype.renderAnnotationStatusTooltips(id, iStatusCode, iStatusChangeAction);\r\n\r\n\t\t\t// Scroll to the updated status icons in the list.\r\n\t\t\tAnnotation.prototype.ScrollStatusAnnotationList(oMatchingAnnotation[0]);\r\n\t\t}\r\n\t});\r\n\r\n\t/**\r\n\t* Step through functions.\r\n\t*/\r\n\r\n\t// Bind the step through function.\r\n\t$(\"#imgStepThroughAnnotations\").on(\"click\", function (e) {\r\n\t\tg_oAnnotations.stepThroughAnnotations(g_oViewer.g_oArtworkViewer, g_oViewer.g_oAnnotationViewer);\r\n\t});\r\n\r\n\t// Show Annotation Numbers.\r\n\t$(\"#btnShowAnnNumbers, #settings_ShowAnnotationNumbersToggle\").on(\"click\", function (e) {\r\n\t\t\r\n\t\t// If the annotation numbers are currently hidden.\r\n\t\tif (!g_oSettings.g_oUserSettings.ShowAnnotationNumbers) {\r\n\r\n\t\t\t// Set that the numbers should be shown.\r\n\t\t\tg_oSettings.g_oUserSettings.ShowAnnotationNumbers = true;\r\n\r\n\t\t\t// Fade in the annotation numbers in the list.\r\n\t\t\t$(\".annNumber\").fadeIn(500);\r\n\t\t}\r\n\t\t// If the annotation numbers are currently shown.\r\n\t\telse {\r\n\r\n\t\t\t// Set that the numbers should be hidden.\r\n\t\t\tg_oSettings.g_oUserSettings.ShowAnnotationNumbers = false;\r\n\r\n\t\t\t// Fade out the annotation numbers in the list.\r\n\t\t\t$(\".annNumber\").fadeOut(500);\r\n\t\t}\r\n\r\n\t\t// Update the setting.\r\n\t\tg_oSettings.updateSettingShowAnnotationNumbers(true);\r\n\r\n\t\t// Determine the canvas to used for rendering based on the annotation toggle.\r\n\t\tvar oAnnotationCanvas = g_oViewer.getCanvas(g_oCompare.getAnnotationCanvasId());\r\n\t\tvar oArtworkCanvas = g_oViewer.getLinkedArtworkCanvas(oAnnotationCanvas.g_szCanvasId);\r\n\r\n\t\t// If this is not a threeD document.\r\n\t\tif (oArtworkCanvas.g_oDoc.documentType != eDocumentTypes.ThreeD) {\r\n\r\n\t\t\t// Redraw the annotations with the show number setting updated.\r\n\t\t\toAnnotationCanvas.redraw(false);\r\n\t\t}\r\n\t\t// If this is a threeD document.\r\n\t\telse {\r\n\r\n\t\t\t// Redraw the threeD annotations with the show number setting updated.\r\n\t\t\tg_oAnnotations.redraw3DAnnotations(oArtworkCanvas, oAnnotationCanvas);\r\n\t\t}\r\n\t});\r\n\r\n\t// Print Annotations.\r\n\t$(\"#btnPrintAnnotations\").on(\"click\", function (e) {\r\n\r\n\t\t// Determine the approval id based on the annotation toggle.\r\n\t\tvar bUseCompareApproval = $(\"#chkAnnotationToggle\").prop(\"checked\");\r\n\r\n\t\t// Determine the number of documents with approvals.\r\n\t\tvar oDocs = comboControl_GetControlById(\"approvalNameComboControl\", false).documents;\r\n\r\n\t\t// Hacky way of checking for versions. If it's got an approval & it was put in the database before this approval,\r\n\t\t// it's probably a previous version.\r\n\t\tvar oDocumentsInApproval = $.grep(oDocs, function (document) {\r\n\t\t\treturn document.greenlightApprovalId > 0 && document.greenlightApprovalId < oDocs[g_oaComboControls[0].selectedDocumentIndex].greenlightApprovalId;\r\n\t\t});\r\n\r\n\t\t// If there are other documents with approvals.\r\n\t\tif (oDocumentsInApproval.length > 0) {\r\n\r\n\t\t\t// Create the confirmation option.\r\n\t\t\tvar oConfirmAction = function () {\r\n\t\t\t\tg_oApproval.CreateAnnotationsReport(bUseCompareApproval, true, oDocs);\r\n\t\t\t};\r\n\r\n\t\t\t// Create the rejection option.\r\n\t\t\tvar oRejectionAction = function () {\r\n\t\t\t\tg_oApproval.CreateAnnotationsReport(bUseCompareApproval, false, oDocs);\r\n\t\t\t};\r\n\r\n\t\t\t// Display a confirmation message to check if other documents should be included in the report.\r\n\t\t\tg_oGreenlightMessages.displayConfirmBubble(\"Include previous approval versions in the document?\", oConfirmAction, oRejectionAction);\r\n\t\t}\r\n\t\t// If there are no other documents with approvals.\r\n\t\telse {\r\n\r\n\t\t\t// Create the annotation report with the current document only.\r\n\t\t\tg_oApproval.CreateAnnotationsReport(bUseCompareApproval, false, oDocs);\r\n\t\t}\r\n\t});\r\n\r\n\t/**\r\n\t* Annotation Filtering\r\n\t*/\r\n\r\n\t$(\"#divFilterAnnotations\").on(\"click\", function (e) {\r\n\r\n\t\t// Toggle the filters section.\r\n\t\tg_oFilter.toggleAnnotationFilters();\r\n\t});\r\n\r\n\t$(\"#divViewerCell\").on(\"focus\", \"#txtAnnListFilterBox\", function (e) {\r\n\r\n\t\t// If we have a value.\r\n\t\tif (this.value.trim().length === 0) {\r\n\r\n\t\t\t// Reset the filter box.\r\n\t\t\tg_oFilter.resetFilterOptions(\"divAnnListFilterBox\");\r\n\t\t}\r\n\t\telse {\r\n\r\n\t\t\t// Update the filter box.\r\n\t\t\tg_oFilter.updateFilterOptions(\"divAnnListFilterBox\", this.value.toLowerCase());\r\n\t\t}\r\n\r\n\t\t// Show the filter options dropdown.\r\n\t\t$(\"#divAnnListFilterBox\").show();\r\n\t});\r\n\r\n\t$(\"#divViewerCell\").on(\"keyup\", \"#txtAnnListFilterBox\", function (e) {\r\n\t\te.preventDefault();\r\n\t\te.stopPropagation();\r\n\t\t\r\n\t\t// Show the filter options dropdown.\r\n\t\t$(\"#divAnnListFilterBox\").show();\r\n\r\n\t\t// If this is the enter key.\r\n\t\tif (e.which === 13) {\r\n\r\n\t\t\t// Click the filter option.\r\n\t\t\tg_oFilter.clickFilterOption();\r\n\t\t}\r\n\t\t// If this is the down arrow.\r\n\t\telse if (e.which === 40) {\r\n\r\n\t\t\t// Select the next filter option.\r\n\t\t\tg_oFilter.selectNextFilterOption();\r\n\t\t}\r\n\t\t// If this is the up arrow.\r\n\t\telse if (e.which === 38) {\r\n\r\n\t\t\t// Select the previous filter option.\r\n\t\t\tg_oFilter.selectPreviousFilterOption();\r\n\t\t}\r\n\t\t// If we have a no value.\r\n\t\telse if (this.value.trim().length === 0) {\r\n\r\n\t\t\t// Reset the filter box.\r\n\t\t\tg_oFilter.resetFilterOptions(\"divAnnListFilterBox\");\r\n\t\t}\r\n\t\t// If the string has live test.\r\n\t\telse if (this.value.match(\"<(.|\\n)*?>\")) {\r\n\r\n\t\t\t// Remove the value.\r\n\t\t\tthis.value = \"\";\r\n\r\n\t\t\t// Reset the filter box.\r\n\t\t\tg_oFilter.resetFilterOptions(\"divAnnListFilterBox\");\r\n\r\n\t\t\t// Display a warning to indicate this cannot be used to filter.\r\n\t\t\tg_oGreenlightMessages.displayWarningBubble(g_oFilter.c_szFilter_Message_UnableToFilter);\r\n\t\t}\r\n\t\t// We have a valid value.\r\n\t\telse {\r\n\r\n\t\t\t// Update the filter box.\r\n\t\t\tg_oFilter.updateFilterOptions(\"divAnnListFilterBox\", this.value.toLowerCase());\r\n\t\t}\r\n\t});\r\n\r\n\t$(\"#imgFilterReset\").on(\"click\", function (e) {\r\n\t\t\r\n\t\t// Reset the filters.\r\n\t\tg_oFilter.resetActiveFilters();\r\n\t});\r\n\r\n\t/**\r\n\t* SVG Filtering\r\n\t*/\r\n\r\n\t$(\"#divToolBar\").on(\"focus\", \"#txtSVGTextSearch\", function (e) {\r\n\t\t$(this).animate({ width: \"95%\" });\r\n\t\te.preventDefault();\r\n\t\te.stopPropagation();\r\n\t});\r\n\r\n\t$(\"#divToolBar\").on(\"blur\", \"#txtSVGTextSearch\", function (e) {\r\n\t\t$(this).animate({ width: \"50%\" });\r\n\t\te.preventDefault();\r\n\t\te.stopPropagation();\r\n\t});\r\n\r\n\t$(\"#divToolBar\").on(\"keyup\", \"#txtSVGTextSearch\", function (e) {\r\n\r\n\t\t// Get the content of the SVG search box.\r\n\t\tvar szSearchContent = $(\"#txtSVGTextSearch\").val();\r\n\r\n\t\t// Determine the canvas to used for rendering based on the annotation toggle.\r\n\t\tvar oAnnotationCanvas = g_oViewer.getCanvas(g_oCompare.getAnnotationCanvasId());\r\n\t\tvar oArtworkCanvas = g_oViewer.getLinkedArtworkCanvas(oAnnotationCanvas.g_szCanvasId);\r\n\r\n\t\t// If this is the enter key.\r\n\t\tif (e.which === 13) {\r\n\r\n\t\t\t// Run the SVG text search.\r\n\t\t\tg_oSVGSearch.searchSVGText(szSearchContent, oArtworkCanvas, oAnnotationCanvas);\r\n\t\t}\r\n\t\t// If there is no text in the search content.\r\n\t\telse if (szSearchContent.length === 0) {\r\n\r\n\t\t\t// Remove any existing SVG search annotations.\r\n\t\t\tg_oSVGText.removeSVGSearchAnnotations(oArtworkCanvas, oAnnotationCanvas, true);\r\n\t\t}\r\n\t});\r\n\r\n\t$(\"#btnSVGFindText\").on(\"click\", function (e) {\r\n\r\n\t\t// Toggle the active state of finding SVG text.\r\n\t\tg_oViewer.c_bFindSVGText = !g_oViewer.c_bFindSVGText;\r\n\r\n\t\t// If we are now finding SVG text.\r\n\t\tif (g_oViewer.c_bFindSVGText) {\r\n\r\n\t\t\t// Reshow annotations if they are hidden.\r\n\t\t\tif (!g_oSettings.g_oUserSettings.ShowAnnotations) {\r\n\t\t\t\t$(\"#HideAnnotations\").click();\r\n\t\t\t}\r\n\r\n\t\t\t// Highlight the find SVG text icon.\r\n\t\t\t$(\"#btnSVGFindText\").addClass(\"selectedButton\");\r\n\t\t}\r\n\t\t// If we are no longer finding SVG text.\r\n\t\telse {\r\n\r\n\t\t\t// Determine the canvas to used for rendering based on the annotation toggle.\r\n\t\t\tvar oAnnotationCanvas = g_oViewer.getCanvas(g_oCompare.getAnnotationCanvasId());\r\n\t\t\tvar oArtworkCanvas = g_oViewer.getLinkedArtworkCanvas(oAnnotationCanvas.g_szCanvasId);\r\n\r\n\t\t\t// Remove any existing hover annotations.\r\n\t\t\tg_oSVGText.removeSVGHoverAnnotations(oArtworkCanvas, oAnnotationCanvas, true);\r\n\r\n\t\t\t// Clear the SVG search.\r\n\t\t\tg_oSVGSearch.clearSVGSearch(oArtworkCanvas, oAnnotationCanvas, true);\r\n\r\n\t\t\t// Un-highlight the find SVG text icon.\r\n\t\t\t$(\"#btnSVGFindText\").removeClass(\"selectedButton\");\r\n\t\t}\r\n\t});\r\n\r\n\t$(\"#btnSVGTextSearch\").on(\"click\", function (e) {\r\n\r\n\t\t// Get the content of the SVG search box.\r\n\t\tvar szSearchContent = $(\"#txtSVGTextSearch\").val();\r\n\r\n\t\t// Determine the canvas to used for rendering based on the annotation toggle.\r\n\t\tvar oAnnotationCanvas = g_oViewer.getCanvas(g_oCompare.getAnnotationCanvasId());\r\n\t\tvar oArtworkCanvas = g_oViewer.getLinkedArtworkCanvas(oAnnotationCanvas.g_szCanvasId);\r\n\r\n\t\t// Run the SVG text search.\r\n\t\tg_oSVGSearch.searchSVGText(szSearchContent, oArtworkCanvas, oAnnotationCanvas);\r\n\t});\r\n\r\n\t/**\r\n\t * Zoom slider.\r\n\t */\r\n\t$(\"#divNavSlider_Range\").on(\"change\", function () {\r\n\t\tg_oViewer.g_oArtworkViewer.g_oCanvasZoom.zoomSlide(parseInt(this.value));\r\n\t});\r\n\r\n\t/************************** 3D Tools ****************************/\r\n\r\n\r\n\t$('#closeThreeDPreviewOptions').click(function () {\r\n\t\thidePopupWindow(\"divModalOverlay\");\r\n\t});\r\n\r\n\t$('#txtThreeDViewer_Existing_Filter').on('input', function () {\r\n\t\tg_oThreeDView.RenderThreeDViews($('#txtThreeDViewer_Existing_Filter').val().toLowerCase());\r\n\t});\r\n\r\n\t$('#txtThreeDViewer_Model_Filter').on('input', function () {\r\n\t\tg_oThreeDView.RenderModels($('#txtThreeDViewer_Model_Filter').val().toLowerCase());\r\n\t});\r\n\r\n\t$('#divThreeDViewExpansion').click(function () {\r\n\t\tvar szThreeDControlDownArrow = g_oSettings.c_iSkinType === 0 ? \"img/Arrow_Down_White_16.png\" : \"img/Arrow_Down_16.png\";\r\n\t\tvar szThreeDControlRightArrow = g_oSettings.c_iSkinType === 0 ? \"img/Arrow_Right_White_16.png\" : \"img/Arrow_Right_16.png\";\r\n\r\n\t\t// If shown, hide\r\n\t\tif ($('#tblThreeDViewImagePlaceHolders').is(\":visible\")) {\r\n\t\t\t$('#imgExpandThreeDviews').attr('src', szThreeDControlRightArrow);\r\n\t\t\t$('#tblThreeDViewImagePlaceHolders').hide();\r\n\t\t}\r\n\t\telse {// If hidden, show\r\n\t\t\t$('#imgExpandThreeDviews').attr('src', szThreeDControlDownArrow);\r\n\t\t\t$('#tblThreeDViewImagePlaceHolders').show();\r\n\t\t}\r\n\t});\r\n\r\n\t$('#divModelExpansion').click(function () {\r\n\t\tvar szThreeDControlDownArrow = g_oSettings.c_iSkinType === 0 ? \"img/Arrow_Down_White_16.png\" : \"img/Arrow_Down_16.png\";\r\n\t\tvar szThreeDControlRightArrow = g_oSettings.c_iSkinType === 0 ? \"img/Arrow_Right_White_16.png\" : \"img/Arrow_Right_16.png\";\r\n\r\n\t\t// If shown, hide\r\n\t\tif ($('#tblModelImagePlaceHolders').is(\":visible\")) {\r\n\t\t\t$('#imgExpandModels').attr('src', szThreeDControlRightArrow);\r\n\t\t\t$('#tblModelImagePlaceHolders').hide();\r\n\t\t}\r\n\t\telse {// If hidden, show\r\n\t\t\t$('#imgExpandModels').attr('src', szThreeDControlDownArrow);\r\n\t\t\t$('#tblModelImagePlaceHolders').show();\r\n\t\t}\r\n\t});\r\n\r\n\r\n\t/************************** Technical Tools ****************************/\r\n\r\n\t/**\r\n\t* Technical Tools Menu\r\n\t*/\r\n\r\n\t$(\"#btnTechTools\").click(function () {\r\n\r\n\t\t// If we have an active text highlight, prevent the drop down.\r\n\t\tif (g_oTextTools.g_bHighlightInProgress) {\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\tvar thisParent = $(this).parent();\r\n\t\tvar bOpen = thisParent.find(\".dropdown-content\").is(\":visible\");\r\n\t\thighlightButtonClearingAllIcons(thisParent, true);\r\n\t\tif (!bOpen) {\r\n\t\t\t$(\"#divTechToolsDropDown\").slideToggle(200);\r\n\t\t\tg_oSavedCalipers.SelectivelyShowCaliperFlexArrows();\r\n\t\t}\r\n\t\telse {\r\n\t\t\tclearHighlightSelectedButton(thisParent);\r\n\t\t}\r\n\t});\r\n\r\n\t$(\"#divTechToolsPointToPoint\").on(\"click\", function (e) {\r\n\t\tg_oTechTools.toolTypeChange(this, g_oTechTools.g_eMeasurementTypes.POINTTOPOINT);\r\n\t\t$(\".annotationViewer\").off(\"pointerup\");\r\n\t\t$(\".annotationViewer\").off(\"click\");\r\n\t\tchangeCanvasFunction(\".annotationViewer\", \"pointerdown\", function (event) {\r\n\t\t\tg_oMarquee.initiateMarqueeDraw(event,\t\t\t\t\t\t\t\t\t\t \t// The triggering event.\r\n\t\t\t\teAnnotationTypes.PointToPointMeasurement,\t\t\t\t\t// The type of marquee that is to be drawn.\r\n\t\t\t\tg_oViewer.getCanvas(event.currentTarget.id),\t\t\t\t// The Annotation Viewer on which the marquee is drawn.\r\n\t\t\t\tg_oViewer.getLinkedArtworkCanvas(event.currentTarget.id),\t// The Artwork Viewer which contains the dimensions the marquee is to work against.\r\n\t\t\t\tnull,\t\t\t\t\t\t\t\t\t\t\t\t\t\t// The canvas to sync any marquee actions to.\r\n\t\t\t\tg_oTechTools.measurementMarqueeDraw,\t\t\t\t\t\t// The function to be called when the 'pointermove' event is called.\r\n\t\t\t\tg_oTechTools.measurementPointerUp,\t\t\t\t\t\t\t// The function to be called when the 'pointerup' event is called.\r\n\t\t\t\ttrue,\t\t\t\t\t\t\t\t\t\t\t\t\t\t// An optional condition to be met for the marquee to be drawn. Pass TRUE is the condition is not required.\r\n\t\t\t\tfalse,\t\t\t\t\t\t\t\t\t\t\t\t\t\t// An optional override to allow point selections as well as click and drag selections. Pass FALSE if the override is not required.\r\n\t\t\t\tnull,\t\t\t\t\t\t\t\t\t\t\t\t\t\t// An object to pass in line width and line colour if a box-style marquee is to be drawn instead of an overlay marquee. Pass NULL if an overlay marquee is required.\r\n\t\t\t\tfalse);\t\t\t\t\t\t\t\t\t\t\t\t\t\t// Indicate if the marquee should always be initiated without checking criteria.\r\n\t\t});\r\n\t});\r\n\r\n\t$(\"#divTechToolsArea\").on(\"click\", function (e) {\r\n\t\tg_oTechTools.toolTypeChange(this, g_oTechTools.g_eMeasurementTypes.AREA);\r\n\t\t$(\".annotationViewer\").off(\"pointerup\");\r\n\t\t$(\".annotationViewer\").off(\"click\");\r\n\t\tchangeCanvasFunction(\".annotationViewer\", \"pointerdown\", function (event) {\r\n\t\t\tg_oMarquee.initiateMarqueeDraw(event,\t\t\t\t\t\t\t\t\t// The triggering event.\r\n\t\t\t\teAnnotationTypes.AreaMeasurement,\t\t// The type of marquee that is to be drawn.\r\n\t\t\t\tg_oViewer.getCanvas(event.currentTarget.id), // The Annotation Viewer on which the marquee is drawn.\r\n\t\t\t\tg_oViewer.getLinkedArtworkCanvas(event.currentTarget.id), // The Artwork Viewer which contains the dimensions the marquee is to work against.\r\n\t\t\t\tnull,\t\t\t\t\t\t\t\t\t\t// The canvas to sync any marquee actions to.\r\n\t\t\t\tg_oTechTools.measurementMarqueeDraw,\t// The function to be called when the 'pointermove' event is called.\r\n\t\t\t\tg_oTechTools.measurementPointerUp,\t\t// The function to be called when the 'pointerup' event is called.\r\n\t\t\t\ttrue,\t\t\t\t\t\t\t\t\t// An optional condition to be met for the marquee to be drawn. Pass TRUE is the condition is not required.\r\n\t\t\t\tfalse,\t\t\t\t\t\t\t\t\t// An optional override to allow point selections as well as click and drag selections. Pass FALSE if the override is not required.\r\n\t\t\t\tnull,\t\t\t\t\t\t\t\t\t// An object to pass in line width and line colour if a box-style marquee is to be drawn instead of an overlay marquee. Pass NULL if an overlay marquee is required.\r\n\t\t\t\tfalse);\t\t\t\t\t\t\t\t\t// Indicate if the marquee should always be initiated without checking criteria.\r\n\t\t});\r\n\t});\r\n\r\n\t$(\"#divTechToolsHorizontal\").on(\"click\", function (e) {\r\n\t\tg_oSavedCalipers.CaliperMeasurementOptionHover(g_oTechTools.g_eMeasurementTypes.HORIZONTAL);\r\n\t\tg_oTechTools.toolTypeChange(this, g_oTechTools.g_eMeasurementTypes.HORIZONTAL);\r\n\t\t$(\".annotationViewer\").off(\"pointerup\");\r\n\t\t$(\".annotationViewer\").off(\"click\");\r\n\t\tchangeCanvasFunction(\".annotationViewer\", \"pointerdown\", function (event) {\r\n\t\t\t$(\"#divTechToolsDropDown\").slideUp(200);\r\n\t\t\tg_oMarquee.initiateMarqueeDraw(event,\t\t\t\t\t\t\t\t\t// The triggering event.\r\n\t\t\t\teAnnotationTypes.HorizontalCalliperMeasurement,\t// The type of marquee that is to be drawn.\r\n\t\t\t\tg_oViewer.getCanvas(event.currentTarget.id), // The Annotation Viewer on which the marquee is drawn.\r\n\t\t\t\tg_oViewer.getLinkedArtworkCanvas(event.currentTarget.id), // The Artwork Viewer which contains the dimensions the marquee is to work against.\r\n\t\t\t\tnull,\t\t\t\t\t\t\t\t\t\t// The canvas to sync any marquee actions to.\r\n\t\t\t\tg_oTechTools.measurementMarqueeDraw,\t// The function to be called when the 'pointermove' event is called.\r\n\t\t\t\tg_oTechTools.measurementPointerUp,\t\t// The function to be called when the 'pointerup' event is called.\r\n\t\t\t\ttrue,\t\t\t\t\t\t\t\t\t// An optional condition to be met for the marquee to be drawn. Pass TRUE is the condition is not required.\r\n\t\t\t\tfalse,\t\t\t\t\t\t\t\t\t// An optional override to allow point selections as well as click and drag selections. Pass FALSE if the override is not required.\r\n\t\t\t\tnull,\t\t\t\t\t\t\t\t\t// An object to pass in line width and line colour if a box-style marquee is to be drawn instead of an overlay marquee. Pass NULL if an overlay marquee is required.\r\n\t\t\t\tfalse);\t\t\t\t\t\t\t\t\t// Indicate if the marquee should always be initiated without checking criteria.\r\n\t\t});\r\n\t});\r\n\r\n\t$(\"#divTechToolsVertical\").on(\"click\", function (e) {\r\n\t\tg_oSavedCalipers.CaliperMeasurementOptionHover(g_oTechTools.g_eMeasurementTypes.VERTICAL);\r\n\t\tg_oTechTools.toolTypeChange(this, g_oTechTools.g_eMeasurementTypes.VERTICAL);\r\n\t\t$(\".annotationViewer\").off(\"pointerup\");\r\n\t\t$(\".annotationViewer\").off(\"click\");\r\n\t\tchangeCanvasFunction(\".annotationViewer\", \"pointerdown\", function (event) {\r\n\t\t\t$(\"#divTechToolsDropDown\").slideUp(200);\r\n\t\t\tg_oMarquee.initiateMarqueeDraw(event,\t\t\t\t\t\t\t\t\t// The triggering event.\r\n\t\t\t\teAnnotationTypes.VerticalCalliperMeasurement,\t// The type of marquee that is to be drawn.\r\n\t\t\t\tg_oViewer.getCanvas(event.currentTarget.id), // The Annotation Viewer on which the marquee is drawn.\r\n\t\t\t\tg_oViewer.getLinkedArtworkCanvas(event.currentTarget.id), // The Artwork Viewer which contains the dimensions the marquee is to work against.\r\n\t\t\t\tnull,\t\t\t\t\t\t\t\t\t\t// The canvas to sync any marquee actions to.\r\n\t\t\t\tg_oTechTools.measurementMarqueeDraw,\t// The function to be called when the 'pointermove' event is called.\r\n\t\t\t\tg_oTechTools.measurementPointerUp,\t\t// The function to be called when the 'pointerup' event is called.\r\n\t\t\t\ttrue,\t\t\t\t\t\t\t\t\t// An optional condition to be met for the marquee to be drawn. Pass TRUE is the condition is not required.\r\n\t\t\t\tfalse,\t\t\t\t\t\t\t\t\t// An optional override to allow point selections as well as click and drag selections. Pass FALSE if the override is not required.\r\n\t\t\t\tnull,\t\t\t\t\t\t\t\t\t// An object to pass in line width and line colour if a box-style marquee is to be drawn instead of an overlay marquee. Pass NULL if an overlay marquee is required.\r\n\t\t\t\tfalse);\t\t\t\t\t\t\t\t\t// Indicate if the marquee should always be initiated without checking criteria.\r\n\t\t});\r\n\t});\r\n\r\n\t$(\"#divTechToolsHorizontal\").hover(function () {\r\n\t\tg_oSavedCalipers.CaliperMeasurementOptionHover(g_oTechTools.g_eMeasurementTypes.HORIZONTAL);\r\n\t}, function (e) {\r\n\t\t\tg_oSavedCalipers.CaliperMeasurementOptionHoverLeave(e);\r\n\t});\r\n\r\n\t$(\"#techToolsDrodown\").hover(function () { }, function (e) {\r\n\t\tg_oSavedCalipers.TechToolsHoverLeave(e);\r\n\t});\r\n\r\n\t$(\"#divTechToolsDropDown\").hover(function () { }, function (e) {\r\n\t\tg_oSavedCalipers.CaliperMeasurementOptionHoverLeave(e);\r\n\t});\r\n\r\n\t$(\".techToolType\").hover(function () {\r\n\t\tvar szId = GetElementId(this);\r\n\t\tif (szId !== \"divTechToolsHorizontal\" && szId !== \"divTechToolsVertical\") {\r\n\t\t\tg_oSavedCalipers.ClearSavedMeasurementsDiv();\r\n\t\t}\r\n\t});\r\n\r\n\t$(\"#divTechToolsVertical\").hover(function () {\r\n\t\tg_oSavedCalipers.CaliperMeasurementOptionHover(g_oTechTools.g_eMeasurementTypes.VERTICAL);\r\n\t}, function (e) {\r\n\t\t\tg_oSavedCalipers.CaliperMeasurementOptionHoverLeave(e);\r\n\t});\r\n\r\n\t$(\"#divTechToolsBarcode\").on(\"click\", function (e) {\r\n\t\tg_oTechTools.toolTypeChange(this, g_oTechTools.g_eMeasurementTypes.BARCODE);\r\n\t\t$(\".annotationViewer\").off(\"pointerup\");\r\n\t\t$(\".annotationViewer\").off(\"click\");\r\n\t\tchangeCanvasFunction(\".annotationViewer\", \"pointerdown\", function (event) {\r\n\t\t\tg_oMarquee.initiateMarqueeDraw(event,\t\t\t\t\t\t\t\t\t// The triggering event.\r\n\t\t\t\t\t\t\t\t\t\t\teAnnotationTypes.BarcodeMeasurement,\t// The type of marquee that is to be drawn.\r\n\t\t\t\t\t\t\t\t\t\t\tg_oViewer.getCanvas(event.currentTarget.id), // The Annotation Viewer on which the marquee is drawn.\r\n\t\t\t\t\t\t\t\t\t\t\tg_oViewer.getLinkedArtworkCanvas(event.currentTarget.id), // The Artwork Viewer which contains the dimensions the marquee is to work against.\r\n\t\t\t\t\t\t\t\t\t\t\tnull,\t\t\t\t\t\t\t\t\t\t// The canvas to sync any marquee actions to.\r\n\t\t\t\t\t\t\t\t\t\t\tg_oTechTools.measurementMarqueeDraw,\t// The function to be called when the 'pointermove' event is called.\r\n\t\t\t\t\t\t\t\t\t\t\tg_oTechTools.measurementPointerUp,\t\t// The function to be called when the 'pointerup' event is called.\r\n\t\t\t\t\t\t\t\t\t\t\ttrue,\t\t\t\t\t\t\t\t\t// An optional condition to be met for the marquee to be drawn. Pass TRUE is the condition is not required.\r\n\t\t\t\t\t\t\t\t\t\t\tfalse,\t\t\t\t\t\t\t\t\t// An optional override to allow point selections as well as click and drag selections. Pass FALSE if the override is not required.\r\n\t\t\t\t\t\t\t\t\t\t\tnull,\t\t\t\t\t\t\t\t\t// An object to pass in line width and line colour if a box-style marquee is to be drawn instead of an overlay marquee. Pass NULL if an overlay marquee is required.\r\n\t\t\t\t\t\t\t\t\t\t\tfalse);\t\t\t\t\t\t\t\t\t// Indicate if the marquee should always be initiated without checking criteria.\r\n\t\t});\r\n\t});\r\n\r\n\t$(\"#divTechToolsDensity\").on(\"click\", function (e) {\r\n\t\tg_oTechTools.toolTypeChange(this, g_oTechTools.g_eMeasurementTypes.COLOURDENSITY);\r\n\t\t$(\".annotationViewer\").off(\"click\");\r\n\t\t$(\".annotationViewer\").off(\"pointerup\");\r\n\t\tchangeCanvasFunction(\".annotationViewer\", \"pointerdown\", function (event) {\r\n\t\t\tg_oMarquee.initiateMarqueeDraw(event,\t\t\t\t\t\t\t\t\t// The triggering event.\r\n\t\t\t\t\t\t\t\t\t\t\teAnnotationTypes.ColourDensityMeasurement,\t// The type of marquee that is to be drawn.\r\n\t\t\t\t\t\t\t\t\t\t\tg_oViewer.getCanvas(event.currentTarget.id), // The Annotation Viewer on which the marquee is drawn.\r\n\t\t\t\t\t\t\t\t\t\t\tg_oViewer.getLinkedArtworkCanvas(event.currentTarget.id), // The Artwork Viewer which contains the dimensions the marquee is to work against.\r\n\t\t\t\t\t\t\t\t\t\t\tnull,\t\t\t\t\t\t\t\t\t\t// The canvas to sync any marquee actions to.\r\n\t\t\t\t\t\t\t\t\t\t\tg_oTechTools.measurementMarqueeDraw,\t// The function to be called when the 'pointermove' event is called.\r\n\t\t\t\t\t\t\t\t\t\t\tg_oTechTools.measurementPointerUp,\t\t// The function to be called when the 'pointerup' event is called.\r\n\t\t\t\t\t\t\t\t\t\t\ttrue,\t\t\t\t\t\t\t\t\t// An optional condition to be met for the marquee to be drawn. Pass TRUE is the condition is not required.\r\n\t\t\t\t\t\t\t\t\t\t\ttrue,\t\t\t\t\t\t\t\t\t// An optional override to allow point selections as well as click and drag selections. Pass FALSE if the override is not required.\r\n\t\t\t\t\t\t\t\t\t\t\tnull,\t\t\t\t\t\t\t\t\t// An object to pass in line width and line colour if a box-style marquee is to be drawn instead of an overlay marquee. Pass NULL if an overlay marquee is required.\r\n\t\t\t\t\t\t\t\t\t\t\ttrue);\t\t\t\t\t\t\t\t\t// Indicate if the marquee should always be initiated without checking criteria.\r\n\t\t});\r\n\t});\r\n\r\n\t$(\"#divTechToolsText\").on(\"click\", function (e) {\r\n\t\tg_oTechTools.toolTypeChange(this, g_oTechTools.g_eMeasurementTypes.TEXT);\r\n\t\t$(\".annotationViewer\").off(\"pointerup\");\r\n\t\t$(\".annotationViewer\").off(\"click\");\r\n\t\tchangeCanvasFunction(\".annotationViewer\", \"pointerdown\", function (event) {\r\n\r\n\t\t\t// Ensure the annotation document is toggled to this document.\r\n\t\t\tg_oCompare.forceToggleAnnotationDocument(event.currentTarget.id);\r\n\r\n\t\t\t// Initiate the draw.\r\n\t\t\tg_oMarquee.initiateMarqueeDraw(event,\t\t\t\t\t\t\t\t\t// The triggering event.\r\n\t\t\t\t\t\t\t\t\t\t\teAnnotationTypes.TextMeasurement,\t\t// The type of marquee that is to be drawn.\r\n\t\t\t\t\t\t\t\t\t\t\tg_oViewer.getCanvas(event.currentTarget.id), // The Annotation Viewer on which the marquee is drawn.\r\n\t\t\t\t\t\t\t\t\t\t\tg_oViewer.getLinkedArtworkCanvas(event.currentTarget.id), // The Artwork Viewer which contains the dimensions the marquee is to work against.\r\n\t\t\t\t\t\t\t\t\t\t\tnull,\t\t\t\t\t\t\t\t\t\t// The canvas to sync any marquee actions to.\r\n\t\t\t\t\t\t\t\t\t\t\tg_oTechTools.measurementMarqueeDraw,\t// The function to be called when the 'pointermove' event is called.\r\n\t\t\t\t\t\t\t\t\t\t\tg_oTechTools.measurementPointerUp,\t\t// The function to be called when the 'pointerup' event is called.\r\n\t\t\t\t\t\t\t\t\t\t\ttrue,\t\t\t\t\t\t\t\t\t// An optional condition to be met for the marquee to be drawn. Pass TRUE is the condition is not required.\r\n\t\t\t\t\t\t\t\t\t\t\ttrue,\t\t\t\t\t\t\t\t\t// An optional override to allow point selections as well as click and drag selections. Pass FALSE if the override is not required.\r\n\t\t\t\t\t\t\t\t\t\t\tnull,\t\t\t\t\t\t\t\t\t// An object to pass in line width and line colour if a box-style marquee is to be drawn instead of an overlay marquee. Pass NULL if an overlay marquee is required.\r\n\t\t\t\t\t\t\t\t\t\t\ttrue);\t\t\t\t\t\t\t\t\t// Indicate if the marquee should always be initiated without checking criteria.\r\n\t\t});\r\n\t});\r\n\r\n\t// Click event for the annotation text highlight and text classification.\r\n\t$(\"#TextHighlight, #TextClassification\").on(\"click\", function (e) {\r\n\r\n\t\t// Slide up the annotations drop down.\r\n\t\t$(\"#annotationDropDown\").slideUp(200);\r\n\r\n\t\t// Clear the last used annotation tool type.\r\n\t\tg_oAnnotations.g_oLastUsedTool = \"\";\r\n\r\n\t\t// Set the annotation type to be used.\r\n\t\tvar eAnnotationCreationType = e.target.id == \"TextClassification\" || e.target.parentElement.id == \"TextClassification\" ? eAnnotationTypes.TextClassification : eAnnotationTypes.TextHighlight;\r\n\r\n\t\t// Initialise the highlight once the data has been loaded.\r\n\t\tvar oCallbackAction = function () {\r\n\r\n\t\t\t// Set that this will be a new annotation.\r\n\t\t\tg_oTextTools.g_iExistingAnnotationId = null;\r\n\r\n\t\t\t// Set up the new annotation text.\r\n\t\t\tg_oTextTools.g_oAnnotationText = [];\r\n\r\n\t\t\t// Initialise the highlight.\r\n\t\t\tg_oTextTools.initialiseTextTool(g_oTextTools.g_eToolTypes.TextHighlight, eAnnotationCreationType, true, false, g_oAnnotations.g_oAnnotationColSelected);\r\n\t\t};\r\n\r\n\t\t// Load the text data for the file.\r\n\t\tg_oTextData.loadTextData(g_oViewer.g_oArtworkViewer.g_oDoc.documentId, g_oViewer.g_oArtworkViewer.g_iCurrentPage, true, oCallbackAction);\r\n\t});\r\n\r\n\t// Updates the measurement preference when an option is selected in the settings dropdown.\r\n\t$(\"#settings_MeasurementPreference\").on(\"change\", function (event) {\r\n\r\n\t\t// If the value is now different to our current measurement preference.\r\n\t\tif ($(\"#settings_MeasurementPreference\").val() !== g_oSettings.g_oUserSettings.UseMetricUnits) {\r\n\r\n\t\t\t// Prevent the next click from closing the settings menu.\r\n\t\t\tg_oSettings.g_bIgnoreNextClickEvent = true;\r\n\r\n\t\t\t// Toggle the units.\r\n\t\t\t$(\"#divTechToolsUnits\").click();\r\n\t\t}\r\n\t});\r\n\r\n\t// Updates the measurement preference when an option is selected in the settings dropdown.\r\n\t$(\"#setting_SkinType\").on(\"change\", function (event) {\r\n\t\t\r\n\t\t// Update the select skin type.\r\n\t\tg_oSettings.g_oUserSettings.SkinType = $(\"#setting_SkinType\").val();\r\n\r\n\t\t// Update the setting.\r\n\t\tg_oSettings.updateSettingSkinType(true);\r\n\t});\r\n\r\n\t// Updates the date format when an option is selected in the settings dropdown.\r\n\t$(\"#setting_DateFormat\").on(\"change\", function (event) {\r\n\r\n\t\t// Update the date format.\r\n\t\tg_oSettings.g_oUserSettings.DateFormat = $(\"#setting_DateFormat\").val();\r\n\r\n\t\t// Update the setting.\r\n\t\tg_oSettings.updateSettingDateFormat(true);\r\n\t});\r\n\r\n\t// Updates the measurement preference when an option is toggled.\r\n\t$(\"#divTechToolsUnits, #OffsetUnitsImg, #AlignmentUnitsImg_Viewer, #AlignmentUnitsImg_Compare, #GuidedUnitsImg_Compare\").on(\"click\", function (event) {\r\n\t\t\r\n\t\t// Outline the required variables.\r\n\t\tvar oCompareOffsetPixels = null;\r\n\t\tvar oAlignmentOffsetPixels_Viewer = null;\r\n\t\tvar oAlignmentOffsetPixels_Compare = null;\r\n\t\tvar oAlignmentOffsetPixels_Saved = null;\r\n\t\tvar oAlignmentGuidencePixels_Tolerance = null;\r\n\r\n\t\t// If the compare module has been loaded.\r\n\t\tif (typeof (g_oCompare.convertMeasurementToPixels) != \"undefined\") {\r\n\r\n\t\t\t// Extract each of the compare offset values as pixels.\r\n\t\t\toCompareOffsetPixels = g_oCompare.convertMeasurementToPixels($(\"#CompareOffsetX\").val(), $(\"#CompareOffsetY\").val(), g_oCompare.g_oArtworkViewer, false);\r\n\t\t\toAlignmentOffsetPixels_Viewer = g_oCompare.convertMeasurementToPixels($(\"#AlignmentX_Viewer\").val(), $(\"#AlignmentY_Viewer\").val(), g_oCompare.g_oArtworkViewer, false);\r\n\t\t\toAlignmentOffsetPixels_Compare = g_oCompare.convertMeasurementToPixels($(\"#AlignmentX_Compare\").val(), $(\"#AlignmentY_Compare\").val(), g_oCompare.g_oArtworkViewer, false);\r\n\t\t\toAlignmentOffsetPixels_Saved = g_oCompare.convertMeasurementToPixels(g_oCompare.g_oAlignment_SavedCompareOffsetX, g_oCompare.g_oAlignment_SavedCompareOffsetY, g_oCompare.g_oArtworkViewer, false);\r\n\t\t\toAlignmentGuidencePixels_Tolerance = g_oCompare.convertMeasurementToPixels($(\"#GuidedTolerance\").val(), $(\"#GuidedTolerance\").val(), g_oCompare.g_oArtworkViewer, false);\r\n\t\t}\r\n\r\n\t\t// Update the measurement unit.\r\n\t\tg_oSettings.g_oUserSettings.UseMetricUnits = !g_oSettings.g_oUserSettings.UseMetricUnits;\r\n\r\n\t\t// If the compare module has been loaded.\r\n\t\tif (typeof (g_oCompare.convertPixelsToMeasurement) != \"undefined\") {\r\n\r\n\t\t\t// Convert each of the compare offset values to the new measurement.\r\n\t\t\tvar oCompareOffsetMeasurement = g_oCompare.convertPixelsToMeasurement(oCompareOffsetPixels.x, oCompareOffsetPixels.y, g_oCompare.g_oArtworkViewer);\r\n\t\t\tvar oAlignmentOffsetMeasurement_Viewer = g_oCompare.convertPixelsToMeasurement(oAlignmentOffsetPixels_Viewer.x, oAlignmentOffsetPixels_Viewer.y, g_oCompare.g_oArtworkViewer);\r\n\t\t\tvar oAlignmentOffsetMeasurement_Compare = g_oCompare.convertPixelsToMeasurement(oAlignmentOffsetPixels_Compare.x, oAlignmentOffsetPixels_Compare.y, g_oCompare.g_oArtworkViewer);\r\n\t\t\tvar oAlignmentOffsetMeasurement_Saved = g_oCompare.convertPixelsToMeasurement(oAlignmentOffsetPixels_Saved.x, oAlignmentOffsetPixels_Saved.y, g_oCompare.g_oArtworkViewer);\r\n\t\t\tvar oAlignmentGuidenceMeasurement_Tolerance = g_oCompare.convertPixelsToMeasurement(oAlignmentGuidencePixels_Tolerance.x, oAlignmentGuidencePixels_Tolerance.y, g_oCompare.g_oArtworkViewer);\r\n\r\n\t\t\t// Set each of the compare offset values to be the new measurement.\r\n\t\t\t$(\"#CompareOffsetX\").val(oCompareOffsetMeasurement.x);\r\n\t\t\t$(\"#CompareOffsetY\").val(oCompareOffsetMeasurement.y);\r\n\t\t\t$(\"#AlignmentX_Viewer\").val(oAlignmentOffsetMeasurement_Viewer.x);\r\n\t\t\t$(\"#AlignmentY_Viewer\").val(oAlignmentOffsetMeasurement_Viewer.y);\r\n\t\t\t$(\"#AlignmentX_Compare\").val(oAlignmentOffsetMeasurement_Compare.x);\r\n\t\t\t$(\"#AlignmentY_Compare\").val(oAlignmentOffsetMeasurement_Compare.y);\r\n\t\t\tg_oCompare.g_oAlignment_SavedCompareOffsetX = oAlignmentOffsetMeasurement_Saved.x;\r\n\t\t\tg_oCompare.g_oAlignment_SavedCompareOffsetY = oAlignmentOffsetMeasurement_Saved.y;\r\n\t\t\t$(\"#GuidedTolerance\").val(oAlignmentGuidenceMeasurement_Tolerance.x);\r\n\t\t}\r\n\r\n\t\t// Update the setting.\r\n\t\tg_oSettings.updateSettingMeasurementPreference(true);\r\n\t});\r\n\r\n\t$(\"#divTechToolsClearCanvas\").on(\"click\", function (e) {\r\n\t\tg_oTechTools.clearToolType();\r\n\t\tg_oTechTools.g_oAnnotationViewer.redraw(false);\r\n\t\tif (g_oViewer.g_oCompareMode != eCompareMode.NoCompare) {\r\n\t\t\tg_oCompare.g_oCompareAnnotationViewer.redraw(false);\r\n\t\t\tif (g_oViewer.g_oCompareMode == eCompareMode.SideBySideDiff) {\r\n\t\t\t\tg_oCompare.g_oDifferencesAnnotationViewer.redraw(false);\r\n\t\t\t}\r\n\t\t}\r\n\t\t$(g_oSeparations.SpinnerElementName).hide();\r\n\t\t$(g_oTechTools.c_szSeparationPercentageElementName).hide();\r\n\t\t$(g_oTechTools.c_szSeparationPercentage_BarcodeElementName).hide();\r\n\t\t$(\"#td_TAC\").hide();\r\n\t});\r\n\r\n\t/************************** Compare ****************************/\r\n\r\n\t$(\"#OverlayToleranceSlider\").on(\"pointerup\", function (event) {\r\n\t\tg_oCompare.updateTolerance();\r\n\t});\r\n\r\n\t$(\"#OverlayGhostingSlider\").on(\"pointerup\", function (event) {\r\n\t\tg_oCompare.updateGhosting();\r\n\t});\r\n\r\n\t$(\"#BlinkSpeedSlider, #DiffSpeedSlider\").on(\"pointerup\", function (event) {\r\n\t\t// Get the slider value and assign.\r\n\t\tg_oCompare.updateBlinkSpeed(parseInt($(this).val()));\r\n\t});\r\n\r\n\t// Toggle the annotation canvas.\r\n\t$(\"#chkAnnotationToggle\").click(function () {\r\n\r\n\t\t// If we are currently finding SVG text.\r\n\t\tif (g_oViewer.c_bFindSVGText) {\r\n\r\n\t\t\t// Determine the canvas to used for rendering based on the annotation toggle.\r\n\t\t\tvar oAnnotationCanvas = g_oViewer.getCanvas(g_oCompare.getAnnotationCanvasId());\r\n\t\t\tvar oArtworkCanvas = g_oViewer.getLinkedArtworkCanvas(oAnnotationCanvas.g_szCanvasId);\r\n\r\n\t\t\t// Remove any existing hover annotations.\r\n\t\t\tg_oSVGText.removeSVGHoverAnnotations(oArtworkCanvas, oAnnotationCanvas, false);\r\n\r\n\t\t\t// Clear the SVG search.\r\n\t\t\tg_oSVGSearch.clearSVGSearch(oArtworkCanvas, oAnnotationCanvas, true);\r\n\t\t}\r\n\r\n\t\t// Close any active confirm bubbles as these may be related to annotation actions.\r\n\t\tg_oGreenlightMessages.closeBubbles(\"Confirm\");\r\n\r\n\t\t// Toggle the annotation document.\r\n\t\tg_oCompare.toggleAnnotationDocument();\r\n\r\n\t\t// Reset the canvas function.\r\n\t\tchangeCanvasFunction();\r\n\t});\r\n\r\n\t// Toggle the overprint preview.\r\n\t$(\"#chkOverprintToggle\").click(function () {\r\n\r\n\t\t// Toggle the overprint preview setting.\r\n\t\tg_oSeparations.ToggleOverprintPreview();\r\n\r\n\t\t// Get the image PNG data for the canvas.\r\n\t\tg_oViewer.g_oArtworkViewer.getimagePNGData(true, false);\r\n\t});\r\n\r\n\t// Update the colour of the overprint preview.\r\n\t$(\"#clrSelectOverprintColour, #setting_OverprintColour\").on(\"change\", function (event) {\r\n\t\t\r\n\t\t// Update the value of the users overprint colour.\r\n\t\tg_oSettings.g_oUserSettings.OverprintColour = event.target.id === \"setting_OverprintColour\" ? $(\"#setting_OverprintColour\").val() : $(\"#clrSelectOverprintColour\").val();\r\n\r\n\t\t// Update the settings.\r\n\t\tg_oSettings.updateSettingOverprintColour(true);\r\n\r\n\t\t// Get the image PNG data for the canvas.\r\n\t\tg_oViewer.g_oArtworkViewer.getimagePNGData(true, false);\r\n\t});\r\n\r\n\t// Activates the offset alignment mode.\r\n\t$(\"#OffsetAlignmentImg\").on(\"click\", function () {\r\n\t\tg_oCompare.setupCanvasForAlignment();\r\n\t});\r\n\r\n\t// Requests an automatic alignment\r\n\t$(\"#AutomaticAlignmentImg\").on(\"click\", function () {\r\n\t\tg_oCompare.g_oAutomaticAlignmentRequest = g_oCompare.GetCompareDocumentDetails();\r\n\t\tg_oCompare.activateCompare(g_oViewer.g_oCompareMode, g_oCompare.g_oCompareDocument, g_oCompare.g_oComparePage);\r\n\t});\r\n\r\n\t// Update the alignment tolerance.\r\n\t$(\"#GuidedTolerance\").on(\"change\", function () {\r\n\t\tg_oCompare.updateGuidedTolerance();\r\n\t});\r\n\r\n\t// Perform the manual alignment.\r\n\t$(\"#btnAlignment_Manual\").click(function () {\r\n\t\tg_oCompare.performManualAlignment();\r\n\t});\r\n\r\n\t// Perform the guided alignment.\r\n\t$(\"#btnAlignment_Guided\").click(function () {\r\n\t\tg_oCompare.performGuidedAlignment();\r\n\t});\r\n\r\n\t// Toggle the tolerance menu.\r\n\t$(\"#imgToleranceMenu\").click(function (e) {\r\n\t\te.preventDefault();\r\n\t\te.stopPropagation();\r\n\t\tg_oCompare.hideAlignmentInformation();\r\n\t\tg_oCompare.toggleToleranceMenu();\r\n\t});\r\n\r\n\t$(\"#OffsetCompareRotation, #OffsetCompareRotationAnti, #CompareRotation_Compare, #CompareRotation_Compare_Anti\").on(\"click\", function () {\r\n\t\t// Determine direction.\r\n\t\tvar bClockwise = (this.id === \"OffsetCompareRotation\" || this.id === \"CompareRotation_Compare\");\r\n\r\n\t\t// Rotate Compare Document.\r\n\t\tg_oCompare.updateCompareRotation(bClockwise);\r\n\r\n\t\t// Set the rotation of the compare rotation icons.\r\n\t\t$(\"#OffsetCompareRotation, #OffsetCompareRotationAnti, #CompareRotation_Compare, #CompareRotation_Compare_Anti\")\r\n\t\t\t.css(\"transform\", \"rotate(\" + g_oCompare.g_iCompareRotationDegrees + \"deg)\");\r\n\t});\r\n\r\n\t$(\"#CompareOffsetX\").on(\"change\", function (event) {\r\n\t\t\r\n\t\t// Validate the compare offset values.\r\n\t\tvar oValidatedPosition = g_oCompare.validateComparePositions($(\"#CompareOffsetX\").val(), $(\"#CompareOffsetY\").val(), \"AnnotationViewer\", true);\r\n\r\n\t\t// Set the compare offset values.\r\n\t\t$(\"#CompareOffsetX\").val(oValidatedPosition.xPos);\r\n\t\t$(\"#CompareOffsetY\").val(oValidatedPosition.yPos);\r\n\r\n\t\t// Update the compare flags.\r\n\t\tg_oCompare.g_bManualAlignmentSet = true;\r\n\t\tg_oCompare.g_oAutomaticAlignmentRequest = null;\r\n\r\n\t\t// Update the compare offset.\r\n\t\tg_oCompare.updateCompareOffset(true);\r\n\t});\r\n\r\n\t$(\"#CompareOffsetY\").on(\"change\", function (event) {\r\n\t\t\r\n\t\t// Validate the compare offset values.\r\n\t\tvar oValidatedPosition = g_oCompare.validateComparePositions($(\"#CompareOffsetX\").val(), $(\"#CompareOffsetY\").val(), \"AnnotationViewer\", true);\r\n\r\n\t\t// Set the compare offset values.\r\n\t\t$(\"#CompareOffsetX\").val(oValidatedPosition.xPos);\r\n\t\t$(\"#CompareOffsetY\").val(oValidatedPosition.yPos);\r\n\r\n\t\t// Update the compare flags.\r\n\t\tg_oCompare.g_bManualAlignmentSet = true;\r\n\t\tg_oCompare.g_oAutomaticAlignmentRequest = null;\r\n\r\n\t\t// Update the compare offset.\r\n\t\tg_oCompare.updateCompareOffset(true);\r\n\t});\r\n\r\n\t$(\"#btnAlignmentMarker_Viewer\").click(function () {\r\n\r\n\t\t// Set this as the last selected alignment tool.\r\n\t\tg_oCompare.g_szLastAlignmentTool = \"btnAlignmentMarker_Viewer\";\r\n\r\n\t\t// Setup the icon.\r\n\t\t$(\"#tblNavTools .selectedButton\").removeClass(\"selectedButton\");\r\n\t\t$(\"#tblViewerAlignmentTools .selectedButton\").removeClass(\"selectedButton\");\r\n\t\t$(\"#tblCompareAlignmentTools .selectedButton\").removeClass(\"selectedButton\");\r\n\t\thighlightSelectedButton($(\"#btnAlignmentMarker_Viewer\"), false);\r\n\t\thighlightSelectedButton($(\"#btnAlignmentMarker_Compare\"), false);\r\n\r\n\t\t// Setup the marker placement.\r\n\t\tg_oCompare.markerPlacement();\r\n\t\t\r\n\t\t// Update the cursor for each canvas.\r\n\t\t$(\"#AnnotationViewer\").css('cursor', 'crosshair');\r\n\t\tg_oAnnotations.g_szPrevCursorStyle = \"crosshair\";\r\n\t\t$(\"#CompareAnnotationViewer\").css('cursor', 'crosshair');\r\n\t\t$(\"#DifferencesAnnotationViewer\").css('cursor', 'default');\r\n\t});\r\n\r\n\t$(\"#btnAlignmentMarker_Compare\").click(function () {\r\n\r\n\t\t// Set this as the last selected alignment tool.\r\n\t\tg_oCompare.g_szLastAlignmentTool = \"btnAlignmentMarker_Compare\";\r\n\r\n\t\t// Setup the icon.\r\n\t\t$(\"#tblNavTools .selectedButton\").removeClass(\"selectedButton\");\r\n\t\t$(\"#tblViewerAlignmentTools .selectedButton\").removeClass(\"selectedButton\");\r\n\t\t$(\"#tblCompareAlignmentTools .selectedButton\").removeClass(\"selectedButton\");\r\n\t\thighlightSelectedButton($(\"#btnAlignmentMarker_Viewer\"), false);\r\n\t\thighlightSelectedButton($(\"#btnAlignmentMarker_Compare\"), false);\r\n\r\n\t\t// Setup the marker placement.\r\n\t\tg_oCompare.markerPlacement();\r\n\t\t\r\n\t\t// Update the cursor for each canvas.\r\n\t\t$(\"#AnnotationViewer\").css('cursor', 'crosshair');\r\n\t\tg_oAnnotations.g_szPrevCursorStyle = \"crosshair\";\r\n\t\t$(\"#CompareAnnotationViewer\").css('cursor', 'crosshair');\r\n\t\t$(\"#DifferencesAnnotationViewer\").css('cursor', 'default');\r\n\t});\r\n\r\n\t$(\"#btnAlignmentKeys_Viewer\").click(function () {\r\n\r\n\t\t// Set this as the last selected alignment tool.\r\n\t\tg_oCompare.g_szLastAlignmentTool = \"btnAlignmentKeys_Viewer\";\r\n\r\n\t\t// Setup the icon.\r\n\t\t$(\"#tblNavTools .selectedButton\").removeClass(\"selectedButton\");\r\n\t\t$(\"#tblViewerAlignmentTools .selectedButton\").removeClass(\"selectedButton\");\r\n\t\t$(\"#tblCompareAlignmentTools .selectedButton\").removeClass(\"selectedButton\");\r\n\t\thighlightSelectedButton($(\"#btnAlignmentKeys_Viewer\"), false);\r\n\r\n\t\t// Setup the marker fine tune.\r\n\t\tg_oCompare.markerFineTune(g_oCompare.g_oAnnotationViewer.g_szCanvasId);\r\n\r\n\t\t// Update the cursor for each canvas.\r\n\t\t$(\"#AnnotationViewer\").css('cursor', 'default');\r\n\t\tg_oAnnotations.g_szPrevCursorStyle = \"default\";\r\n\t\t$(\"#CompareAnnotationViewer\").css('cursor', 'default');\r\n\t\t$(\"#DifferencesAnnotationViewer\").css('cursor', 'default');\r\n\t});\r\n\r\n\t$(\"#btnAlignmentKeys_Compare\").click(function () {\r\n\r\n\t\t// Set this as the last selected alignment tool.\r\n\t\tg_oCompare.g_szLastAlignmentTool = \"btnAlignmentKeys_Compare\";\r\n\r\n\t\t// Setup the icon.\r\n\t\t$(\"#tblNavTools .selectedButton\").removeClass(\"selectedButton\");\r\n\t\t$(\"#tblViewerAlignmentTools .selectedButton\").removeClass(\"selectedButton\");\r\n\t\t$(\"#tblCompareAlignmentTools .selectedButton\").removeClass(\"selectedButton\");\r\n\t\thighlightSelectedButton($(\"#btnAlignmentKeys_Compare\"), false);\r\n\r\n\t\t// Setup the marker fine tune.\r\n\t\tg_oCompare.markerFineTune(g_oCompare.g_oCompareAnnotationViewer.g_szCanvasId);\r\n\r\n\t\t// Update the cursor for each canvas.\r\n\t\t$(\"#AnnotationViewer\").css('cursor', 'default');\r\n\t\tg_oAnnotations.g_szPrevCursorStyle = \"default\";\r\n\t\t$(\"#CompareAnnotationViewer\").css('cursor', 'default');\r\n\t\t$(\"#DifferencesAnnotationViewer\").css('cursor', 'default');\r\n\t});\r\n\r\n\t$(\"#AlignmentX_Viewer\").on(\"change\", function (event) {\r\n\t\tg_oCompare.updateMarkerAlignment($(\"#AlignmentX_Viewer\").val(), $(\"#AlignmentY_Viewer\").val(), \"AnnotationViewer\");\r\n\t});\r\n\r\n\t$(\"#AlignmentY_Viewer\").on(\"change\", function (event) {\r\n\t\tg_oCompare.updateMarkerAlignment($(\"#AlignmentX_Viewer\").val(), $(\"#AlignmentY_Viewer\").val(), \"AnnotationViewer\");\r\n\t});\r\n\r\n\t$(\"#AlignmentX_Compare\").on(\"change\", function (event) {\r\n\t\tg_oCompare.updateMarkerAlignment($(\"#AlignmentX_Compare\").val(), $(\"#AlignmentY_Compare\").val(), \"CompareAnnotationViewer\");\r\n\t});\r\n\r\n\t$(\"#AlignmentY_Compare\").on(\"change\", function (event) {\r\n\t\tg_oCompare.updateMarkerAlignment($(\"#AlignmentX_Compare\").val(), $(\"#AlignmentY_Compare\").val(), \"CompareAnnotationViewer\");\r\n\t});\r\n\r\n\t// Confirms the alignment.\r\n\t$(\"#btnAlignmentConfirm_Differences\").click(function () {\r\n\t\tg_oCompare.hideAlignmentInformation();\r\n\t\tg_oCompare.confirmMarkerPositions();\r\n\t});\r\n\r\n\t// Cancels the alignment.\r\n\t$(\"#btnAlignmentCancel_Differences\").click(function () {\r\n\t\tg_oCompare.hideAlignmentInformation();\r\n\t\tg_oCompare.cancelMarkerPositions();\r\n\t});\r\n\r\n\t// Resets the offset alignment mode.\r\n\t$(\"#btnAlignmentReset_Differences\").on(\"click\", function () {\r\n\t\tg_oCompare.hideAlignmentInformation();\r\n\t\tg_oCompare.resetAlignmentMode();\r\n\t});\r\n\r\n\t// Toggle the alignment information.\r\n\t$(\"#btnAlignmentInfo_Differences\").on(\"click\", function () {\r\n\t\tg_oCompare.toggleAlignmentInformation();\r\n\t});\r\n\r\n\t// Activates the text compare mode.\r\n\t$(\"#TextCompare\").on(\"click\", function () {\r\n\t\tg_oCompare.setupCanvasForTextCompare();\r\n\t});\r\n\r\n\t// Exits the text compare mode.\r\n\t$(\"#btnExitCompare_Common_TextCompare\").on(\"click\", function () {\r\n\r\n\t\t// If the review screen is open, close this.\r\n\t\tif (g_oTextCompare.g_bTextCompareDivShown) {\r\n\t\t\tg_oTextCompare.toggleTextCompareDiv();\r\n\t\t}\r\n\r\n\t\t// Reset the differences.\r\n\t\tg_oTextCompare.resetDifferences();\r\n\r\n\t\t// Reset the hidden separations.\r\n\t\tg_oTextCompare.resetTextCompareHiddenSeparations();\r\n\r\n\t\t// Store the active text selection groups.\r\n\t\tg_oTextCompare.storeActiveTextSelectionGroups();\r\n\r\n\t\t// Hide the text compare information.\r\n\t\tg_oTextCompare.hideTextCompareInformation();\r\n\r\n\t\t// Hide the separations.\r\n\t\tg_oTextCompare.hideTextCompareSeparations();\r\n\r\n\t\t// Hide the text compare div.\r\n\t\tg_oTextCompare.hideTextCompareDiv();\r\n\r\n\t\t// Exit text compare mode.\r\n\t\tg_oCompare.exitTextCompareMode();\r\n\t});\r\n\r\n\t// Reviews the text compare.\r\n\t$(\"#btnReviewCompare_Common_TextCompare\").on(\"click\", function () {\r\n\r\n\t\t// Hide the text compare information slide out.\r\n\t\tg_oTextCompare.hideTextCompareInformation();\r\n\r\n\t\t// Hide the separations.\r\n\t\tg_oTextCompare.hideTextCompareSeparations();\r\n\r\n\t\t// If we do not have the text compare div show and we are not changing back from a text comparison, show this.\r\n\t\tif (!g_oTextCompare.g_bTextCompareDivShown && !g_oTextCompare.g_bDifferencesCalculated) {\r\n\t\t\tg_oTextCompare.toggleTextCompareDiv();\r\n\t\t}\r\n\r\n\t\t// Reset the differences.\r\n\t\tg_oTextCompare.resetDifferences();\r\n\t});\r\n\t\r\n\t// Calculates the text compare.\r\n\t$(\"#btnCompareText_Common_TextCompare\").on(\"click\", function () {\r\n\r\n\t\t// Hide the text compare information slide out.\r\n\t\tg_oTextCompare.hideTextCompareInformation();\r\n\r\n\t\t// Hide the separations.\r\n\t\tg_oTextCompare.hideTextCompareSeparations();\r\n\r\n\t\t// If we do not have the text compare div show, show this.\r\n\t\tif (!g_oTextCompare.g_bTextCompareDivShown) {\r\n\t\t\tg_oTextCompare.toggleTextCompareDiv();\r\n\t\t}\r\n\r\n\t\t// Calulcate the differences.\r\n\t\tg_oTextCompare.calculateDifferences();\r\n\t});\r\n\r\n\t// Toggles the text compare div.\r\n\t$(\"#divTextCompareButton\").on(\"click\", function () {\r\n\t\tg_oTextCompare.hideTextCompareInformation();\r\n\t\tg_oTextCompare.hideTextCompareSeparations();\r\n\t\tg_oTextCompare.toggleTextCompareDiv();\r\n\t});\r\n\r\n\t// Toggle the text compare auto selection.\r\n\t$(\"#btnAuto_Select_Toggle_TextCompare\").on(\"click\", function () {\r\n\r\n\t\t// Ensure the setting is not locked.\r\n\t\tif (g_oSettings.g_oConsumerSettings.LockTextComparisonAutoSelection) {\r\n\t\t\tg_oGreenlightMessages.displayWarningBubble(g_oTextCompare_AutoSelection.c_szSettingLocked);\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\t// Update the text comparison whitespace detection.\r\n\t\tg_oSettings.g_oUserSettings.TextComparisonAutoSelection = $(\"#setting_TextComparisonAutoSelection\").val() == '2' ? '1' : '2'; // Off = 1, On = 2\r\n\r\n\t\t// Set the auto selection toggle button icon.\r\n\t\t$(\"#btnAuto_Select_Toggle_TextCompare\")\r\n\t\t\t.attr(\"src\", g_oSettings.g_oUserSettings.TextComparisonAutoSelection == '2' ? \"img/MagicWand_24_Blue.png\" : \"img/MagicWand_24_Grey.png\")\r\n\t\t\t.tooltipster('content', g_oSettings.g_oUserSettings.TextComparisonAutoSelection == '2' ? g_oTextCompare_AutoSelection.c_szAutoSelectionDisabled : g_oTextCompare_AutoSelection.c_szAutoSelectionEnabled);\r\n\r\n\t\t// Update the setting.\r\n\t\tg_oSettings.updateSettingTextComparisonAutoSelection(true);\r\n\r\n\t\t// If we are not actively in a text comaprison, update the text comparison whitespace detection.\r\n\t\tif (!g_oTextCompare.g_bDifferencesCalculated) {\r\n\t\t\t$(\"#divTextComparisonAutoSelection\").val(g_oSettings.g_oUserSettings.TextComparisonAutoSelection);\r\n\t\t}\r\n\t});\r\n\r\n\t// Update the text comparison fuzzy threshold.\r\n\t$(\"#setting_TextComparisonAutoSelection_FuzzyThreshold\").on(\"change\", function () {\r\n\t\tvar value = parseInt($(this).val(), 10);\r\n\r\n\t\t// Ensure the value is between 0 and 100\r\n\t\tif (isNaN(value) || value < 0) {\r\n\t\t\tvalue = 0;\r\n\t\t} else if (value > 100) {\r\n\t\t\tvalue = 100;\r\n\t\t}\r\n\r\n\t\t$(this).val(value);\r\n\r\n\t\t// Update the fuzzy threshold setting\r\n\t\tg_oSettings.g_oUserSettings.TextComparisonAutoSelectionFuzzyThreshold = value;\r\n\r\n\t\t// Optionally, you can call a function to update the setting in your application\r\n\t\tg_oSettings.updateSettingTextComparisonFuzzyThreshold(true);\r\n\t});\r\n\r\n\t// Toggle the text compare information.\r\n\t$(\"#btnInfo_Common_TextCompare\").on(\"click\", function () {\r\n\r\n\t\t// If we have the text compare div show, hide this.\r\n\t\tif (g_oTextCompare.g_bTextCompareDivShown) {\r\n\t\t\tg_oTextCompare.toggleTextCompareDiv();\r\n\t\t}\r\n\r\n\t\t// Toggle the compare information.\r\n\t\tg_oTextCompare.toggleTextCompareInformation();\r\n\t});\r\n\r\n\t// Start auto-auto matching process.\r\n\t$(\"#btnFullDocumentSelection_Common_TextCompare\").on(\"click\", function () {\r\n\r\n\t\t// If we have the text compare div show, hide this.\r\n\t\tif (g_oTextCompare.g_bTextCompareDivShown) {\r\n\t\t\tg_oTextCompare.toggleTextCompareDiv();\r\n\t\t}\r\n\r\n\t\tg_oTextCompare.toggleTextCompareFullDocumentSelectionOptions();\r\n\t});\r\n\r\n\t// Toggle the text compare separations.\r\n\t$(\"#btnSeparations_Common_TextCompare\").on(\"click\", function () {\r\n\r\n\t\t// If we have the text compare div show, hide this.\r\n\t\tif (g_oTextCompare.g_bTextCompareDivShown) {\r\n\t\t\tg_oTextCompare.toggleTextCompareDiv();\r\n\t\t}\r\n\r\n\t\t// Toggle the separations.\r\n\t\tg_oTextCompare.toggleTextCompareSeparations();\r\n\t});\r\n\r\n\t// Change the text compare highlight colour.\r\n\t$(\"#btnColour_Common_TextCompare\").on(\"click\", function () {\r\n\r\n\t\t// If we have the text compare div show, hide this.\r\n\t\tif (g_oTextCompare.g_bTextCompareDivShown) {\r\n\t\t\tg_oTextCompare.toggleTextCompareDiv();\r\n\t\t}\r\n\r\n\t\t// Toggle the separations.\r\n\t\tg_oTextCompare.toggleTextCompareHighlightColour();\r\n\t});\r\n\r\n\t/**\r\n\t * Window Events.\r\n\t*/\r\n\r\n\t// Keyboard shortcuts - KeyUp event\r\n\t$(window).keyup(function (event) {\r\n\r\n\t\t// Get the code of the key used for the key down.\r\n\t\tvar iKeycode = event.keyCode || event.which;\r\n\r\n\t\t// Used to determine if we should proceed with the action.\r\n\t\tvar bPerformKeyboardShortcut = true;\r\n\r\n\t\t// Used for highlighting button\r\n\t\tvar thisParent = null;\r\n\r\n\t\t// Store the action we are performing\r\n\t\tvar iKeyboardShortcutBehaviour = null;\r\n\r\n\t\t// If the key is in the array of keys pressed (Currently only added when it is a valid shortcut)\r\n\t\tif (iaKeysPressed.indexOf(iKeycode) !== -1) {\r\n\r\n\t\t\t// Remove from array\r\n\t\t\tiaKeysPressed.splice(iaKeysPressed.indexOf(iKeycode), 1);\r\n\r\n\t\t\t// Check the key we have released.\r\n\t\t\tswitch (iKeycode) {\r\n\r\n\t\t\t\t// 32 Space\r\n\t\t\t\tcase 32:\r\n\r\n\t\t\t\t\t// If we are in text compare mode.\r\n\t\t\t\t\tif (g_oTextCompare.g_bTextCompareInProgress) {\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\t// We have used the pan text compare tool.\r\n\t\t\t\t\t\tthisParent = $(\"#btnPan_Viewer_TextCompare\");\r\n\t\t\t\t\t\tiKeyboardShortcutBehaviour = eKeyboardShorcutBehaviours.PanTextCompare;\r\n\t\t\t\t\t}\r\n\t\t\t\t\t// If we are not in text compare mode.\r\n\t\t\t\t\telse {\r\n\r\n\t\t\t\t\t\t// We have used the pan tool.\r\n\t\t\t\t\t\tthisParent = $(\"#btnPan\").parent();\r\n\t\t\t\t\t\tiKeyboardShortcutBehaviour = eKeyboardShorcutBehaviours.Pan;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tbreak;\r\n\r\n\t\t\t\t// Default.\r\n\t\t\t\tdefault:\r\n\t\t\t\t\tbPerformKeyboardShortcut = false;\r\n\t\t\t\t\tbreak;\r\n\t\t\t}\r\n\r\n\t\t\t// If the current active element is defined as being of type 'input' or is set as 'contentEditable' do not perform any actions\r\n\t\t\tif (document.activeElement.contentEditable.toLowerCase() === \"true\" || document.activeElement.nodeName.toLowerCase() === \"input\") {\r\n\t\t\t\tbPerformKeyboardShortcut = false;\r\n\t\t\t}\r\n\r\n\t\t\t// Determine the tool we have used.\r\n\t\t\tif (bPerformKeyboardShortcut) {\r\n\t\t\t\tswitch (iKeyboardShortcutBehaviour) {\r\n\r\n\t\t\t\t\t// If we have used the pan tool.\r\n\t\t\t\t\tcase eKeyboardShorcutBehaviours.Pan:\r\n\r\n\t\t\t\t\t\t// Clear any exiting highlight.\r\n\t\t\t\t\t\tclearHighlightSelectedButton(thisParent);\r\n\r\n\t\t\t\t\t\t// Get the canvas.\r\n\t\t\t\t\t\tvar oaCanvasObjects = g_oViewer.getArtworkCanvas();\r\n\t\t\t\t\t\tfor (var i = 0; i < oaCanvasObjects.length; i++) {\r\n\t\t\t\t\t\t\t// Unbind the click, pointer up and pointer down events, stop the drag action.\r\n\t\t\t\t\t\t\tchangeCanvasFunction($(\"#\" + oaCanvasObjects[i].g_oAnnotationCanvas.g_szCanvasId));\r\n\t\t\t\t\t\t\tif (oaCanvasObjects[i].g_oDoc !== null) {\r\n\t\t\t\t\t\t\t\t// 3D canvases do not have the drag discontinue method.\r\n\t\t\t\t\t\t\t\tif (oaCanvasObjects[i] instanceof Canvas) {\r\n\t\t\t\t\t\t\t\t\toaCanvasObjects[i].dragDiscontinue(false, []);\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t// If the last used tool was a marquee, re-activate this.\r\n\t\t\t\t\t\tif (bIsMarqueeZoomLastTool) {\r\n\r\n\t\t\t\t\t\t\t// Click the Marquee zoom button, and set the selected class.\r\n\t\t\t\t\t\t\t$('#btnZoomMarquee').parent().addClass('selectedButton');\r\n\t\t\t\t\t\t\t$('#btnZoomMarquee').click();\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\t// Otherwise default back to the pan tool.\r\n\t\t\t\t\t\telse {\r\n\r\n\t\t\t\t\t\t\t// Click the Pan button, and set the selected class.\r\n\t\t\t\t\t\t\t$('#btnPan').parent().addClass('selectedButton');\r\n\t\t\t\t\t\t\t$('#btnPan').click();\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tbreak;\r\n\r\n\t\t\t\t\t// If we have used the pan individual tool.\r\n\t\t\t\t\tcase eKeyboardShorcutBehaviours.PanTextCompare:\r\n\r\n\t\t\t\t\t\t// End the pan on the canvas to stop any existing dragging.\r\n\t\t\t\t\t\tg_oViewer.g_oArtworkViewer.dragDiscontinue(false, g_oCompare.getSyncCanvas(g_oViewer.g_oArtworkViewer));\r\n\r\n\t\t\t\t\t\t// Re-activate any text compare tool.\r\n\t\t\t\t\t\tg_oTextCompare.setActiveTextSelectionTool();\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t});\r\n\r\n\t// Keyboard shortcuts - KeyDown event\r\n\t$(window).keydown(function (event) {\r\n\r\n\t\t// Get the code of the key used for the key down.\r\n\t\tvar iKeycode = event.keyCode || event.which;\r\n\t\t// Used to determine if we should proceed with the action.\r\n\t\tvar bPerformKeyboardShortcut = true;\r\n\t\t// Used for highlighting button\r\n\t\tvar thisParent = null;\r\n\t\t// Store the action we are performing\r\n\t\tvar iKeyboardShortcutBehaviour = null;\r\n\r\n\t\t// CTRL(Windows) or CMD(Mac) is pressed.\r\n\t\tif (event.ctrlKey || event.metaKey) {\r\n\t\t\tswitch (iKeycode) {\r\n\t\t\t\tcase 61:\t// 61\tPlusEqual key: +/=\r\n\t\t\t\tcase 107:\t// 107\tNumPad Key:\t+\r\n\t\t\t\tcase 187:\t// 187 Equals key: = (Some browsers/keyboards seem to pick up this = instead of the above += of code 61)\r\n\t\t\t\t\tthisParent = $(\"#btnZoomIn\").parent();\r\n\t\t\t\t\tiKeyboardShortcutBehaviour = eKeyboardShorcutBehaviours.ZoomIn;\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase 109:\t// 109\tNumPad Key:\t-\r\n\t\t\t\tcase 173:\t// 173\tMinus/Underscore: _/-\r\n\t\t\t\tcase 189:\t// 189\tMinus: - (Some browsers/keyboards seem to pick up this instead of the above code 173)\r\n\t\t\t\t\tthisParent = $(\"#btnZoomOut\").parent();\r\n\t\t\t\t\tiKeyboardShortcutBehaviour = eKeyboardShorcutBehaviours.ZoomOut;\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase 48:\t// 48\tZero/Bracket: )/0\r\n\t\t\t\tcase 96:\t// 96\tNumPad Key:\t0\r\n\t\t\t\t\tthisParent = $(\"#btnZoomReset\").parent();\r\n\t\t\t\t\tiKeyboardShortcutBehaviour = eKeyboardShorcutBehaviours.ZoomReset;\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tdefault:\r\n\t\t\t\t\tbPerformKeyboardShortcut = false;\r\n\t\t\t\t\tbreak;\r\n\t\t\t}\r\n\r\n\t\t\t// If we are currently dragging, do not perform any zoom.\r\n\t\t\tif (g_oViewer.g_oArtworkViewer.g_bIsDragging) {\r\n\t\t\t\tbPerformKeyboardShortcut = false;\r\n\t\t\t}\r\n\t\t}\r\n\t\telse {\r\n\r\n\t\t\t// Determine the key code that has been pressed.\r\n\t\t\tswitch (iKeycode) {\r\n\r\n\t\t\t\t// 32 Space.\r\n\t\t\t\tcase 32:\r\n\r\n\t\t\t\t\t// If we are in text compare mode.\r\n\t\t\t\t\tif (g_oTextCompare.g_bTextCompareInProgress) {\r\n\r\n\t\t\t\t\t\t// Store the current text compare tool if required.\r\n\t\t\t\t\t\tif (g_oTextTools.g_bHighlightInProgress) {\r\n\t\t\t\t\t\t\tg_oTextCompare.storeActiveTextSelectionTool();\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t// Set that we have used the pan text compare shortcut.\r\n\t\t\t\t\t\tiKeyboardShortcutBehaviour = eKeyboardShorcutBehaviours.PanTextCompare;\r\n\t\t\t\t\t}\r\n\t\t\t\t\telse {\r\n\r\n\t\t\t\t\t\t// Set that we have used the pan shortcut.\r\n\t\t\t\t\t\tthisParent = $(\"#btnPan\").parent();\r\n\t\t\t\t\t\tiKeyboardShortcutBehaviour = eKeyboardShorcutBehaviours.Pan;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tbreak;\r\n\r\n\t\t\t\t// Default.\r\n\t\t\t\tdefault:\r\n\t\t\t\t\tbPerformKeyboardShortcut = false;\r\n\t\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t// If the current active element is defined as being of type 'input' or is set as 'contentEditable'.\r\n\t\tif (document.activeElement.contentEditable.toLowerCase() === \"true\" || document.activeElement.nodeName.toLowerCase() === \"input\") {\r\n\r\n\t\t\t// Check this is not one of the toolbar images as these fall under the input node name.\r\n\t\t\tif (!document.activeElement.classList.contains(\"ToolbarImage\")) {\r\n\r\n\t\t\t\t// Do not perform any actions.\r\n\t\t\t\tbPerformKeyboardShortcut = false;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t// Make sure we are performing the action and that it isn't a repeat of a 'keydown' event\r\n\t\tif (bPerformKeyboardShortcut && (iaKeysPressed.indexOf(iKeycode) === -1)) {\r\n\r\n\t\t\t// If we have a button to highlight.\r\n\t\t\tif (thisParent !== null) {\r\n\r\n\t\t\t\t// Pan performs different highlight functionality.\r\n\t\t\t\tif (iKeyboardShortcutBehaviour !== eKeyboardShorcutBehaviours.Pan && iKeyboardShortcutBehaviour !== eKeyboardShorcutBehaviours.PanTextCompare) {\r\n\t\t\t\t\thighlightSelectedButton(thisParent, false);\r\n\t\t\t\t\tsetTimeout(function () { clearHighlightSelectedButton(thisParent); }, 500);\r\n\t\t\t\t}\r\n\t\t\t\telse {\r\n\t\t\t\t\t// Before removing all classes, check to see if the Zoom Marquee tool was the last tool to be used.\r\n\t\t\t\t\tbIsMarqueeZoomLastTool = $('#btnZoomMarquee').parent().prop('className') == \"selectedButton\";\r\n\t\t\t\t\t$(\"#tblNavTools .selectedButton\").removeClass(\"selectedButton\");\r\n\t\t\t\t\t$(\"#tblViewerNavTools .selectedButton\").removeClass(\"selectedButton\");\r\n\t\t\t\t\t$(\"#tblCompareNavTools .selectedButton\").removeClass(\"selectedButton\");\r\n\t\t\t\t\thighlightButtonClearingAllIcons(thisParent, true);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\t// Perform the action\r\n\t\t\tswitch (iKeyboardShortcutBehaviour) {\r\n\t\t\t\tcase eKeyboardShorcutBehaviours.ZoomIn:\r\n\t\t\t\t\tg_oViewer.zoomIn(g_oCompare.getSyncCanvas(g_oViewer.g_oArtworkViewer));\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase eKeyboardShorcutBehaviours.ZoomOut:\r\n\t\t\t\t\tg_oViewer.zoomOut(g_oCompare.getSyncCanvas(g_oViewer.g_oArtworkViewer));\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase eKeyboardShorcutBehaviours.ZoomReset:\r\n\t\t\t\t\tg_oViewer.zoomReset(g_oCompare.getSyncCanvas(g_oViewer.g_oArtworkViewer));\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase eKeyboardShorcutBehaviours.Pan:\r\n\r\n\t\t\t\t\t// Ensure that an annotation save action doesn't overwrite this function's event handlers.\r\n\t\t\t\t\tg_oAnnotations.currentTimeoutListClear();\r\n\r\n\t\t\t\t\t// Pan and sync the canvas.\r\n\t\t\t\t\tg_oViewer.pan(g_oCompare.getSyncCanvas(g_oViewer.g_oArtworkViewer));\r\n\t\t\t\t\tg_oCompare.pan(g_oCompare.getSyncCanvas(g_oCompare.g_oCompareViewer));\r\n\r\n\t\t\t\t\t// Add to array to prevent multiple 'keydown' events without a 'keyup' event\r\n\t\t\t\t\tiaKeysPressed.push(iKeycode);\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase eKeyboardShorcutBehaviours.PanTextCompare:\r\n\r\n\t\t\t\t\t// Ensure that an annotation save action doesn't overwrite this function's event handlers.\r\n\t\t\t\t\tg_oAnnotations.currentTimeoutListClear();\r\n\r\n\t\t\t\t\t// Pan and dont sync the canvas.\r\n\t\t\t\t\t$(\"#btnPan_Viewer_TextCompare\").click();\r\n\r\n\t\t\t\t\t// Add to array to prevent multiple 'keydown' events without a 'keyup' event.\r\n\t\t\t\t\tiaKeysPressed.push(iKeycode);\r\n\t\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t// Disables browser shortcuts, unless the space bar is pressed then allow for the original functionality to proceed.\r\n\t\tif (iKeyboardShortcutBehaviour != null && iKeyboardShortcutBehaviour > 0 &&\r\n\t\t\tiKeyboardShortcutBehaviour != eKeyboardShorcutBehaviours.Pan &&\r\n\t\t\tiKeyboardShortcutBehaviour != eKeyboardShorcutBehaviours.PanTextCompare) {\r\n\t\t\treturn false;\r\n\t\t}\r\n\r\n\t\t// If we are in a jqte text editor with disabled shortcuts.\r\n\t\tif (document.activeElement.className.indexOf(\"jqte_editor\") != -1 && document.activeElement.getAttribute(\"data-disableshortcuts\") === \"true\") {\r\n\r\n\t\t\t// Determine if we are allowed to use this shortcut.\r\n\t\t\tvar bAllowShortcut = true;\r\n\r\n\t\t\t// CTRL(Windows) or CMD(Mac) is pressed\r\n\t\t\tif (event.ctrlKey || event.metaKey) {\r\n\t\t\t\tswitch (iKeycode) {\r\n\r\n\t\t\t\t\t// Disabled shortcuts.\r\n\t\t\t\t\tcase 66: // B - Bold.\r\n\t\t\t\t\tcase 85: // U - Underlines.\r\n\t\t\t\t\tcase 73: // I - Italics.\r\n\t\t\t\t\tcase 75: // K - Strike Through.\r\n\t\t\t\t\tcase 76: // L - Link.\r\n\t\t\t\t\tcase 72: // H - Horizontal Rule.\r\n\t\t\t\t\tcase 190: // . - Ordered List.\r\n\t\t\t\t\tcase 188: // , - Un-Ordered List.\r\n\t\t\t\t\t\tbAllowShortcut = false;\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\t// Return the result.\r\n\t\t\treturn bAllowShortcut;\r\n\t\t}\r\n\r\n\t\t// If we are in point to point alignment.\r\n\t\tif (g_oCompare.g_bAlignmentModeActive) {\r\n\t\t\t// CTRL(Windows) or CMD(Mac) is pressed.\r\n\t\t\tif (event.ctrlKey || event.metaKey) {\r\n\t\t\t\tswitch (iKeycode) {\r\n\t\t\t\t\t// M - Manual Alignment.\r\n\t\t\t\t\tcase 77: event.preventDefault(); g_oCompare.performManualAlignment(); break;\r\n\t\t\t\t\t// A - Automatic Alignment.\r\n\t\t\t\t\tcase 65: event.preventDefault(); g_oCompare.performGuidedAlignment(); break;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t// If we are in text compare mode.\r\n\t\tif (g_oTextCompare.g_bTextCompareInProgress) {\r\n\t\t\t// ALT key is pressed.\r\n\t\t\tif (event.altKey) {\r\n\t\t\t\tswitch (iKeycode) {\r\n\t\t\t\t\t// A (Approval Text Highlight)\r\n\t\t\t\t\tcase 65: $(\"#btnTextHighlight_Viewer_TextCompare\").click(); break;\r\n\t\t\t\t\t// C (Compare Text Highlight)\r\n\t\t\t\t\tcase 67: $(\"#btnTextHighlight_Compare_TextCompare\").click(); break;\r\n\t\t\t\t\t// R (Review Text Highlight)\r\n\t\t\t\t\tcase 82: $(\"#btnReviewCompare_Common_TextCompare\").click(); break;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t});\r\n\r\n\t// On resize.\r\n\t$(window).on(\"resize\", debounce(function resize() {\r\n\t\tg_oApproval.g_bDocNotChanged = true;\r\n\r\n\t\t// If we are on a mobile, only perform screen resize on orientation changes.\r\n\t\tif (typeof window.orientation !== 'undefined') {\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\t// If we do not have an active compare mode.\r\n\t\tif (g_oViewer.g_oCompareMode == eCompareMode.NoCompare) {\r\n\r\n\t\t\t// Resize the main viewer window.\r\n\t\t\tg_oViewer.resizeWindow();\r\n\t\t}\r\n\t\t// If we are in text compare mode.\r\n\t\telse if (g_oTextCompare.g_bTextCompareInProgress) {\r\n\r\n\t\t\t// Store the active text selection groups.\r\n\t\t\tg_oTextCompare.storeActiveTextSelectionGroups();\r\n\r\n\t\t\t// Re-activate the compare mode with the screen size changes.\r\n\t\t\tg_oCompare.activateCompare(g_oViewer.g_oCompareMode, g_oCompare.g_oCompareDocument, g_oCompare.g_oComparePage);\r\n\r\n\t\t\t// Update the text compare div.\r\n\t\t\tg_oTextCompare.updateTextCompareDiv();\r\n\t\t}\r\n\t\t// If we have an activate compare mode.\r\n\t\telse {\r\n\t\t\t\r\n\t\t\t// Re-activate the compare mode with the screen size changes.\r\n\t\t\tg_oCompare.activateCompare(g_oViewer.g_oCompareMode, g_oCompare.g_oCompareDocument, g_oCompare.g_oComparePage);\r\n\t\t}\r\n\r\n\t\t// Check if we need to redraw calipers.\r\n\t\tif (g_oTechTools.IsCaliperRedrawMode()) {\r\n\t\t\tg_oSavedCalipers.RebindCaliperRedrawEvent();\r\n\t\t}\r\n\r\n\t\t// Resize the modal overlay.\r\n\t\tg_oAnnotationAttachments.modalOverlayResize();\r\n\r\n\t\t// Handle the colour selection bubble if available.\r\n\t\tAnnotation.prototype.ResizeColourSelection(true);\r\n\t}, 250));\r\n\r\n\t// On orientation change.\r\n\t$(window).on(\"orientationchange\", debounce(function resize() {\r\n\t\tg_oApproval.g_bDocNotChanged = true;\r\n\t\t// If we do not have an active compare mode.\r\n\t\tif (g_oViewer.g_oCompareMode == eCompareMode.NoCompare) {\r\n\r\n\t\t\t// Resize the main viewer window.\r\n\t\t\tg_oViewer.resizeWindow();\r\n\t\t}\r\n\t\t// If we have an activate compare mode.\r\n\t\telse {\r\n\r\n\t\t\t// Re-activate the compare mode with the screen size changes.\r\n\t\t\tg_oCompare.activateCompare(g_oViewer.g_oCompareMode, g_oCompare.g_oCompareDocument, g_oCompare.g_oComparePage);\r\n\t\t}\r\n\t}, 250));\r\n});"]}