我正在使用Yii Extension EGMap并且它运行良好。除了我无法获得动画标记。
尝试1:
$marker = new EGMapMarker($latitude, $longitude, array('title'=>'Your Location','icon'=>$icon, 'shadow'=>true, 'animation'=>'google.maps.Animation.BOUNCE'));
尝试2:
$marker->animation = 'google.maps.Animation.BOUNCE';
尝试3:
$marker = new EGMapMarker($latitude, $longitude, array('title'=>'Your Location','icon'=>$icon, 'shadow'=>true, 'animation'=>TRUE));
此外,如果有人使用过这个并知道如何使这个工作,另外还有一个"脉冲"那将是真棒。谢谢!
答案 0 :(得分:0)
'animation'=> EGMapMarker::BOUNCE
更详细: 提到 https://github.com/2amigos/egmap/blob/master/EGMapMarker.php
class EGMapMarker extends EGMapBase {
const DROP = 'google.maps.Animation.DROP';
const BOUNCE = 'google.maps.Animation.BOUNCE';
protected $options = array(...
/**
* Sets the animation to the marker when it is rendered to the map
* @param string $animation
*/
public function setAnimation( $animation=self::DROP )
{
if($animation==self::DROP || $animation==self::BOUNCE)
$this->options['animation'] = $animation;
else
$this->options['animation'] = self::DROP;
}
正确的语法应该是:
$marker = new EGMapMarker(
$latitude,
$longitude,
array(
'title' => 'Your Location',
'icon' => $icon,
'shadow' => true,
'animation' => EGMapMarker::BOUNCE
));
此变体有效:
Yii::import('ext.egmap.*');
$gMap = new EGMap();
$gMap->zoom = 10;
$gMap->setCenter(51.245475,6.821373);
$marker = new EGMapMarker(51.245475,6.821373,
array(
'title' => 'Your Location',
)
);
$marker->setAnimation(EGMapMarker::BOUNCE);
$gMap->addMarker($marker);
$gMap->renderMap();