Get Keypressed event?

986 views
Skip to first unread message

george gonzalez

unread,
Aug 26, 2014, 5:57:59 PM8/26/14
to leafl...@googlegroups.com
Hi I am using Leaflet and love it!

One hangup, I want to select-All the boxes I've drawn when someone pressed Control-A  (Windows convention).

I've tried map.on( 'keypress', KeyFunc )  with no joy.

map.on( 'click', ClickFunc )    works fine, so I am getting events, just not keypressed ones.

Hint:  the browser (Chrome ) is highlighting other stuff when I press Control-A so it looks like chrome gets the keypressed first before I can see it.




k_man_au

unread,
Aug 27, 2014, 9:08:29 PM8/27/14
to leafl...@googlegroups.com
Try catching the keypress by itself and not associating with a map event.

document.onkeydown = function (e) {
if(e.keyCode == '90') {
alert("Zoom Level:" + map.getZoom());
}
};

k_man_au

unread,
Aug 27, 2014, 9:10:29 PM8/27/14
to leafl...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages