-
-
Notifications
You must be signed in to change notification settings - Fork 315
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Map] add polyline support #2340
base: 2.x
Are you sure you want to change the base?
Conversation
📊 Packages dist files size differenceThanks for the PR! Here is the difference in size of the packages dist files between the base branch and the PR.
|
Hey, thanks a lot for this PR @sblondeau! Could you please add more info about this new feature to your PR description? Some screenshots, details and what you trying to achieve! Thannnnnks 😁 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the feature, I didn't even know that "polyline" existed :)
I've added some comments that must be resolved if we want to merge your work.
Also, a lot of CI checks are failing, can you take a look please? Thanks!
src/Map/doc/index.rst
Outdated
You can add Polylines, which represents a path made by a series of `Point` instances | ||
$myMap->addPolyline(new Polyline( | ||
points: [ | ||
new Point(48.8566, 2.3522), | ||
new Point(45.7640, 4.8357), | ||
new Point(43.2965, 5.3698), | ||
new Point(44.8378, -0.5792), | ||
], | ||
infoWindow: new InfoWindow( | ||
content: 'A line passing through Paris, Lyon, Marseille, Bordeaux', | ||
), | ||
)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you also move this section under Add Polygons
please? Thanks :)
You can add Polylines, which represents a path made by a series of `Point` instances | |
$myMap->addPolyline(new Polyline( | |
points: [ | |
new Point(48.8566, 2.3522), | |
new Point(45.7640, 4.8357), | |
new Point(43.2965, 5.3698), | |
new Point(44.8378, -0.5792), | |
], | |
infoWindow: new InfoWindow( | |
content: 'A line passing through Paris, Lyon, Marseille, Bordeaux', | |
), | |
)); | |
You can add Polylines, which represents a path made by a series of ``Point`` instances:: | |
$myMap->addPolyline(new Polyline( | |
points: [ | |
new Point(48.8566, 2.3522), | |
new Point(45.7640, 4.8357), | |
new Point(43.2965, 5.3698), | |
new Point(44.8378, -0.5792), | |
], | |
infoWindow: new InfoWindow( | |
content: 'A line passing through Paris, Lyon, Marseille, Bordeaux', | |
), | |
)); |
element.addListener('click', (event: any) => { | ||
if (definition.autoClose) { | ||
this.closeInfoWindowsExcept(infoWindow); | ||
} | ||
infoWindow.setPosition(event.latLng); | ||
infoWindow.open(this.map); | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like this logic is the same for Polygon, maybe we can merge the two blocks together?
src/Map/src/Twig/MapRuntime.php
Outdated
@@ -70,7 +76,7 @@ public function renderMap( | |||
|
|||
public function render(array $args = []): string | |||
{ | |||
$map = array_intersect_key($args, ['map' => 0, 'markers' => 0, 'polygons' => 0, 'center' => 1, 'zoom' => 2]); | |||
$map = array_intersect_key($args, ['map' => 0, 'markers' => 0, 'polygons' => 0, 'polylines' => 0, 'center' => 1, 'zoom' => 2]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think there is an issue here, I don't fully remember why it has been done like this, but values should be sequential 0, 1, 2, 3, 4, ...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need here, as it's then using named arguments with the spread.
But it's a good idea at least to prevent future errors if we change to some array_reverse :)
@@ -15,7 +15,7 @@ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR | |||
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR | |||
PERFORMANCE OF THIS SOFTWARE. | |||
***************************************************************************** */ | |||
/* global Reflect, Promise, SuppressedError, Symbol */ | |||
/* global Reflect, Promise, SuppressedError, Symbol, Iterator */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's revert this change (or see in another PR) to focus on one package :)
Hello, I tried a lot of things but some tests (js ans php) failed and I do not understand why :( |
Hi @sblondeau, where are stuck? Please ensure to rebase your branch from the latest yarn lint
yarn format
yarn workspaces foreach -Rp --from '{src/Map/assets,src/Map/src/Bridge/Google/assets,src/Map/src/Bridge/Leaflet/assets}' run build
yarn workspaces foreach -Rp --from '{src/Map/assets,src/Map/src/Bridge/Google/assets,src/Map/src/Bridge/Leaflet/assets}' run test Also, please start to squash your commits, we don't want to see commits Thanks! |
Add polyline support to Map for Leaflet and GoogleMap (useful e.g. for itinerary drawing)