Open GoogleCodeExporter opened 9 years ago
I support this request. Currently we don't have a workaround for keyboard
events when
the plugin has focus
Razz
Original comment by rjai...@gmail.com
on 30 Jan 2009 at 2:30
keyboard support is essential for serious applications. I wonder if I can use
the
mouse button up event to shift focus back to the page so keyboard events at
least get
handled. I suppose that will then kill native keyboard support in GE
Original comment by vandint...@gmail.com
on 1 Apr 2009 at 8:16
I had limited success with the keyboard hack in the source section but the
following
code is usable in both IE and FF. Obviously you lose keyboard functionality in
ge and
the mouse scroll wheel will not zoom (Use right mouse drag instead).
google.earth.addEventListener(ge.getWindow(), "mouseup", setPageFocus);
function setPageFocus(){
window.focus();
}
Original comment by vandint...@gmail.com
on 2 Apr 2009 at 9:36
PERFECT.
Original comment by guerrero...@gmail.com
on 6 Aug 2009 at 2:12
ohhh, No functionate whit Crhome
Original comment by guerrero...@gmail.com
on 6 Aug 2009 at 2:40
chrome does not let you steal focus. that makes chrome a no go zone for now
Original comment by vandint...@gmail.com
on 8 Aug 2009 at 7:52
Original comment by api.roman.public@gmail.com
on 9 Aug 2009 at 12:58
I wanted to add my support for this function, to do some vital functions in my
application I need to be able to add a keypress/keydown/keyup events that are
done on
the earth, having to force focus lost to use the document events is a pain
Original comment by david...@gmail.com
on 26 Jan 2010 at 6:00
Since ge.getWindow().blur(); has been fixed it is possible to use
ge.getWindow().blur(); in the Mouseup event. This will work on all browsers on
Windows but not reliable on Apple where all browsers end up with the focus in
lala land.
Also you still lose all of the user interface functionality of ge.
With the above code keyboard sort of works as a hack but native keypress events
are
essential.
Original comment by vandint...@gmail.com
on 27 May 2010 at 11:02
Original comment by bcke...@google.com
on 23 Feb 2011 at 12:09
Original comment by api.roman.public@gmail.com
on 28 Jul 2011 at 4:08
This is related and may not answer everyone's needs, but it answered mine. As
this happend to be the first place I looked when I started searching I wanted
to post the solution I found, however obvious it may have been.
//get key modifiers with mouse events
google.earth.addEventListener(ge.getWindow(), 'click', function(event) {
var ctrlKey = kmlEvent.getCtrlKey();
if(ctrlKey==1) {
alert("Ctrl click detected!);
}
I found this at:
http://groups.google.com/group/google-earth-browser-plugin/browse_thread/thread/
31afa674ac5ecf5a
Original comment by freeflyh...@gmail.com
on 20 Oct 2011 at 4:18
in 2008 there were reported problems with keyboard events. Now it is 2011. More
than 3 years later and STILL no solid solution to this issue. Some version of
Firefox (3.6 and lower) will respond to ge.getWindow().blur(); in the mouseup
event handler. Newer version of Firefox won't.
After throwing a few more hours at the problem, I came up with the following
workaround:
I grabbed the HTML button code from the demo gallery and placed such a button
on top of the ge window. This provided the browser with a visible control to
set focus to. Then I started to remove code from the button object and was left
the with following code that leaves an invisible control that can still be
focused on.
Place this code in the mouseup event handler:
document.getElementById('takecontrol').focus();
Place this code in the initCallback to create the focus control where map3d is
the name of the div that holds the ge plugin:
createFocusControl('map3d');
function createFocusControl(containerid) {
var button = document.createElement('a');
button.id = 'takecontrol';
button.href = '#';
button.style.display = 'block';
button.innerHTML = 'PIA';
button.id = 'takecontrol';
button.style.position = 'absolute';
button.style.left = '5px';
button.style.bottom = '5px';
button.style.width = '25px';
button.style.height = '18px';
document.getElementById(containerid).appendChild(button);
};
This control is invisible because the background color is not set. That is just
perfect for our purpose. If the control is visible it will be placed discretely
in the lower left corner of the ge window. The code assumes that the map3d div
is positioned absolute or relative.
This workaround works perfectly with all planetinaction.com applications on
Firefox, Chrome and MSIE on both Windows XP and Windows7. I hope someone can
give feedback on how well this works for Apple (If required at all)
Original comment by vandint...@gmail.com
on 30 Oct 2011 at 11:24
Thanks for the workaround. Unfortunately it also prevents the plugin to receive
the navigation keystrokes (arrow buttons etc.), but more than nothing:)
I slightly modified the code: setting the innerHTML to ' ' will ensure that
nothing appears on the screen while it is still getting the focus.
Original comment by samanocs...@gmail.com
on 8 Dec 2011 at 9:05
Wow... 5 years?
Definitely an needed feature.
Original comment by carson.p...@gmail.com
on 6 Mar 2013 at 10:02
Original issue reported on code.google.com by
api.roman.public@gmail.com
on 12 Aug 2008 at 8:46