Zooming in React Maps component
29 Aug 20233 minutes to read
The center position zooming can be achieved by using the centerPosition
and zoomFactor
properties as mentioned in the following example. The center position is used to configure the zoom level of Maps, and the zoom factor is used to specify the center position where the Maps should be displayed.
import { world_map } from 'world-map.ts';
import * as React from "react";
import * as ReactDOM from "react-dom";
import {
MapsComponent, LayersDirective, LayerDirective,
Inject, Zoom
} from '@syncfusion/ej2-react-maps';
export function App() {
return(
<MapsComponent zoomSettings={{
enable: false,
zoomFactor: 13
}} centerPosition={{
latitude: 25.54244147012483,
longitude: -89.62646484375
}} >
<Inject services={[Zoom]} />
<LayersDirective>
<LayerDirective shapeData={world_map}>
</LayerDirective>
</LayersDirective>
</MapsComponent>
);
}
const root = ReactDOM.createRoot(document.getElementById('container'));
root.render(<App />);
import { world_map } from 'world-map.ts';
import * as React from "react";
import * as ReactDOM from "react-dom";
import {
MapsComponent, LayersDirective, LayerDirective,
Inject, Zoom
} from '@syncfusion/ej2-react-maps';
export function App() {
return(
<MapsComponent zoomSettings={{
enable: false,
zoomFactor: 13
}} centerPosition={{
latitude: 25.54244147012483,
longitude: -89.62646484375
}} >
<Inject services={[Zoom]} />
<LayersDirective>
<LayerDirective shapeData={world_map}>
</LayerDirective>
</LayersDirective>
</MapsComponent>
);
}
const root = ReactDOM.createRoot(document.getElementById('container'));
root.render(<App />);