You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

16 lines
398 B

import { toLngLat } from "../../utils";
import { Props } from "./";
export function useInit(props: Props, dom?: HTMLElement) {
const { mid, projection, minZoom, maxZoom, center, zoom } = props;
const instance = new T.Map(dom ?? mid, {
projection,
minZoom,
maxZoom,
center: toLngLat(center),
zoom
});
instance.centerAndZoom(toLngLat(center), zoom);
return instance;
}