Evgeny, I think a good way to accomplish this is demonstrated in the 'Google Eyes' gadget, which runs in iGoogle.
You can reverse engineer the Gadget Spec by referring to the source code here: http://www.google.com/ig/modules/eyes.xml I took the liberty of doing some analysis and this is what I would have to offer by way of an explanation: First, here is the code from the script formatted to be easier to read (hopefully it looks ok in this posting) http://www.google.com/ig/directory?hl=en&type=gadgets&url= <script> var EYES__MODULE_ID__={ MAX_DIST:37, EYE_RADIUS:59, PUPIL_RADIUS:7, pupils:[], init:function(){ _IG_AddDOMEventHandle( document, "mousemove", EYES__MODULE_ID__.moveEyes); EYES__MODULE_ID__.pupils=[_gel("EYES_pupil0__MODULE_ID__"), _gel("EYES_pupil1__MODULE_ID__")] }, moveEyes:function(b){ if(!b)b=window.event; for(var a=EYES__MODULE_ID__,c=0;c<a.pupils.length;c++){ var d=a.pupils[c]; var k=a.getPagePos(d.parentNode,true)+a.EYE_RADIUS; var l=a.getPagePos(d.parentNode,false)+a.EYE_RADIUS; var e=0; var f=0; if(typeof(window.pageXOffset)=="number"){ e=window.pageXOffset; f=window.pageYOffset }else{ e=document.documentElement.scrollLeft; f=document.documentElement.scrollTop } var g=b.clientX+e-k; var h=b.clientY+f-l; var i=Math.sqrt(Math.pow(g,2)+Math.pow(h,2)); if(i>a.MAX_DIST){ var j=a.MAX_DIST/i; g*=j; h*=j } d.style.left=Math.round(g+a.EYE_RADIUS-a.PUPIL_RADIUS+"px"; d.style.top=Math.round(h+a.EYE_RADIUS-a.PUPIL_RADIUS)+"px" } }, getPagePos:function(b,a){ for(var c=0;b!=null;){ c+=b["offset"+(a?"Left":"Top")]; b=b.offsetParent } return c} }; EYES__MODULE_ID__.init(); </script> Now, I think all the magic really happens in the Init() _IG_AddDOMEventHandle( document, "mousemove", EYES__MODULE_ID__.moveEyes); EYES__MODULE_ID__.pupils=[_gel("EYES_pupil0__MODULE_ID__"), _gel("EYES_pupil1__MODULE_ID__")] What this does is using the _IG_AddDOMEventHandle, we are able to trigger something to work with the document.mousemove event we can use the EYES_MODULE_ID to invoke .moveyes and set .pupils (notice the use of _gel (google's getelement)) this provides us with references to the very top of the injection through quasi-reflection... the rest of the magic happens in here: if(typeof(window.pageXOffset)=="number"){ e=window.pageXOffset; f=window.pageYOffset }else{ e=document.documentElement.scrollLeft; f=document.documentElement.scrollTop } var g=b.clientX+e-k; var h=b.clientY+f-l; Hope this helps Good luck! --nolybab On Aug 7, 2:52 am, Evgeny Neumerzhitskiy <evgeny...@gmail.com> wrote: > Does anyone know how to track the mouse cursor when it's outside my > gadget's view? Document.onmousemove only works when the cursor is > inside my gadget. > > I found a gadget with eyes that track the mouse position, but it uses > render_inline="required" which is no longer supported, so I can't use > it.http://www.google.com/ig/directory?type=gadgets&url=www.google.com/ig... > > Thank you, > > Evgeny --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "OpenSocial Application Development" group. To post to this group, send email to opensocial-api@googlegroups.com To unsubscribe from this group, send email to opensocial-api+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/opensocial-api?hl=en -~----------~----~----~----~------~----~------~--~---