Reference Guide
Reference Guides / JavaScript API / Events / RegisterOnAnnotationMouseLeave
In This Topic
    RegisterOnAnnotationMouseLeave
    In This Topic
     RegisterOnAnnotationMouseLeave

    This function allows you to trigger a function of your own when the mouse leaves an annotation bounding box.

    RegisterOnAnnotationMouseLeave: function (docuViewareID, callback)

    Parameters

    docuViewareID
    The identifier for the DocuVieware™ instance.
    callback
    The function you want to execute on event.
    The callback provides an argument having a prototype { id }.
    - id specifies the annotation unique id that can be retrieved from the server side using the Guid property of the annotation class.

    Return Value

    1 if error.

    Example of usage

    This JavaScript makes sure the DocuVieware control is properly loaded and initialized and then subscribes to the AnnotationMouseEnter, AnnotationMouseLeave and AnnotationMoved events on load to display the corresponding annotation id in the console.

    function RegisterOnAnnotationHoverOnDocuViewareAPIReady() {
         if (typeof DocuViewareAPI !== "undefined" && DocuViewareAPI.IsInitialized("DocuVieware1")) {
             DocuViewareAPI.RegisterOnAnnotationMouseEnter("DocuVieware1", function (annot) { console.log("mouse enter " + annot.id); });
             DocuViewareAPI.RegisterOnAnnotationMouseLeave("DocuVieware1", function (annot) { console.log("mouse leave " + annot.id); });
             DocuViewareAPI.RegisterOnAnnotationMoved("DocuVieware1", function (annot) { console.log("annotation moved " + annot.id); });
         }
         else {
             setTimeout(function () { RegisterOnAnnotationHoverOnDocuViewareAPIReady() }, 10);
         }
     }
     document.addEventListener("DOMContentLoaded", function () {
         RegisterOnAnnotationHoverOnDocuViewareAPIReady();
     }, false);