Skip to content
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

RadarMap.fitToMarkers class method #156

Merged
merged 9 commits into from
May 15, 2024
Merged

RadarMap.fitToMarkers class method #156

merged 9 commits into from
May 15, 2024

Conversation

jaspk06
Copy link
Contributor

@jaspk06 jaspk06 commented Apr 10, 2024

NOTE: #153 needs to be reviewed first

single line function to adjust the bounds of a RadarMap to fit to all RadarMarker added to the map.

@jaspk06 jaspk06 changed the base branch from master to refactor-map-ui April 10, 2024 21:15
@jaspk06 jaspk06 mentioned this pull request May 6, 2024
@jaspk06 jaspk06 requested a review from kochis May 6, 2024 14:49
src/ui/RadarMap.ts Outdated Show resolved Hide resolved
markers.forEach(marker => {
bounds.extend(marker.getLngLat());
});
this.fitBounds(bounds, fitBoundsOptions);
Copy link
Collaborator

@kochis kochis May 11, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does this do if markers is empty? Also what's the deal with the animation options on this, do those need to be specified?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added a no-op if markers is empty. Yeah you can pass in animation options into fitBoundsOptions https://docs.mapbox.com/mapbox-gl-js/api/map/#map#fitbounds

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just do fitMarkers({animate: false}) to disable animations. it uses map.flyTo by default

@kochis kochis changed the base branch from refactor-map-ui to release-4.3 May 11, 2024 01:28
@kochis kochis changed the base branch from release-4.3 to refactor-map-ui May 11, 2024 01:28
@jaspk06 jaspk06 changed the base branch from refactor-map-ui to release-4.3 May 15, 2024 15:25
src/ui/RadarMap.ts Outdated Show resolved Hide resolved
- better handling of default fit to markers options
@jaspk06 jaspk06 merged commit b839008 into release-4.3 May 15, 2024
2 checks passed
kochis added a commit that referenced this pull request Jun 6, 2024
* Radar map UI kit refactor (#153)

* support custom style

* custom markers

* Maplibre control radar logo

* bump version

* refactor mapui kit by inheriting maplibre-gl

- bump tsconfig target from es2015->es2016 for compatibility with class inheritence

* pass request header override in map transformRequest

* version bump

* include custom style id in marker request

* new marker logic

* Delete .vscode directory

* add .vscode/ to .gitignore

* bump version

* bump version

* update transformRequest and add custom styles to demo page

* marker updates

* remove `getOptions` from `RadarMarker`

* better way to handle custom markers and image urls

* add custom url input to marker demo page

* compliation target changes and copy changes

* set beta version

---------

Co-authored-by: Craig Kochis <[email protected]>

* `RadarMap.fitToMarkers` class method (#156)

* Map initalization `language` param (#161)

* fix radar-default-v1 fallback regression

* bump version

* marker default width and height

* bump version

* `RadarMarker` popup improvements (#166)

* bump version

* Support click event on marker instance (#167)

* support click handlers on markers

* log map click

* force popup on click

* Update marker params (#168)

* update marker params

* handle popup.element

* bump maplibre version in peer deps (#169)

* img alt text

* bump version

* update dev version of maplibre-gl

* fix marker image width and height

* remove unused navigator

* update browserlist

* remove beta tag

* support number and string for marker width/height

* fix types

---------

Co-authored-by: Jason Liu <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants