-
Notifications
You must be signed in to change notification settings - Fork 22
feat: map-block parameter for disable auto zoom #219
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
Conversation
|
Preview is ready. |
d3fce83 to
decb3f9
Compare
|
Some changes:
|
src/components/Map/GoogleMap.tsx
Outdated
| scriptSrc: string, | ||
| address: string, | ||
| lang: 'ru' | 'en', | ||
| zoom?: number, |
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.
to many serial params in function let's rewrite to object
src/components/Map/GoogleMap.tsx
Outdated
| apiKey: string, | ||
| scriptSrc: string, | ||
| address: string, | ||
| lang: 'ru' | 'en', |
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.
do we already had enum for Lang?
src/components/Map/Map.scss
Outdated
| overflow: hidden; | ||
| display: flex; | ||
|
|
||
| &_visible_no { |
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 we replace visible_no to hidden?
src/components/Map/YMap/YMap.ts
Outdated
| private recalcZoomAndCenter() { | ||
| private recalcZoomAndCenter(props: PlacemarksProps) { | ||
| const coordsLength = this.coords.length; | ||
| const {zoom} = props; |
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.
const {zoom=0} = props;
|
|
||
| if (zoom) { | ||
| // compute only the center | ||
| newMapParams.center = window.ymaps.util.bounds.getCenter([leftBottom, rightTop]); |
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 we get the situation when window.ymaps or window.ymaps.util or window.ymaps.util.bounds is undefined?
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.
- we create new Map after getting window.ymaps => we get to this place after getting window.ymaps
- util and util.bounds are always available
| const b = block('map'); | ||
| const DEFAULT_CONTAINER_ID = 'ymap'; | ||
| const DEFAULT_ZOOM = 9; | ||
| const DEFAULT_CENTER = [55.755864, 37.617698]; // will be calculated later |
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.
did't understand meaning of the comment
| {/* visible - to show the map after calculating the center */} | ||
| <div | ||
| id={containerId} | ||
| className={b({visible: ready ? 'yes' : 'no'})} |
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.
className={b({hidden: !Boolean(ready)})}
decb3f9 to
6f69963
Compare
6f69963 to
23de6cf
Compare
No description provided.