public function testRender() { $infoWindow = new InfoWindow(); $infoWindow->setPosition(1.1, 2.1, true); $infoWindow->getPosition()->setJavascriptVariable('position'); $infoWindow->setPixelOffset(3, 4, 'px', 'px'); $infoWindow->getPixelOffset()->setJavascriptVariable('pixel_offset'); $infoWindow->setContent('content'); $infoWindow->setOpen(true); $infoWindow->setOptions(array('option1' => 'value1', 'option2' => 'value2')); $expected = $infoWindow->getJavascriptVariable() . ' = new InfoBox({' . '"position":position,' . '"pixelOffset":pixel_offset,' . '"content":"content",' . '"option1":"value1",' . '"option2":"value2"' . '});' . PHP_EOL; $this->assertSame($expected, $this->infoBoxHelper->render($infoWindow, true)); }
public function testRenderOpenWithMarker() { $map = $this->getMock('Ivory\\GoogleMap\\Map'); $map->expects($this->once())->method('getJavascriptVariable')->will($this->returnValue('map')); $infoWindow = new InfoWindow(); $infoWindow->setJavascriptVariable('infoWindow'); $infoWindow->setPosition(1.1, 2.1, true); $infoWindow->setContent('content'); $infoWindow->setOpen(true); $infoWindow->setOptions(array('option1' => 'value1', 'option2' => 'value2')); $marker = $this->getMock('Ivory\\GoogleMap\\Overlays\\Marker'); $marker->expects($this->once())->method('getJavascriptVariable')->will($this->returnValue('marker')); $this->assertSame('infoWindow.open(map, marker);' . PHP_EOL, $this->infoWindowHelper->renderOpen($infoWindow, $map, $marker)); }
protected function getGoogleMapMarkerInfo($markerContent) { $infoWindow = new InfoWindow(); // Configure the info window options $infoWindow->setPrefixJavascriptVariable('info_window_'); $infoWindow->setPosition(0, 0, true); $infoWindow->setPixelOffset(1.1, 2.1, 'px', 'pt'); $infoWindow->setContent($markerContent); $infoWindow->setOpen(false); $infoWindow->setAutoOpen(true); $infoWindow->setOpenEvent(MouseEvent::CLICK); $infoWindow->setAutoClose(false); $infoWindow->setOption('disableAutoPan', true); $infoWindow->setOption('zIndex', 10); $infoWindow->setOptions(array('disableAutoPan' => true, 'zIndex' => 10)); return $infoWindow; }
/** * Crée une fenêtre d'information pour un marker * @param $fiche, la fiche pour laquelle il créer une fenêtre d'informations * @return InfoWindow * @throws \Ivory\GoogleMap\Exception\AssetException * @throws \Ivory\GoogleMap\Exception\OverlayException */ public function InfoWindowMarker($fiche) { $infoWindow = new InfoWindow(); $infoWindow->setPrefixJavascriptVariable('info_window_'); $infoWindow->setPosition($fiche->getLatitude(), $fiche->getLongitude(), true); $infoWindow->setPixelOffset(1.1, 2.1, 'px', 'pt'); $infoWindow->setOpen(false); $infoWindow->setAutoOpen(true); $infoWindow->setOpenEvent('mouseover'); $infoWindow->setAutoClose(true); $infoWindow->setOption('disableAutoPan', true); $infoWindow->setOptions(array('disableAutoPan' => true, 'zIndex' => 10)); return $infoWindow; }