GMarkerOptions [class]-GoogleMaps/API/doc/ClassReference/04-GMarkerOptions-N☆E 学習帳

[ リロード ]   [ ソース ]  [ トップ | 一覧 | 単語検索 | 最新 | バックアップ | ヘルプ ]

Counter: 3731, today: 1, yesterday: 1

GMarkerOptions [class]

http://www.google.com/apis/maps/docu­mentation/

Version 2 新規

Rivision 2.50a 以降

Instances of this class are used in the opts? argument to the constructor of the GMarker class. There is no constructor for this class. Instead, this class is instantiated as a javascript object literal.

Properties

As the name of this class indicates, all properties are optional.

Properties Type Description
icon GIcon Chooses the Icon for this class. If not specified, G_DEFAULT_ICON is used. (Since 2.50)
dragCrossMove Boolean When dragging markers normally, the marker floats up and away from the cursor. Setting this value to true keeps the marker underneath the cursor, and moves the cross downwards instead. The default value for this option is false. (Since 2.63)
clickable Boolean Toggles whether or not the marker is clickable. Markers that are not clickable or draggable are inert, consume less resources and do not respond to any events. The default value for this option is true, i.e. if the option is not specified, the marker will be clickable. (Since 2.50)
title String This string will appear as tooltip on the marker, i.e. it will work just as the title attribute on HTML elements. (Since 2.50)
draggable Boolean Toggles whether or not the marker will be draggable by users. Markers set up to be dragged require more resources to set up than markers that are clickable. Any marker that is draggable is also clickable and bouncy by default. The default value for this option is false. (Since 2.61)
bouncy Boolean Toggles whether or not the marker should bounce up and down after it finishes dragging. The default value for this option is false. (Since 2.61)
bounceGravity Number When finishing dragging, this number is used to define the acceleration rate of the marker during the bounce down to earth. The default value for this option is 1. (Since 2.61)

icon / clickable / title

e.g. var marker = new GMarker( point, {icon: myIcon, clickable:true, title:'テストです'});

例:http://never-ever.info/googlemaps/ve­r2/gmarkeroptions.html
マウスをマーカーの上に持って行ってください。タイトルプロパティがつけてあるので、文字が現れます。

titleの文字列に「\n」を書き込むと、IEでは改行、FFでは文字化け、Operaでは無視でした。

draggable marker

http://never-ever.info/googlemaps/ve­r2/draggablemarker.html
var marker = new GMarker( map.getCenter(), { draggable:true , bouncy:true , bounceGravity:0.7 } );
と設定しました。
bounceGravity は「1」がデフォルトです。1より小さくするとバウンドがゆっくりになり、1より大きいとすっとんと落ちます。「0.01」に設定するとマーカーの滞空時間がかなり長くなります。