{"version":3,"sources":["../js/MarqueeService.js"],"names":["g_oMarquee","MarqueeService","this","g_iOrigin_x","g_iOrigin_y","g_iX","g_iY","prototype","initiateMarqueeDraw","event","iAnnotationType","oAnnotationViewer","oArtworkViewer","oSyncCanvas","fMarqueeDrawFunction","fMarqueePointerUpFunction","bDrawMarqueeCondition","bOverridePointSelectionCheck","oDrawRectangleRenderDetails","bInitiate","coords","getClickCoords","that","getRatio","synchroniseZoomPanProperties","eAnnotationTypes","Postit","Global","changeCanvasFunction","marqueeDraw","$","off","Math","abs","marqueePointerUp","parent","hasClass","AnnotationAction","mouseMove","redraw","g_oAnnotations","findAnnotation","initiateMarqueeWheelZoom","iScrollPreference","eWheelZoomType","Smart","g_oCanvas","width","g_oCanvasZoom","g_iZoomMultiplier","height","initiateMarqueeWheelZoomOut","fImplementationSpecificMarqueeDrawFunction","iCanvasWidth","iCanvasHeight","dCanvasHalfWidth","dCanvasHalfHeight","margin","c_iMargin","hide","oRenderValues","renderPointMarquee","Freedraw","renderFreedrawMarquee","TextMeasurement","PointToPointMeasurement","HorizontalCalliperMeasurement","VerticalCalliperMeasurement","AreaMeasurement","ColourDensityMeasurement","BarcodeMeasurement","Rectangle","renderRectangleMarquee","Ellipse","renderEllipseMarquee","Line","renderLineMarquee","renderGlobalMarquee","console","log","oCanvasContext","iCoordinateDistance_X","iCoordinateDistance_Y","iBeginPoint_X","iBeginPoint_Y","restore","dragDiscontinue","redrawAnnotations","fImplementationSpecificMarqueePointerUpFunction","oTransformedCoordinateValues","transformMarqueeCoordinatesForRotation","iEndPoint_X","iEndPoint_Y","iDragOffset_X","iDragOffset_Y","iCenterShift_X","iCenterShift_Y","iImageWidth","iImageHeight","canvasContext","g_oContext","beginPoint_x","min","beginPoint_y","iCoordinateDistance_x","iCoordinateDistance_y","derotateCanvasContext","clearRect","beginPath","rect","lineWidth","strokeStyle","lineColour","stroke","fillStyle","fill","moveTo","lineTo","g_oPostit","heightOffset","widthOffset","drawImage","g_oPostitImg","closePath","halfPoint_x","halfPoint_y","width_two_thirds","height_over_2","bezierCurveTo","round","g_iCenterShift_x","g_iCenterShift_y","g_oImage","bAllowReverseCoordinates","bRespectRealtimeDensity","endPoint_x","endPoint_y","iCenterShift_x","iCenterShift_y","iDragOffset_x","iDragOffset_y","iCompareRotation","g_oCompare","getCompareRotation","isViewerUsingRealtimeRender","g_oTechTools","g_iSelectedMeasurementType","g_eMeasurementTypes","COLOURDENSITY","g_iScaledImageWidth","g_iScaledImageHeight","g_iDragOffset_x","g_iDragOffset_y","iImageObjW","max","g_iCompareImage_x","iImageObjH","g_iCompareImage_y","tempx","tempy","diffX","diffY","g_iTempDragOffset_x","g_iTempDragOffset_y","g_iRotDegrees","isMarqueeWithinArtwork","compareOffset_x","compareOffset_y","beginPointX","beginPointY","endPointX","endPointY","scaledImageWidth","scaledImageHeight","co","calculateCompareOffsetInPx","x","y","bMarqueeWithinArtwork","iCentrePointX","iCentrePointY","isPointInPath","save","translate","rotate","PI","window"],"mappings":"AAsBA,IAAIA,WAAa,IAEhB,WACA,aAEA,SAASC,iBACRC,KAAKC,YAAc,EACnBD,KAAKE,YAAc,EACnBF,KAAKG,KAAO,EACZH,KAAKI,KAAO,EAiBbL,eAAeM,UAAUC,oBAAsB,SAAUC,MAAOC,gBAAiBC,kBAAmBC,eAAgBC,YAAaC,qBAAsBC,0BAA2BC,sBAAuBC,6BAA8BC,4BAA6BC,WAGnQ,IAAIC,OAASC,eAAeZ,MAAOE,mBACnCT,KAAKC,YAAciB,OAAO,GAC1BlB,KAAKE,YAAcgB,OAAO,GAC1BlB,KAAKG,KAAOe,OAAO,GACnBlB,KAAKI,KAAOc,OAAO,GACnB,IAAIE,KAAOpB,KAEXS,kBAAkBY,WAClBX,eAAeY,6BAA6Bb,mBAItCD,kBAAoBe,iBAAiBC,QAAUhB,kBAAoBe,iBAAiBE,QACzFC,qBAAqB,oBAAqB,cAAe,SAAUnB,OAClET,WAAW6B,YAAYpB,MAAOC,gBAAiBC,kBAAmBC,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AcoF,UAAUhI,iBAAkBC,mBAC1C2C,cAAcqF,QAAQ7K,kBAAkByJ,cAAgBpI,KAAKyJ,GAAK,KAClEtF,cAAcoF,WAAWhI,kBAAmBC,oBAI7CkI,OAAOzL,eAAiBA,eAxtBzB","file":"MarqueeService-bfe84f8a8a.js","sourcesContent":["/*\r\n *\tCopyright (c) 2018 SGS Europe. All rights reserved.\r\n *\r\n *\tThis program is the CONFIDENTIAL and PROPRIETARY property of 2018 SGS Europe.\r\n *\tAny unauthorised use, reproduction, or transfer of this program is strictly\r\n *\tprohibited.\r\n *\r\n *\tFile Name:\tMarqueeService.js\r\n *\r\n *\tDescription:\tA helper class to process coordinates with respect to centre shift, drag offset and rotation.\r\n *\t\t\t\t\tAlso to render a marquee image on the artwork canvas. Will render rectangle, ellipse & free draw shapes.\r\n *\r\n *\tHistory:\t\t16-FEB-18\tN Settle\tInitial implementation.\r\n *\t\t\t\t\t22-FEB-18\tP Raper\t\tGreenlight UAT enhancements including double click issue.\r\n *\t\t\t\t\t28-FEB-18\tN Settle\tSome code-tidy and some fixes raised by JSLint (DR208).\r\n *\t\t\t\t\t16-MAR-18\tN Settle\tFixed issue where user is unable to find an annotation on a click if the\r\n *\t\t\t\t\t\t\t\t\t\t\tmarqueeService is not supposed to process clicks (DR208).\r\n *\t\t\t\t\t26-OCT-18 R Pavolas Global refactoring Bind/Unbind to On/Off\r\n *\t\t\t\t\t21-NOV-18 R Pavolas Made the marquee zoom rebind the mouseHover when marqueeZoom is selected.\r\n *\t\t\t\t\t26-NOV-18 R Pavolas Added bypass for transformMarqueeCoordinatesForRotation.\r\n */\r\n\r\nvar g_oMarquee = {};\r\n\r\n(function () {\r\n\t\"use strict\";\r\n\r\n\tfunction MarqueeService() {\r\n\t\tthis.g_iOrigin_x = 0;\r\n\t\tthis.g_iOrigin_y = 0;\r\n\t\tthis.g_iX = 0;\r\n\t\tthis.g_iY = 0;\r\n\t}\r\n\r\n /**\r\n * Initiates the marquee drawing.\r\n * @param {event} event - The event.\r\n * @param {int} iAnnotationType - The type of annotation.\r\n * @param {object} oAnnotationViewer - THe annotation viewer.\r\n * @param {object} oArtworkViewer - The artwork viewer.\r\n * @param {object} oSyncCanvas - The synced canvases if any.\r\n * @param {float} fMarqueeDrawFunction - Function to call when drawing.\r\n * @param {gloat} fMarqueePointerUpFunction - Function to call when finished drawing.\r\n * @param {bool} bDrawMarqueeCondition - Condition for the marquee if any.\r\n * @param {bool} bOverridePointSelectionCheck - Whether to override the selection check.\r\n * @param {object} oDrawRectangleRenderDetails - Rectangle render details.\r\n * @param {bool} bInitiate - Whether to initiate.\r\n */\r\n\tMarqueeService.prototype.initiateMarqueeDraw = function (event, iAnnotationType, oAnnotationViewer, oArtworkViewer, oSyncCanvas, fMarqueeDrawFunction, fMarqueePointerUpFunction, bDrawMarqueeCondition, bOverridePointSelectionCheck, oDrawRectangleRenderDetails, bInitiate) {\r\n\r\n\t\t// Get the anchor point.\r\n\t\tvar coords = getClickCoords(event, oAnnotationViewer);\r\n\t\tthis.g_iOrigin_x = coords[0];\r\n\t\tthis.g_iOrigin_y = coords[1];\r\n\t\tthis.g_iX = coords[0];\r\n\t\tthis.g_iY = coords[1];\r\n\t\tvar that = this;\r\n\r\n\t\toAnnotationViewer.getRatio();\r\n\t\toArtworkViewer.synchroniseZoomPanProperties(oAnnotationViewer);\r\n\r\n\t\t// As they move, draw the marquee from anchor to current position...unless it is a Point or Global marquee type. These are done off the 'pointerup' event.\r\n\t\t// All marquee work is done on the Annotation Viewer.\r\n\t\tif (!(iAnnotationType === eAnnotationTypes.Postit || iAnnotationType === eAnnotationTypes.Global)) {\r\n\t\t\tchangeCanvasFunction(\".annotationViewer\", \"pointermove\", function (event) {\r\n\t\t\t\tg_oMarquee.marqueeDraw(event, iAnnotationType, oAnnotationViewer, oArtworkViewer, fMarqueeDrawFunction, oDrawRectangleRenderDetails);\r\n\t\t\t});\r\n\t\t}\r\n\r\n\t\t// Once the mouse is released, measure the drawn area.\r\n\t\tchangeCanvasFunction(\".annotationViewer\", \"pointerup\", function (event) {\r\n\t\t\t$(\".annotationViewer\").off(\"pointermove\");\r\n\r\n\t\t\tif (bInitiate || (Math.abs(that.g_iOrigin_x - that.g_iX) !== 0 || Math.abs(that.g_iOrigin_y - that.g_iY) !== 0)) {\r\n\t\t\t\t$(\".annotationViewer\").off(\"click\");\t\t// As the mouse has moved, we no longer need to check 'findAnnotations'.\r\n\r\n\t\t\t\t// The Point (i.e. Post-it Annotation) or Global marquees are drawn from a click so there should be no 'pointermove' event.\r\n\t\t\t\t// So we fire the marqueeDraw function for these two types as it won't have been fired previously.\r\n\t\t\t\tif (iAnnotationType === eAnnotationTypes.Postit || iAnnotationType === eAnnotationTypes.Global) {\r\n\t\t\t\t\tg_oMarquee.marqueeDraw(event, iAnnotationType, oAnnotationViewer, oArtworkViewer, fMarqueeDrawFunction, oDrawRectangleRenderDetails);\r\n\t\t\t\t}\r\n\r\n g_oMarquee.marqueePointerUp(event, oArtworkViewer, oSyncCanvas, bDrawMarqueeCondition, bOverridePointSelectionCheck, fMarqueePointerUpFunction);\r\n\r\n // If it's the marquee zoom, rebind mouseHover\r\n if ($(\"#btnZoomMarquee\").parent().hasClass(\"selectedButton\")) {\r\n changeCanvasFunction(\"#AnnotationViewer\", \"pointermove.annotationUI\", function (event) {\r\n AnnotationAction.prototype.mouseMove(event, oArtworkViewer, oAnnotationViewer);\r\n });\r\n } \r\n\t\t\t}\r\n\t\t\telse {\r\n oAnnotationViewer.redraw(false);\r\n g_oAnnotations.findAnnotation(event, oArtworkViewer, oAnnotationViewer);\r\n\t\t\t}\r\n\t\t});\r\n\t};\r\n\r\n\t/**\r\n\t * Initiates a marquee wheel zoom.\r\n\t * @param {object} event - The event.\r\n\t * @param {object} oAnnotationViewer - The annotation viewer.\r\n\t * @param {object} oArtworkViewer - The artwork viewer.\r\n\t * @param {object} oSyncCanvas - The list of sync cavnas.\r\n\t * @param {function} fMarqueePointerUpFunction - The marque pointer up function to be used.\r\n\t * @param {int} iScrollPreference - The scroll preference to be used.\r\n\t */\r\n\tMarqueeService.prototype.initiateMarqueeWheelZoom = function (event, oAnnotationViewer, oArtworkViewer, oSyncCanvas, fMarqueePointerUpFunction, iScrollPreference) {\r\n\r\n\t\t// Get the anchor point of the mouse.\r\n\t\tvar coords = getClickCoords(event, oAnnotationViewer);\r\n\t\tthis.g_iOrigin_x = coords[0];\r\n\t\tthis.g_iOrigin_y = coords[1];\r\n\t\tthis.g_iX = coords[0];\r\n\t\tthis.g_iY = coords[1];\r\n\r\n\t\t// If this is a smart zoom.\r\n\t\tif (iScrollPreference == eWheelZoomType.Smart) {\r\n\r\n\t\t\t// Calculate the marquee offset required to keep the mouse on its current location in the document.\r\n\t\t\tthis.g_iOrigin_x += ((oArtworkViewer.g_oCanvas.width / 2) - coords[0]) / oArtworkViewer.g_oCanvasZoom.g_iZoomMultiplier;\r\n\t\t\tthis.g_iOrigin_y += ((oArtworkViewer.g_oCanvas.height / 2) - coords[1]) / oArtworkViewer.g_oCanvasZoom.g_iZoomMultiplier;\r\n\t\t\tthis.g_iX += ((oArtworkViewer.g_oCanvas.width / 2) - coords[0]) / oArtworkViewer.g_oCanvasZoom.g_iZoomMultiplier;\r\n\t\t\tthis.g_iY += ((oArtworkViewer.g_oCanvas.height / 2) - coords[1]) / oArtworkViewer.g_oCanvasZoom.g_iZoomMultiplier;\r\n\t\t}\r\n\r\n\t\t// Get the compare ratio of the canvas.\r\n\t\toAnnotationViewer.getRatio();\r\n\r\n\t\t// Call the marquee pointer up immediately.\r\n\t\tg_oMarquee.marqueePointerUp(event, oArtworkViewer, oSyncCanvas, false, true, fMarqueePointerUpFunction);\r\n\t};\r\n\r\n\t/**\r\n\t * Initiates a marquee wheel zoom out.\r\n\t * @param {object} event - The event.\r\n\t * @param {object} oAnnotationViewer - The annotation viewer.\r\n\t * @param {object} oArtworkViewer - The artwork viewer.\r\n\t * @param {object} oSyncCanvas - The list of sync cavnas.\r\n\t * @param {function} fMarqueePointerUpFunction - The marque pointer up function to be used.\r\n\t * @param {int} iScrollPreference - The scroll preference to be used.\r\n\t */\r\n\tMarqueeService.prototype.initiateMarqueeWheelZoomOut = function (event, oAnnotationViewer, oArtworkViewer, oSyncCanvas, fMarqueePointerUpFunction, iScrollPreference) {\r\n\r\n\t\t// Get the anchor point of the mouse.\r\n\t\tvar coords = getClickCoords(event, oAnnotationViewer);\r\n\t\tthis.g_iOrigin_x = coords[0];\r\n\t\tthis.g_iOrigin_y = coords[1];\r\n\t\tthis.g_iX = coords[0];\r\n\t\tthis.g_iY = coords[1];\r\n\r\n\t\t// If this is a smart zoom.\r\n\t\tif (iScrollPreference == eWheelZoomType.Smart) {\r\n\t\t\t\r\n\t\t\t// Calculate the marquee offset required to keep the mouse on its current location in the document.\r\n\t\t\tthis.g_iOrigin_x += ((oArtworkViewer.g_oCanvas.width / 2) - coords[0]) * oArtworkViewer.g_oCanvasZoom.g_iZoomMultiplier;\r\n\t\t\tthis.g_iOrigin_y += ((oArtworkViewer.g_oCanvas.height / 2) - coords[1]) * oArtworkViewer.g_oCanvasZoom.g_iZoomMultiplier;\r\n\t\t\tthis.g_iX += ((oArtworkViewer.g_oCanvas.width / 2) - coords[0]) * oArtworkViewer.g_oCanvasZoom.g_iZoomMultiplier;\r\n\t\t\tthis.g_iY += ((oArtworkViewer.g_oCanvas.height / 2) - coords[1]) * oArtworkViewer.g_oCanvasZoom.g_iZoomMultiplier;\r\n\t\t}\r\n\r\n\t\t// Get the compare ratio of the canvas.\r\n\t\toAnnotationViewer.getRatio();\r\n\r\n\t\t// Call the marquee pointer up immediately.\r\n\t\tg_oMarquee.marqueePointerUp(event, oArtworkViewer, oSyncCanvas, false, true, fMarqueePointerUpFunction);\r\n\t};\r\n\r\n /**\r\n * The marquee draw pointermove event\r\n * @param {event} event - the event.\r\n * @param {enum} iAnnotationType - The annotation type.\r\n * @param {object} oAnnotationViewer - The annotation viewer.\r\n * @param {object} oArtworkViewer - The artwork viewer.\r\n * @param {function} fImplementationSpecificMarqueeDrawFunction - What function to invoke for specific implementation if any.\r\n * @param {object} oDrawRectangleRenderDetails - Rectangle rendering details object.\r\n */\r\n\tMarqueeService.prototype.marqueeDraw = function (event, iAnnotationType, oAnnotationViewer, oArtworkViewer, fImplementationSpecificMarqueeDrawFunction, oDrawRectangleRenderDetails) {\r\n var coords = getClickCoords(event, oAnnotationViewer);\r\n\t\tthis.g_iX = coords[0];\r\n\t\tthis.g_iY = coords[1];\r\n\r\n\t\tvar iCanvasWidth = oAnnotationViewer.g_oCanvas.width;\r\n\t\tvar iCanvasHeight = oAnnotationViewer.g_oCanvas.height;\r\n\t\tvar dCanvasHalfWidth = iCanvasWidth / 2;\r\n\t\tvar dCanvasHalfHeight = iCanvasHeight / 2;\r\n\r\n\t\tvar margin = oAnnotationViewer.c_iMargin;\r\n\r\n\t\t$(\".speechbubble\").hide();\r\n\r\n\t\t// Have we stayed within the bounds of the canvas, using a 10px margin?\r\n\t\tif ((this.g_iX > margin && this.g_iX < iCanvasWidth - margin) && (this.g_iY > margin && this.g_iY < iCanvasHeight - margin)) {\r\n\t\t\tvar oRenderValues;\r\n\r\n\t\t\tswitch (iAnnotationType) {\r\n\t\t\t\tcase eAnnotationTypes.Postit:\r\n\t\t\t\t\toRenderValues = g_oMarquee.renderPointMarquee(oAnnotationViewer, oArtworkViewer, iCanvasWidth, iCanvasHeight, oDrawRectangleRenderDetails);\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase eAnnotationTypes.Freedraw:\r\n\t\t\t\t\toRenderValues = g_oMarquee.renderFreedrawMarquee(oAnnotationViewer, oArtworkViewer, iCanvasWidth, iCanvasHeight, dCanvasHalfWidth, dCanvasHalfHeight, oDrawRectangleRenderDetails);\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase eAnnotationTypes.TextMeasurement:\r\n case eAnnotationTypes.PointToPointMeasurement:\r\n\t\t\t\tcase eAnnotationTypes.HorizontalCalliperMeasurement:\r\n\t\t\t\tcase eAnnotationTypes.VerticalCalliperMeasurement:\r\n\t\t\t\tcase eAnnotationTypes.AreaMeasurement:\r\n\t\t\t\tcase eAnnotationTypes.ColourDensityMeasurement:\r\n\t\t\t\tcase eAnnotationTypes.BarcodeMeasurement:\r\n case eAnnotationTypes.Rectangle:\r\n\t\t\t\t\toRenderValues = g_oMarquee.renderRectangleMarquee(oAnnotationViewer, oArtworkViewer, iCanvasWidth, iCanvasHeight, dCanvasHalfWidth, dCanvasHalfHeight, oDrawRectangleRenderDetails);\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase eAnnotationTypes.Ellipse:\r\n\t\t\t\t\toRenderValues = g_oMarquee.renderEllipseMarquee(oAnnotationViewer, oArtworkViewer, iCanvasWidth, iCanvasHeight, dCanvasHalfWidth, dCanvasHalfHeight, oDrawRectangleRenderDetails);\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase eAnnotationTypes.Line:\r\n\t\t\t\t\toRenderValues = g_oMarquee.renderLineMarquee(oAnnotationViewer, iCanvasWidth, iCanvasHeight, dCanvasHalfWidth, dCanvasHalfHeight, oDrawRectangleRenderDetails);\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase eAnnotationTypes.Global:\r\n\t\t\t\t\toRenderValues = g_oMarquee.renderGlobalMarquee(oAnnotationViewer, oArtworkViewer, oDrawRectangleRenderDetails);\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tdefault:\r\n\t\t\t\t\tconsole.log(\"g_oMarquee.marqueeDraw: Unknown annotation type! (value = \" + iAnnotationType + \")\");\r\n\t\t\t}\r\n\r\n\t\t\tif (oRenderValues !== undefined && oRenderValues !== null) {\r\n\t\t\t\t/*\r\n\t\t\t\tDO THE IMPLEMENTATION SPECIFIC STUFF HERE!!!!\r\n\t\t\t\t*/\r\n\t\t\t\tif (fImplementationSpecificMarqueeDrawFunction !== undefined && fImplementationSpecificMarqueeDrawFunction !== null) {\r\n\t\t\t\t\tfImplementationSpecificMarqueeDrawFunction(oArtworkViewer,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\toAnnotationViewer,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\toRenderValues.oCanvasContext,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\toRenderValues.iCoordinateDistance_X,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\toRenderValues.iCoordinateDistance_Y,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\toRenderValues.iBeginPoint_X,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\toRenderValues.iBeginPoint_Y,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tiCanvasWidth,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tiCanvasHeight,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tdCanvasHalfWidth,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tdCanvasHalfHeight);\r\n\t\t\t\t}\r\n\r\n oRenderValues.oCanvasContext.restore(); \r\n\t\t\t}\r\n\t\t}\r\n\t\telse {\t\t// if not within bounds of canvas, we want to cancel the marquee draw / zoom.\r\n\t\t\t$(\".annotationViewer\").off(\"pointermove\");\r\n\t\t\t$(\".annotationViewer\").off(\"pointerup\");\r\n\t\t\toAnnotationViewer.dragDiscontinue(false, []);\r\n\t\t\tg_oAnnotations.redrawAnnotations(oArtworkViewer, oAnnotationViewer);\r\n\t\t\toArtworkViewer.redraw(false);\r\n\t\t}\r\n\t};\r\n\r\n /**\r\n * Marquee measurement pointerup event.\r\n * @param {event} event - The event.\r\n * @param {object} oArtworkViewer - The artwork viewer.\r\n * @param {object} oSyncCanvas - The synced comparison canvases if any.\r\n * @param {bool} bDrawMarqueeCondition - Whether to draw the marquee condition.\r\n * @param {bool} bOverridePointSelectionCheck - Whether to override the point selection check.\r\n * @param {function} fImplementationSpecificMarqueePointerUpFunction - What implementation specific function to invoke if any.\r\n */\r\n\tMarqueeService.prototype.marqueePointerUp = function (event, oArtworkViewer, oSyncCanvas, bDrawMarqueeCondition, bOverridePointSelectionCheck, fImplementationSpecificMarqueePointerUpFunction) {\r\n\t\t\r\n\t\t// Only execute the marquee measure if the difference between dragged coordinates is not 0 (e.g. mouse click on point)\r\n\t\t// But for densitometer and text search we do allow a click measurement\r\n\t\tif ((((g_oMarquee.g_iOrigin_x !== g_oMarquee.g_iX) || (g_oMarquee.g_iOrigin_y !== g_oMarquee.g_iY)) && bDrawMarqueeCondition) || bOverridePointSelectionCheck) {\r\n\t\t\t\r\n\t\t\t// Transform the marquee co-ordinates for rotation.\r\n\t\t\tvar oTransformedCoordinateValues = g_oMarquee.transformMarqueeCoordinatesForRotation(oArtworkViewer, true);\r\n\r\n\t\t\t/*\r\n\t\t\tDO THE IMPLEMENTATION SPECIFIC STUFF HERE!!!!\r\n\t\t\t*/\r\n\t\t\tif (fImplementationSpecificMarqueePointerUpFunction !== undefined && fImplementationSpecificMarqueePointerUpFunction !== null) {\r\n\t\t\t\tfImplementationSpecificMarqueePointerUpFunction(event,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\toArtworkViewer,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\toSyncCanvas,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\toTransformedCoordinateValues.iBeginPoint_X,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\toTransformedCoordinateValues.iBeginPoint_Y,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\toTransformedCoordinateValues.iEndPoint_X,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\toTransformedCoordinateValues.iEndPoint_Y,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\toTransformedCoordinateValues.iDragOffset_X,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\toTransformedCoordinateValues.iDragOffset_Y,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\toTransformedCoordinateValues.iCenterShift_X,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\toTransformedCoordinateValues.iCenterShift_Y,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\toTransformedCoordinateValues.iImageWidth,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\toTransformedCoordinateValues.iImageHeight);\r\n\t\t\t}\r\n\r\n\t\t\t// Unbind the pointer up event.\r\n\t\t\t$(\".annotationViewer\").off(\"pointerup\");\r\n\t\t}\r\n\t\telse {\r\n\t\t\t// the user has clicked rather than drawn a marquee.\r\n\t\t\t// Revert to defaults, i.e. find an annotation.\r\n\t\t\t//oArtworkViewer.clearButtonHighlights();\r\n\t\t\tchangeCanvasFunction(\".annotationViewer\");\r\n\t\t}\r\n\t};\r\n\r\n\tMarqueeService.prototype.renderRectangleMarquee = function (oAnnotationViewer, oArtworkViewer, iCanvasWidth, iCanvasHeight, dCanvasHalfWidth, dCanvasHalfHeight, oDrawRectangleRenderDetails) {\r\n\t\tvar canvas = oAnnotationViewer.g_oCanvas;\r\n\t\tvar canvasContext = oAnnotationViewer.g_oContext;\r\n\r\n\t\tvar beginPoint_x = Math.min(this.g_iOrigin_x, this.g_iX);\r\n\t\tvar beginPoint_y = Math.min(this.g_iOrigin_y, this.g_iY);\r\n\t\tvar iCoordinateDistance_x = Math.abs(this.g_iOrigin_x - this.g_iX);\r\n\t\tvar iCoordinateDistance_y = Math.abs(this.g_iOrigin_y - this.g_iY);\r\n\r\n\t\tthis.derotateCanvasContext(canvasContext, oAnnotationViewer, iCanvasWidth, iCanvasHeight, dCanvasHalfWidth, dCanvasHalfHeight);\r\n\t\tcanvasContext.clearRect(0, 0, iCanvasWidth, iCanvasHeight);\r\n\t\tcanvasContext.beginPath();\r\n\r\n\t\tif (oDrawRectangleRenderDetails !== undefined && oDrawRectangleRenderDetails !== null) {\r\n\t\t\tcanvasContext.rect(beginPoint_x, beginPoint_y, iCoordinateDistance_x, iCoordinateDistance_y);\r\n\t\t\tcanvasContext.lineWidth = oDrawRectangleRenderDetails.lineWidth;\r\n\t\t\tcanvasContext.strokeStyle = oDrawRectangleRenderDetails.lineColour;\r\n\t\t\tcanvasContext.stroke();\r\n\t\t}\r\n\t\telse {\r\n\t\t\tcanvasContext.rect(0, 0, iCanvasWidth, iCanvasHeight);\r\n\t\t\tcanvasContext.fillStyle = \"rgba(0,0,0,0.75)\";\r\n\t\t\tcanvasContext.fill();\r\n\t\t\tcanvasContext.clearRect(beginPoint_x, beginPoint_y, iCoordinateDistance_x, iCoordinateDistance_y);\r\n\t\t}\r\n\r\n\t\tvar returnValues = {\r\n\t\t\toCanvasContext: canvasContext,\r\n\t\t\tiCoordinateDistance_X: iCoordinateDistance_x,\r\n\t\t\tiCoordinateDistance_Y: iCoordinateDistance_y,\r\n\t\t\tiBeginPoint_X: beginPoint_x,\r\n\t\t\tiBeginPoint_Y: beginPoint_y\r\n\t\t};\r\n\r\n\t\treturn returnValues;\r\n\t};\r\n\r\n\tMarqueeService.prototype.renderLineMarquee = function (oAnnotationViewer, iCanvasWidth, iCanvasHeight, dCanvasHalfWidth, dCanvasHalfHeight, oDrawRectangleRenderDetails) {\r\n\t\t// Setup some variables to hold the Annotation/Artwork Canvas\r\n\t\tvar canvasContext = oAnnotationViewer.g_oCanvas;\r\n\r\n\t\tvar beginPoint_x = g_oMarquee.g_iOrigin_x;\r\n\t\tvar beginPoint_y = g_oMarquee.g_iOrigin_y;\r\n\t\tvar iCoordinateDistance_x = g_oMarquee.g_iX - g_oMarquee.g_iOrigin_x;\r\n\t\tvar iCoordinateDistance_y = g_oMarquee.g_iY - g_oMarquee.g_iOrigin_y;\r\n\r\n\t\tthis.derotateCanvasContext(canvasContext, oAnnotationViewer, iCanvasWidth, iCanvasHeight, dCanvasHalfWidth, dCanvasHalfHeight);\r\n\t\tcanvasContext.clearRect(0, 0, iCanvasWidth, iCanvasHeight);\r\n\t\tcanvasContext.beginPath();\r\n\t\tcanvasContext.moveTo(beginPoint_x, beginPoint_y);\r\n\t\tcanvasContext.lineTo(beginPoint_x + iCoordinateDistance_x, beginPoint_y + iCoordinateDistance_y);\r\n\t\tcanvasContext.lineWidth = oDrawRectangleRenderDetails.lineWidth;\r\n\t\tcanvasContext.strokeStyle = oDrawRectangleRenderDetails.lineColour;\r\n\t\tcanvasContext.stroke();\r\n\r\n\t\tvar returnValues = {\r\n\t\t\toCanvasContext: canvasContext,\r\n\t\t\tiCoordinateDistance_X: iCoordinateDistance_x,\r\n\t\t\tiCoordinateDistance_Y: iCoordinateDistance_y,\r\n\t\t\tiBeginPoint_X: beginPoint_x,\r\n\t\t\tiBeginPoint_Y: beginPoint_y\r\n\t\t};\r\n\t\treturn returnValues;\r\n\t};\r\n\r\n\tMarqueeService.prototype.renderPointMarquee = function (oAnnotationViewer, iCanvasWidth, iCanvasHeight, dCanvasHalfWidth, dCanvasHalfHeight, oDrawRectangleRenderDetails) {\r\n\t\t// Link to the Annotation Canvas\r\n\t\tvar canvasContext = oAnnotationViewer.g_oContext;\r\n\r\n\t\t// These offsets are set to correctly position the Post it note on the page.\r\n\t\tvar g_oPostit = {};\r\n\t\tg_oPostit.heightOffset = 13;\r\n\t\tg_oPostit.widthOffset = 3;\r\n\r\n\t\tthis.derotateCanvasContext(canvasContext, oAnnotationViewer, iCanvasWidth, iCanvasHeight, dCanvasHalfWidth, dCanvasHalfHeight);\r\n\t\tcanvasContext.clearRect(0, 0, iCanvasWidth, iCanvasHeight);\r\n\r\n\t\t// Draw Image is part of the HTML5 Canvas Spec.\r\n\t\tcanvasContext.drawImage(g_oAnnotations.g_oPostitImg,\r\n\t\t\t\t\t\t\t\tg_oMarquee.g_iX - g_oPostit.widthOffset,\r\n\t\t\t\t\t\t\t\tg_oMarquee.g_iY - g_oPostit.heightOffset);\r\n\r\n\t\t// Push each point in the coordinates to the array\r\n\t\tvar beginPoint_x = g_oMarquee.g_iOrigin_x;\r\n\t\tvar beginPoint_y = g_oMarquee.g_iOrigin_y;\r\n\t\tvar iCoordinateDistance_x = g_oMarquee.g_iX - g_oMarquee.g_iOrigin_x;\r\n\t\tvar iCoordinateDistance_y = g_oMarquee.g_iY - g_oMarquee.g_iOrigin_y;\r\n\r\n\t\tvar returnValues = {\r\n\t\t\toCanvasContext: canvasContext,\r\n\t\t\tiCoordinateDistance_X: iCoordinateDistance_x,\r\n\t\t\tiCoordinateDistance_Y: iCoordinateDistance_y,\r\n\t\t\tiBeginPoint_X: beginPoint_x,\r\n\t\t\tiBeginPoint_Y: beginPoint_y\r\n\t\t};\r\n\t\treturn returnValues;\r\n\t};\r\n\r\n\tMarqueeService.prototype.renderFreedrawMarquee = function (oAnnotationViewer, oArtworkViewer, iCanvasWidth, iCanvasHeight, dCanvasHalfWidth, dCanvasHalfHeight, oDrawRectangleRenderDetails) {\r\n\t\tvar canvasContext = oAnnotationViewer.g_oContext;\r\n\r\n\t\tthis.derotateCanvasContext(canvasContext, oAnnotationViewer, iCanvasWidth, iCanvasHeight, dCanvasHalfWidth, dCanvasHalfHeight);\r\n\t\tcanvasContext.beginPath();\r\n\t\tcanvasContext.moveTo(g_oMarquee.g_iOrigin_x, g_oMarquee.g_iOrigin_y);\r\n\t\tcanvasContext.lineTo(g_oMarquee.g_iX, g_oMarquee.g_iY);\r\n\t\tcanvasContext.strokeStyle = oDrawRectangleRenderDetails.lineColour;\r\n\t\tcanvasContext.lineWidth = oDrawRectangleRenderDetails.lineWidth;\r\n\t\tcanvasContext.stroke();\r\n\t\tcanvasContext.closePath();\r\n\r\n\r\n\t\tvar beginPoint_x = g_oMarquee.g_iX;\r\n\t\tvar beginPoint_y = g_oMarquee.g_iY;\r\n\t\tvar iCoordinateDistance_x = g_oMarquee.g_iX - g_oMarquee.g_iOrigin_x;\r\n\t\tvar iCoordinateDistance_y = g_oMarquee.g_iY - g_oMarquee.g_iOrigin_y;\r\n\r\n\t\tvar returnValues = {\r\n\t\t\toCanvasContext: canvasContext,\r\n\t\t\tiCoordinateDistance_X: iCoordinateDistance_x,\r\n\t\t\tiCoordinateDistance_Y: iCoordinateDistance_y,\r\n\t\t\tiBeginPoint_X: beginPoint_x,\r\n\t\t\tiBeginPoint_Y: beginPoint_y\r\n\t\t};\r\n\r\n\t\treturn returnValues;\r\n\t};\r\n\r\n\tMarqueeService.prototype.renderEllipseMarquee = function (oAnnotationViewer, oArtworkViewer, iCanvasWidth, iCanvasHeight, dCanvasHalfWidth, dCanvasHalfHeight, oDrawRectangleRenderDetails) {\r\n\t\tvar canvasContext = oAnnotationViewer.g_oContext;\r\n\r\n\t\tvar beginPoint_x = Math.min(g_oMarquee.g_iOrigin_x, g_oMarquee.g_iX);\r\n\t\tvar beginPoint_y = Math.min(g_oMarquee.g_iOrigin_y, g_oMarquee.g_iY);\r\n\t\tvar iCoordinateDistance_x = Math.abs(g_oMarquee.g_iX - g_oMarquee.g_iOrigin_x);\r\n\t\tvar iCoordinateDistance_y = Math.abs(g_oMarquee.g_iY - g_oMarquee.g_iOrigin_y);\r\n\t\tvar halfPoint_x = beginPoint_x + (iCoordinateDistance_x / 2);\r\n\t\tvar halfPoint_y = beginPoint_y + (iCoordinateDistance_y / 2);\r\n\r\n\t\tvar width_over_2 = iCoordinateDistance_x / 2;\r\n\t\tvar width_two_thirds = iCoordinateDistance_x * 2 / 3;\r\n\t\tvar height_over_2 = iCoordinateDistance_y / 2;\r\n\r\n\t\tthis.derotateCanvasContext(canvasContext, oAnnotationViewer, iCanvasWidth, iCanvasHeight, dCanvasHalfWidth, dCanvasHalfHeight);\r\n\t\tcanvasContext.clearRect(0, 0, iCanvasWidth, iCanvasHeight);\r\n\r\n\t\tcanvasContext.beginPath();\r\n\t\tcanvasContext.moveTo(halfPoint_x, halfPoint_y - height_over_2);\r\n\t\tcanvasContext.bezierCurveTo(halfPoint_x + width_two_thirds, halfPoint_y - height_over_2, halfPoint_x + width_two_thirds, halfPoint_y + height_over_2, halfPoint_x, halfPoint_y + height_over_2);\r\n\t\tcanvasContext.bezierCurveTo(halfPoint_x - width_two_thirds, halfPoint_y + height_over_2, halfPoint_x - width_two_thirds, halfPoint_y - height_over_2, halfPoint_x, halfPoint_y - height_over_2);\r\n\t\tcanvasContext.closePath();\r\n\t\tcanvasContext.stroke();\r\n\r\n\t\tcanvasContext.strokeStyle = oDrawRectangleRenderDetails.lineColour;\r\n\t\tcanvasContext.lineWidth = oDrawRectangleRenderDetails.lineWidth;\r\n\t\tcanvasContext.stroke();\r\n\r\n\t\tvar returnValues = {\r\n\t\t\toCanvasContext: canvasContext,\r\n\t\t\tiCoordinateDistance_X: iCoordinateDistance_x,\r\n\t\t\tiCoordinateDistance_Y: iCoordinateDistance_y,\r\n\t\t\tiBeginPoint_X: beginPoint_x,\r\n\t\t\tiBeginPoint_Y: beginPoint_y\r\n\t\t};\r\n\t\treturn returnValues;\r\n\t};\r\n\r\n\tMarqueeService.prototype.renderGlobalMarquee = function (oAnnotationViewer, oArtworkViewer, oDrawRectangleRenderDetails) {\r\n\t\t// Get the annotation context\r\n\t\tvar canvasContext = oAnnotationViewer.g_oContext;\r\n\r\n\t\t// Draw the rectangle.\r\n\t\tvar beginPoint_x = round(0 + oArtworkViewer.g_iCenterShift_x);\r\n\t\tvar beginPoint_y = round(1 + oArtworkViewer.g_iCenterShift_y);\r\n\t\tvar iCoordinateDistance_x = oArtworkViewer.g_oImage.width;\r\n\t\tvar iCoordinateDistance_y = oArtworkViewer.g_oImage.height;\r\n\r\n\t\tcanvasContext.beginPath();\r\n\t\tcanvasContext.rect(beginPoint_x, beginPoint_y, iCoordinateDistance_x, iCoordinateDistance_y);\r\n\t\tcanvasContext.lineWidth = oDrawRectangleRenderDetails.lineWidth;\r\n\t\tcanvasContext.strokeStyle = oDrawRectangleRenderDetails.lineColour;\r\n\t\tcanvasContext.stroke();\r\n\r\n\t\tg_oMarquee.g_iOrigin_x = beginPoint_x;\r\n\t\tg_oMarquee.g_iOrigin_y = beginPoint_y;\r\n\t\tg_oMarquee.g_iX = beginPoint_x + iCoordinateDistance_x;\r\n\t\tg_oMarquee.g_iY = beginPoint_y + iCoordinateDistance_y;\r\n\r\n\t\tvar returnValues = {\r\n\t\t\toCanvasContext: canvasContext,\r\n\t\t\tiCoordinateDistance_X: iCoordinateDistance_x,\r\n\t\t\tiCoordinateDistance_Y: iCoordinateDistance_y,\r\n\t\t\tiBeginPoint_X: beginPoint_x,\r\n\t\t\tiBeginPoint_Y: beginPoint_y\r\n\t\t};\r\n\r\n\t\treturn returnValues;\r\n\t};\r\n\r\n MarqueeService.prototype.transformMarqueeCoordinatesForRotation = function (oArtworkViewer, bAllowReverseCoordinates, bRespectRealtimeDensity) {\r\n\t\tvar beginPoint_x;\r\n\t\tvar beginPoint_y;\r\n\t\tvar endPoint_x;\r\n\t\tvar endPoint_y;\r\n\t\tvar iImageWidth;\r\n\t\tvar iImageHeight;\r\n\t\tvar iCenterShift_x;\r\n\t\tvar iCenterShift_y;\r\n\t\tvar iDragOffset_x;\r\n var iDragOffset_y;\r\n bRespectRealtimeDensity = typeof bRespectRealtimeDensity === \"undefined\" ? true : bRespectRealtimeDensity;\r\n\r\n\t\t// Get the compare rotation of the canvas.\r\n\t\tvar iCompareRotation = g_oCompare.getCompareRotation(oArtworkViewer);\r\n\r\n\t\tif (bRespectRealtimeDensity && (oArtworkViewer.isViewerUsingRealtimeRender() && g_oTechTools.g_iSelectedMeasurementType == g_oTechTools.g_eMeasurementTypes.COLOURDENSITY)) {\r\n\r\n\t\t\t// Get the image width and height.\r\n\t\t\tiImageWidth = oArtworkViewer.g_oCanvas.width;\r\n\t\t\tiImageHeight = oArtworkViewer.g_oCanvas.height;\r\n\r\n\t\t\t// If we have a compare rotation of 90 or 270, swap the image width and height.\r\n\t\t\tif (iCompareRotation == 90 || iCompareRotation == 270) {\r\n\t\t\t\tiImageWidth = oArtworkViewer.g_oCanvas.height;\r\n\t\t\t\tiImageHeight = oArtworkViewer.g_oCanvas.width;\r\n\t\t\t}\r\n\r\n\t\t\t// Get the center shift.\r\n\t\t\tiCenterShift_x = 0;\r\n\t\t\tiCenterShift_y = 0;\r\n\r\n\t\t\t// Get the drag offset.\r\n\t\t\tiDragOffset_x = 0;\r\n\t\t\tiDragOffset_y = 0;\r\n\t\t}\r\n\t\telse {\r\n\r\n\t\t\t// Get the image width and height.\r\n\t\t\tiImageWidth = oArtworkViewer.g_iScaledImageWidth;\r\n\t\t\tiImageHeight = oArtworkViewer.g_iScaledImageHeight;\r\n\r\n\t\t\t// If we have a compare rotation of 90 or 270, swap the image width and height.\r\n\t\t\tif (iCompareRotation == 90 || iCompareRotation == 270) {\r\n\t\t\t\tiImageWidth = oArtworkViewer.g_iScaledImageHeight;\r\n\t\t\t\tiImageHeight = oArtworkViewer.g_iScaledImageWidth;\r\n\t\t\t}\r\n\r\n\t\t\t// Get the center shift.\r\n\t\t\tiCenterShift_x = oArtworkViewer.g_iCenterShift_x;\r\n\t\t\tiCenterShift_y = oArtworkViewer.g_iCenterShift_y;\r\n\r\n\t\t\t// Get the drag offset.\r\n\t\t\tiDragOffset_x = oArtworkViewer.g_iDragOffset_x;\r\n\t\t\tiDragOffset_y = oArtworkViewer.g_iDragOffset_y;\r\n\t\t}\r\n\r\n\t\t// Calculate the image width and height.\r\n\t\tvar iImageObjW = Math.max(iImageWidth, oArtworkViewer.g_iCompareImage_x);\r\n\t\tvar iImageObjH = Math.max(iImageHeight, oArtworkViewer.g_iCompareImage_y);\r\n\r\n\t\t// Find the bounds of the dragged marquee.\r\n\t\tif (bAllowReverseCoordinates) {\r\n\t\t\tbeginPoint_x = Math.min(g_oMarquee.g_iOrigin_x, g_oMarquee.g_iX);\r\n\t\t\tbeginPoint_y = Math.min(g_oMarquee.g_iOrigin_y, g_oMarquee.g_iY);\r\n\r\n\t\t\tendPoint_x = Math.max(g_oMarquee.g_iOrigin_x, g_oMarquee.g_iX);\r\n\t\t\tendPoint_y = Math.max(g_oMarquee.g_iOrigin_y, g_oMarquee.g_iY);\r\n\t\t}\r\n\t\telse {\r\n\t\t\tbeginPoint_x = g_oMarquee.g_iOrigin_x;\r\n\t\t\tbeginPoint_y = g_oMarquee.g_iOrigin_y;\r\n\r\n\t\t\tendPoint_x = g_oMarquee.g_iX;\r\n\t\t\tendPoint_y = g_oMarquee.g_iY;\r\n\t\t}\r\n\r\n\t\tvar diffX = endPoint_x - beginPoint_x;\r\n\t\tvar diffY = endPoint_y - beginPoint_y;\r\n\r\n\t\toArtworkViewer.g_iTempDragOffset_x = 0;\r\n\t\toArtworkViewer.g_iTempDragOffset_y = 0;\r\n\r\n\t\tif (!bRespectRealtimeDensity || !oArtworkViewer.isViewerUsingRealtimeRender() || !(g_oTechTools.g_iSelectedMeasurementType == g_oTechTools.g_eMeasurementTypes.COLOURDENSITY)) {\r\n\t\t\t// Used to flip the drag offset when rotated\r\n\t\t\tvar tempx;\r\n\t\t\tvar tempy;\r\n\r\n\t\t\tswitch (oArtworkViewer.g_iRotDegrees) {\r\n\t\t\t\tcase 90:\r\n\t\t\t\t\t// Remove the CenterShift compensation\r\n\t\t\t\t\ttempx = beginPoint_x - iCenterShift_x - ((iImageObjW - iImageObjH) / 2);\r\n\t\t\t\t\t// Work the coordinates back from the opposite image edge\r\n\t\t\t\t\ttempx = iImageObjH - tempx;\r\n\t\t\t\t\t// Then reapply the opposite CenterShift\r\n\t\t\t\t\ttempx += iCenterShift_y;\r\n\t\t\t\t\t// Reverse the CenterShift compensation.\r\n\t\t\t\t\ttempy = beginPoint_y - iCenterShift_y + iCenterShift_x + ((iImageObjW - iImageObjH) / 2);\r\n\t\t\t\t\t// x becomes y and vice versa\r\n\t\t\t\t\tbeginPoint_x = tempy;\r\n\t\t\t\t\tbeginPoint_y = tempx;\r\n\t\t\t\t\t// We also need to subtract the difference from y ONLY since the begin point is now greater than the endpoint!\r\n\t\t\t\t\tendPoint_x = beginPoint_x + diffY;\r\n\t\t\t\t\tendPoint_y = beginPoint_y - diffX;\r\n\r\n\t\t\t\t\toArtworkViewer.g_iTempDragOffset_x -= iDragOffset_y;\r\n\t\t\t\t\toArtworkViewer.g_iTempDragOffset_x += iDragOffset_x;\r\n\t\t\t\t\toArtworkViewer.g_iTempDragOffset_y += (iDragOffset_y);\r\n\t\t\t\t\toArtworkViewer.g_iTempDragOffset_y += (iDragOffset_x);\r\n\t\t\t\t\tbreak;\r\n\r\n\t\t\t\tcase 180:\r\n\t\t\t\t\t// We need to work the calculation backwards for both x and y (from the end of the image rather than the start)\r\n\t\t\t\t\ttempx = (iImageObjW - (beginPoint_x - iCenterShift_x)) + iCenterShift_x;\r\n\t\t\t\t\ttempy = (iImageObjH - (beginPoint_y - iCenterShift_y)) + iCenterShift_y;\r\n\t\t\t\t\tbeginPoint_x = tempx;\r\n\t\t\t\t\tbeginPoint_y = tempy;\r\n\t\t\t\t\t// We also need to subtract the difference since the begin point is now greater than the endpoint!\r\n\t\t\t\t\tendPoint_x = beginPoint_x - diffX;\r\n\t\t\t\t\tendPoint_y = beginPoint_y - diffY;\r\n\r\n\t\t\t\t\toArtworkViewer.g_iTempDragOffset_x += (iDragOffset_x * 2);\r\n\t\t\t\t\toArtworkViewer.g_iTempDragOffset_y += (iDragOffset_y * 2);\r\n\t\t\t\t\tbreak;\r\n\r\n\t\t\t\tcase 270:\r\n\t\t\t\t\t// Remove the CenterShift compensation\r\n\t\t\t\t\ttempy = beginPoint_y - iCenterShift_y - ((iImageObjH - iImageObjW) / 2);\r\n\t\t\t\t\t// Work the coordinates back from the opposite image edge\r\n\t\t\t\t\ttempy = iImageObjW - tempy;\r\n\t\t\t\t\t// Then reapply the opposite CenterShift\r\n\t\t\t\t\ttempy += iCenterShift_x;\r\n\t\t\t\t\t// Reverse the CenterShift compensation.\r\n\t\t\t\t\ttempx = beginPoint_x - iCenterShift_x + iCenterShift_y + ((iImageObjH - iImageObjW) / 2);\r\n\t\t\t\t\t// x becomes y and vice versa\r\n\t\t\t\t\tbeginPoint_x = tempy;\r\n\t\t\t\t\tbeginPoint_y = tempx;\r\n\t\t\t\t\t// We also need to subtract the difference from x ONLY since the begin point is now greater than the endpoint!\r\n\t\t\t\t\tendPoint_x = beginPoint_x - diffY;\r\n\t\t\t\t\tendPoint_y = beginPoint_y + diffX;\r\n\r\n\t\t\t\t\toArtworkViewer.g_iTempDragOffset_x += iDragOffset_y;\r\n\t\t\t\t\toArtworkViewer.g_iTempDragOffset_x += iDragOffset_x;\r\n\t\t\t\t\toArtworkViewer.g_iTempDragOffset_y += (iDragOffset_y);\r\n\t\t\t\t\toArtworkViewer.g_iTempDragOffset_y -= (iDragOffset_x);\r\n\t\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tvar returnValues = {\r\n\t\t\tiBeginPoint_X: beginPoint_x,\r\n\t\t\tiBeginPoint_Y: beginPoint_y,\r\n\t\t\tiEndPoint_X: endPoint_x,\r\n\t\t\tiEndPoint_Y: endPoint_y,\r\n\t\t\tiCenterShift_X: iCenterShift_x,\r\n\t\t\tiCenterShift_Y: iCenterShift_y,\r\n\t\t\tiDragOffset_X: iDragOffset_x,\r\n\t\t\tiDragOffset_Y: iDragOffset_y,\r\n\t\t\tiImageWidth: iImageObjW,\r\n\t\t\tiImageHeight: iImageObjH\r\n\t\t};\r\n\r\n\t\treturn returnValues;\r\n\t};\r\n\r\n\tMarqueeService.prototype.isMarqueeWithinArtwork = function (oArtworkViewer) {\r\n\t\tvar beginPointX = g_oMarquee.g_iOrigin_x;\r\n\t\tvar beginPointY = g_oMarquee.g_iOrigin_y;\r\n\t\tvar endPointX = g_oMarquee.g_iX;\r\n\t\tvar endPointY = g_oMarquee.g_iY;\r\n\t\tvar scaledImageWidth = oArtworkViewer.g_iScaledImageWidth;\r\n\t\tvar scaledImageHeight = oArtworkViewer.g_iScaledImageHeight;\r\n\r\n\t\t// Calculate the compare offset of the canvas.\r\n\t\tvar compareOffset_x, compareOffset_y;\r\n\t\tvar co = g_oCompare.calculateCompareOffsetInPx(oArtworkViewer);\r\n\t\tcompareOffset_x = co.x;\r\n\t\tcompareOffset_y = co.y;\r\n\r\n\t\t// Get the compare rotation of the canvas.\r\n\t\tvar iCompareRotation = g_oCompare.getCompareRotation(this);\r\n\r\n\t\t// If we have a compare rotation of 90 or 270, swap the image width and height.\r\n\t\tif (iCompareRotation == 90 || iCompareRotation == 270) {\r\n\t\t\tscaledImageWidth = oArtworkViewer.g_iScaledImageHeight;\r\n\t\t\tscaledImageHeight = oArtworkViewer.g_iScaledImageWidth;\r\n\t\t}\r\n\r\n\t\t// Create a rectangle around the artwork.\r\n\t\toArtworkViewer.g_oContext.beginPath();\r\n\t\toArtworkViewer.g_oContext.rect(oArtworkViewer.g_iCenterShift_x + compareOffset_x, oArtworkViewer.g_iCenterShift_y + compareOffset_y, scaledImageWidth, scaledImageHeight);\r\n\t\toArtworkViewer.g_oContext.fillStyle = \"rgba(0,0,0,0)\";\r\n\t\toArtworkViewer.g_oContext.fill();\r\n\t\toArtworkViewer.g_oContext.closePath();\r\n\r\n\t\t// Determine if the marquee is within the artwork.\r\n\t\tvar bMarqueeWithinArtwork = false;\r\n\r\n\t\t// Calculate the mid point of the marquee.\r\n\t\tvar iCentrePointX = beginPointX + ((endPointX - beginPointX) / 2);\r\n\t\tvar iCentrePointY = beginPointY + ((endPointY - beginPointY) / 2);\r\n\r\n\t\t// Check each of the major points of the marquee.\r\n\t\tif (oArtworkViewer.g_oContext.isPointInPath(beginPointX, beginPointY)) {\r\n\t\t\t// North West Point.\r\n\t\t\tbMarqueeWithinArtwork = true;\r\n\t\t}\r\n\t\telse if (oArtworkViewer.g_oContext.isPointInPath(iCentrePointX, beginPointY)) {\r\n\t\t\t// North Point.\r\n\t\t\tbMarqueeWithinArtwork = true;\r\n\t\t}\r\n\t\telse if (oArtworkViewer.g_oContext.isPointInPath(endPointX, beginPointY)) {\r\n\t\t\t// North East Point.\r\n\t\t\tbMarqueeWithinArtwork = true;\r\n\t\t}\r\n\t\telse if (oArtworkViewer.g_oContext.isPointInPath(endPointX, iCentrePointY)) {\r\n\t\t\t// East Point.\r\n\t\t\tbMarqueeWithinArtwork = true;\r\n\t\t}\r\n\t\telse if (oArtworkViewer.g_oContext.isPointInPath(endPointX, endPointY)) {\r\n\t\t\t// South East Point.\r\n\t\t\tbMarqueeWithinArtwork = true;\r\n\t\t}\r\n\t\telse if (oArtworkViewer.g_oContext.isPointInPath(iCentrePointX, endPointY)) {\r\n\t\t\t// South Point.\r\n\t\t\tbMarqueeWithinArtwork = true;\r\n\t\t}\r\n\t\telse if (oArtworkViewer.g_oContext.isPointInPath(beginPointX, endPointY)) {\r\n\t\t\t// South West Point.\r\n\t\t\tbMarqueeWithinArtwork = true;\r\n\t\t}\r\n\t\telse if (oArtworkViewer.g_oContext.isPointInPath(beginPointX, iCentrePointY)) {\r\n\t\t\t// West Point.\r\n\t\t\tbMarqueeWithinArtwork = true;\r\n\t\t}\r\n\t\telse if (oArtworkViewer.g_oContext.isPointInPath(iCentrePointX, iCentrePointY)) {\r\n\t\t\t// Centre Point.\r\n\t\t\tbMarqueeWithinArtwork = true;\r\n\t\t}\r\n\r\n\t\t// Return the result.\r\n\t\treturn bMarqueeWithinArtwork;\r\n\t}\r\n\r\n\tMarqueeService.prototype.derotateCanvasContext = function (canvasContext, oAnnotationViewer, iCanvasWidth, iCanvasHeight, dCanvasHalfWidth, dCanvasHalfHeight) {\r\n\t\tcanvasContext.save();\r\n\t\tcanvasContext.translate(dCanvasHalfWidth, dCanvasHalfHeight);\r\n\t\tcanvasContext.rotate(-oAnnotationViewer.g_iRotDegrees * Math.PI / 180);\r\n\t\tcanvasContext.translate(-dCanvasHalfWidth, -dCanvasHalfHeight);\r\n\t};\r\n\r\n\t// Add the Marquee Service object to the window.\r\n\twindow.MarqueeService = MarqueeService;\r\n}());"]}