File tree Expand file tree Collapse file tree 2 files changed +20
-1
lines changed
packages/maplibre/lib/map Expand file tree Collapse file tree 2 files changed +20
-1
lines changed Original file line number Diff line number Diff line change @@ -58,4 +58,23 @@ export async function applyContextDiffToMap(
5858 styleDiff . layers . map ( ( layer ) => map . addLayer ( layer ) ) ;
5959 } ) ;
6060 }
61+
62+ if ( typeof contextDiff . viewChanges !== "undefined" ) {
63+ const { viewChanges } = contextDiff ;
64+
65+ if ( viewChanges && "extent" in viewChanges ) {
66+ const { extent } = viewChanges ;
67+
68+ map . fitBounds (
69+ [
70+ [ extent [ 0 ] , extent [ 1 ] ] ,
71+ [ extent [ 2 ] , extent [ 3 ] ] ,
72+ ] ,
73+ {
74+ padding : 20 ,
75+ duration : 1000 ,
76+ } ,
77+ ) ;
78+ }
79+ }
6180}
Original file line number Diff line number Diff line change @@ -123,7 +123,7 @@ export async function createLayer(
123123 */
124124export async function createMapFromContext (
125125 context : MapContext ,
126- container : string | HTMLElement
126+ container : string | HTMLElement ,
127127) : Promise < Map > {
128128 const map = new Map ( {
129129 container,
You can’t perform that action at this time.
0 commit comments