Skip to content

Conversation

@Lakate
Copy link
Contributor

@Lakate Lakate commented Mar 16, 2023

No description provided.

@gravity-ui-bot
Copy link
Contributor

Preview is ready.

@Lakate Lakate force-pushed the lakate/map-disable-auto-zoom branch from d3fce83 to decb3f9 Compare March 21, 2023 12:15
@Lakate
Copy link
Contributor Author

Lakate commented Mar 21, 2023

Some changes:

  1. delete center from params - we always calculate it in the code. We show the Yandex map after calculating the center
  2. zoom - if you specify it in the parameters, we use it, if not, then we calculate it in the code

scriptSrc: string,
address: string,
lang: 'ru' | 'en',
zoom?: number,
Copy link
Contributor

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

apiKey: string,
scriptSrc: string,
address: string,
lang: 'ru' | 'en',
Copy link
Contributor

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?

overflow: hidden;
display: flex;

&_visible_no {
Copy link
Contributor

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?

private recalcZoomAndCenter() {
private recalcZoomAndCenter(props: PlacemarksProps) {
const coordsLength = this.coords.length;
const {zoom} = props;
Copy link
Contributor

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]);
Copy link
Contributor

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?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

  1. we create new Map after getting window.ymaps => we get to this place after getting window.ymaps
  2. 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
Copy link
Contributor

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'})}
Copy link
Contributor

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)})}

@Lakate Lakate force-pushed the lakate/map-disable-auto-zoom branch from decb3f9 to 6f69963 Compare March 23, 2023 08:08
@Lakate Lakate force-pushed the lakate/map-disable-auto-zoom branch from 6f69963 to 23de6cf Compare March 23, 2023 08:10
@Lakate Lakate merged commit d332844 into main Mar 23, 2023
@Lakate Lakate deleted the lakate/map-disable-auto-zoom branch March 23, 2023 09:08
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.

4 participants