In This Topic
Reference Guides / JavaScript API / Actions / Document / GetSelectionAreaCoordinates

GetSelectionAreaCoordinates

In This Topic
 GetSelectionAreaCoordinates

This function allows you to retrieve the current selection area coordinates.

GetSelectionAreaCoordinates: function (docuViewareID)

Parameters

docuViewareID
The identifier for the DocuVieware™ instance you want to retrieve the selection area coordinates from.

Return Value

Coordinates, in inches, of the selection area under the following form: { left: x, top: y, width: w, height: h }, values will be 0 if no area selected.

Example of usage

This JavaScript makes sure the DocuVieware control is properly loaded and initialized and then subscribes to the event on load to display the selected area coordinates in the console.

function RegisterOnAreaSelectedOnDocuViewareAPIReady() {
   if (typeof DocuViewareAPI !== "undefined" && DocuViewareAPI.IsInitialized("DocuVieware1")) {
      DocuViewareAPI.RegisterOnAreaSelected("DocuVieware1", function (annot) {
         console.log(DocuViewareAPI.GetSelectionAreaCoordinates("DocuVieware1"));
      });
   }
   else {
      setTimeout(function () { RegisterOnAreaSelectedOnDocuViewareAPIReady() }, 10);
   }
}
window.onload = function () {
   RegisterOnAreaSelectedOnDocuViewareAPIReady();
}