プッシュピンの typeName プロパティを指定する正しい方向に進んでいます。おそらく既にご存じのとおり、typeName を に指定するpushpinStyle
と、作成された画鋲のクラスは になりpushpinStyle
ます。マップ上の画鋲の生成された html を調べると、画鋲のテキストが、<div>
画鋲内に絶対配置された子によってリアライズされていることがわかります<div>
。したがって、css を使用して画鋲のテキストをさらにスタイル設定するのが論理的です<div>
。たとえば、次のことができます。
.pushpinStyle div{
color: black !important; /*Make Pushpin text black*/
left: 5px !important; /*Since Pushpin text is absolutely positioned, this will cause the text to be 5 pixels from the left instead of 0 pixels */
text-shadow: 1px 0px white, -1px 0px white, 0px -1px white, 0px 1px white; /*Give the text all around white text shadow so it looks nice on browsers that support it*/
font: 12px arial,sans-serif; !important // override default fonts
}
これにより、画鋲のテキスト<div>
が上記のスタイルになります。もちろん、アプリケーションに合わせて独自のスタイルを追加することもできます。