English 中文(简体)
页: 1 点击事件的关键地位?
原标题:Google maps -- detect metaKey status during click event?

我正在利用javascript AP为谷歌地图绘制。 我愿知道,指挥钥匙(关于Mac)在点火时是否被压缩。 然而,我似乎无法获得这些信息:

https://developers.google.com/maps/documentation/javascript/reference#MouseEvent

是否有办法解决这一问题?

问题回答

我认为,这样做是可能的。 我没有马上,所以我可以试。 所有我都用<代码>ctrlKey替换。 在联合后勤业务处,我可以坐在旁边,第一个点击或点击机总会登记为定期点击。 该公司在JSFiddle之外进行罚款。

甲型六氯环己烷应打印成色体。 请审判:

rel=“nofollow”>http://jsfiddle.net/ThraL/5/

视窗版(ctrl)

rel=“nofollow”>http://jsfiddle.net/ThraL/4/

(你可以撰写<代码>meta 关键标准,但因为我可以先测试一把。

<!DOCTYPE html>
<html>
  <head>
    <style type="text/css">
      html, body, #map_canvas { margin: 0; padding: 0; height: 100% }
    </style>
    <script type="text/javascript" src="http://maps.googleapis.com/maps/api/js?sensor=false"></script>
    <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
    <script type="text/javascript">
      var map;
      var mapOptions = { center: new google.maps.LatLng(0.0, 0.0), zoom: 2,
        mapTypeId: google.maps.MapTypeId.ROADMAP };

      function initialize() {
        map = new google.maps.Map(document.getElementById("map_canvas"), mapOptions);

      var metadown;
      var clicks = 0;

      $(window).keydown(function(evtobj) {
        if(evtobj.metaKey) { 
          metadown = true;
        } 
        $(window).one("keyup",function(evtobj) {
          metadown = false;
        });
      });

      google.maps.event.addListener(map,  click , function(event) {
        if(metadown) {
          $("#console").val(event.latLng);
          metadown = false; 
        }
        else {
          $("#console").val("meta not down (" + clicks + ")
");  
          clicks++;
        }
      });

      }
      google.maps.event.addDomListener(window,  load , initialize);
    </script>
  </head>
  <body>
<div id="display">
    <textarea id="console" rows="2" cols="30"></textarea>
</div>
    <div id="map_canvas"></div>
  </body>
</html>




相关问题
Automatically scroll when mouse is idle

I need to find a way to randomly scroll horizontally and vertically, plus or minus a set number of pixels per second in each dimension, when the mouse has been idle for a set amount of time. Any ideas ...

Handle tilt left / right in WPF

How can I handle tilt left or tilt right mouse event in WPF? alt text http://s3images.coroflot.com/user_files/individual_files/featured/featured_1266_st_dVYgtBSHIQRPzXvrG4WnUW.jpg

WPF StackPanel with Click AND DoubleClick

I need to be able to handle the double click and single click event on the WPF StackPanel. But there is no such thing as the StackPanel s DoubleClick Event. I want to do 2 different operations in ...

Find control inside Listbox.ItemTemplate (WPF C#)

I have some problems finding the right TextBlock control inside a StackPanel. My markup: <ListBox Name="lstTimeline" ItemContainerStyle="{StaticResource TwItemStyle}" MouseDoubleClick="...

TreeView, Overiding the double click mouse event WPF

I was wondering, what will be the best way to override the Tree View s mouse click? As you know when you double click a tree view parent, then the tree view expands and shows the children. If it doesn ...

Mouse events on an SWT Scrollbar

Using standalone SWT Scrollbars is something of a hack (using this workaround), but it can be done. Here s a snippet: ScrolledComposite scrolledComposite = new ScrolledComposite( ...

IsMouseOver within a Button

I m creating a button with a down arrow: alt text http://www.robbertdam.nl/share/so/1.png The arrow is actually a button within a button. When the mouse is at the location I pointed out with a red ...

热门标签