maplibre-gl-components 0.18.2 → 0.19.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{ControlGrid-aiCMfRCs.cjs → ControlGrid-DupuKV5Y.cjs} +161 -159
- package/dist/{ControlGrid-DF9cqAs-.js → ControlGrid-fp9puHto.js} +5870 -5675
- package/dist/{DuckDBConverter-vGi-9-yB.js → DuckDBConverter-CSC3vznq.js} +1 -1
- package/dist/{DuckDBConverter-Y6NErH0b.cjs → DuckDBConverter-DR9Yi4J6.cjs} +1 -1
- package/dist/{ShapefileConverter-D7XctUfl.cjs → ShapefileConverter-4WtafFIM.cjs} +1 -1
- package/dist/{ShapefileConverter-CrlSFMFB.js → ShapefileConverter-C_e7sA_3.js} +1 -1
- package/dist/{geotiff-DFHxtBMv.js → geotiff-BGExAdHS.js} +2 -2
- package/dist/{geotiff-CcpsgthF.cjs → geotiff-tVCvoIHb.cjs} +2 -2
- package/dist/index.cjs +1 -1
- package/dist/index.mjs +3 -3
- package/dist/{lerc-CJ2wXXF6.js → lerc-DaFuRwi-.js} +1 -1
- package/dist/{lerc-rUC4YZ0e.cjs → lerc-DwpOBGIo.cjs} +1 -1
- package/dist/{maplibre-geoman.es-DUGKSxPP.cjs → maplibre-geoman.es-rA9eiVOA.cjs} +1 -1
- package/dist/maplibre-gl-components.css +1 -1
- package/dist/react.cjs +1 -1
- package/dist/react.mjs +1 -1
- package/dist/types/lib/core/BookmarkControl.d.ts.map +1 -1
- package/dist/types/lib/core/MeasureControl.d.ts.map +1 -1
- package/dist/types/lib/core/PrintControl.d.ts +106 -5
- package/dist/types/lib/core/PrintControl.d.ts.map +1 -1
- package/dist/types/lib/core/types.d.ts +92 -10
- package/dist/types/lib/core/types.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/react.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const C=require("./ControlGrid-aiCMfRCs.cjs");let r=require("react");function L({map:u,onStateChange:o,position:a="bottom-right",...e}){const l=(0,r.useRef)(null);return(0,r.useEffect)(()=>{if(!u)return;const c=new C.Colorbar({position:a,...e});return l.current=c,o&&(c.on("update",s=>{o(s.state)}),c.on("show",s=>{o(s.state)}),c.on("hide",s=>{o(s.state)})),u.addControl(c,a),()=>{u.hasControl(c)&&u.removeControl(c),l.current=null}},[u,a,o]),(0,r.useEffect)(()=>{if(l.current){const c=Object.fromEntries(Object.entries(e).filter(([,s])=>s!==void 0));Object.keys(c).length>0&&l.current.update(c)}},[e.colormap,e.colorbars,e.colorStops,e.vmin,e.vmax,e.label,e.units,e.visible,e.orientation,e.barThickness,e.barLength,e.backgroundColor,e.opacity,e.fontSize,e.fontColor,e.minzoom,e.maxzoom]),null}function M({map:u,onStateChange:o,position:a="bottom-left",...e}){const l=(0,r.useRef)(null);return(0,r.useEffect)(()=>{if(!u)return;const c=new C.Legend({position:a,...e});if(l.current=c,o){const s=t=>{o(t.state)};c.on("update",s),c.on("show",s),c.on("hide",s),c.on("collapse",s),c.on("expand",s)}return u.addControl(c,a),()=>{u.hasControl(c)&&u.removeControl(c),l.current=null}},[u]),(0,r.useEffect)(()=>{if(l.current){const c=Object.fromEntries(Object.entries(e).filter(([,s])=>s!==void 0));Object.keys(c).length>0&&l.current.update(c)}},[e.items,e.legends,e.title,e.visible,e.collapsed,e.collapsible,e.width,e.maxHeight,e.backgroundColor,e.opacity,e.fontSize,e.fontColor,e.swatchSize,e.minzoom,e.maxzoom]),null}function O({map:u,onStateChange:o,position:a="top-left",...e}){const l=(0,r.useRef)(null);return(0,r.useEffect)(()=>{if(!u)return;const c=new C.HtmlControl({position:a,...e});if(l.current=c,o){const s=t=>{o(t.state)};c.on("update",s),c.on("show",s),c.on("hide",s),c.on("expand",s),c.on("collapse",s)}return u.addControl(c,a),()=>{u.hasControl(c)&&u.removeControl(c),l.current=null}},[u,a,o]),(0,r.useEffect)(()=>{l.current&&e.html!==void 0&&l.current.setHtml(e.html)},[e.html]),(0,r.useEffect)(()=>{if(l.current){const c={};e.htmls!==void 0&&(c.htmls=e.htmls),e.visible!==void 0&&(c.visible=e.visible),e.title!==void 0&&(c.title=e.title),e.collapsible!==void 0&&(c.collapsible=e.collapsible),e.collapsed!==void 0&&(c.collapsed=e.collapsed),e.backgroundColor!==void 0&&(c.backgroundColor=e.backgroundColor),e.padding!==void 0&&(c.padding=e.padding),e.borderRadius!==void 0&&(c.borderRadius=e.borderRadius),e.opacity!==void 0&&(c.opacity=e.opacity),e.maxWidth!==void 0&&(c.maxWidth=e.maxWidth),e.maxHeight!==void 0&&(c.maxHeight=e.maxHeight),e.fontSize!==void 0&&(c.fontSize=e.fontSize),e.fontColor!==void 0&&(c.fontColor=e.fontColor),e.minzoom!==void 0&&(c.minzoom=e.minzoom),e.maxzoom!==void 0&&(c.maxzoom=e.maxzoom),Object.keys(c).length>0&&l.current.update(c)}},[e.visible,e.htmls,e.title,e.collapsible,e.collapsed,e.backgroundColor,e.padding,e.borderRadius,e.opacity,e.maxWidth,e.maxHeight,e.fontSize,e.fontColor,e.minzoom,e.maxzoom]),null}function S({map:u,onBasemapChange:o,onStateChange:a,position:e="top-right",...l}){const c=(0,r.useRef)(null);return(0,r.useEffect)(()=>{if(!u)return;const s=new C.BasemapControl({position:e,...l});if(c.current=s,a){const t=d=>{a(d.state)};s.on("update",t),s.on("show",t),s.on("hide",t),s.on("collapse",t),s.on("expand",t)}if(o){const t=d=>{d.basemap&&o(d.basemap)};s.on("basemapchange",t)}return u.addControl(s,e),()=>{u.hasControl(s)&&u.removeControl(s),c.current=null}},[u]),(0,r.useEffect)(()=>{if(c.current){const s=Object.fromEntries(Object.entries(l).filter(([,t])=>t!==void 0));Object.keys(s).length>0&&c.current.update(s)}},[l.basemaps,l.defaultBasemap,l.visible,l.collapsed,l.collapsible,l.displayMode,l.showSearch,l.filterGroups,l.excludeGroups,l.excludeBroken,l.backgroundColor,l.padding,l.borderRadius,l.opacity,l.maxWidth,l.maxHeight,l.fontSize,l.fontColor,l.minzoom,l.maxzoom]),null}function j({map:u,onTerrainChange:o,onStateChange:a,position:e="top-right",...l}){const c=(0,r.useRef)(null);return(0,r.useEffect)(()=>{if(!u)return;const s=new C.TerrainControl({position:e,...l});if(c.current=s,a){const t=d=>{a(d.state)};s.on("update",t),s.on("show",t),s.on("hide",t)}if(o){const t=d=>{o(d.state.enabled)};s.on("terrainchange",t)}return u.addControl(s,e),()=>{u.hasControl(s)&&u.removeControl(s),c.current=null}},[u]),(0,r.useEffect)(()=>{if(c.current){const s=Object.fromEntries(Object.entries(l).filter(([,t])=>t!==void 0));Object.keys(s).length>0&&c.current.update(s)}},[l.enabled,l.exaggeration,l.hillshade,l.hillshadeExaggeration,l.visible,l.backgroundColor,l.borderRadius,l.opacity,l.minzoom,l.maxzoom]),null}function A({map:u,onResultSelect:o,onStateChange:a,position:e="top-right",...l}){const c=(0,r.useRef)(null);return(0,r.useEffect)(()=>{if(!u)return;const s=new C.SearchControl({position:e,...l});if(c.current=s,a){const t=d=>{a(d.state)};s.on("update",t),s.on("show",t),s.on("hide",t),s.on("expand",t),s.on("collapse",t),s.on("search",t),s.on("clear",t)}return o&&s.on("resultselect",t=>{t.result&&o(t.result)}),u.addControl(s,e),()=>{u.hasControl(s)&&u.removeControl(s),c.current=null}},[u,e,a,o]),(0,r.useEffect)(()=>{if(c.current){const s={};l.visible!==void 0&&(s.visible=l.visible),l.collapsed!==void 0&&(s.collapsed=l.collapsed),l.placeholder!==void 0&&(s.placeholder=l.placeholder),l.maxResults!==void 0&&(s.maxResults=l.maxResults),l.flyToZoom!==void 0&&(s.flyToZoom=l.flyToZoom),l.showMarker!==void 0&&(s.showMarker=l.showMarker),l.markerColor!==void 0&&(s.markerColor=l.markerColor),l.backgroundColor!==void 0&&(s.backgroundColor=l.backgroundColor),l.borderRadius!==void 0&&(s.borderRadius=l.borderRadius),l.opacity!==void 0&&(s.opacity=l.opacity),l.width!==void 0&&(s.width=l.width),l.fontSize!==void 0&&(s.fontSize=l.fontSize),l.fontColor!==void 0&&(s.fontColor=l.fontColor),l.minzoom!==void 0&&(s.minzoom=l.minzoom),l.maxzoom!==void 0&&(s.maxzoom=l.maxzoom),Object.keys(s).length>0&&c.current.update(s)}},[l.visible,l.collapsed,l.placeholder,l.maxResults,l.flyToZoom,l.showMarker,l.markerColor,l.backgroundColor,l.borderRadius,l.opacity,l.width,l.fontSize,l.fontColor,l.minzoom,l.maxzoom]),null}function B({map:u,onDatasetLoad:o,onError:a,onStateChange:e,position:l="top-right",...c}){const s=(0,r.useRef)(null);return(0,r.useEffect)(()=>{if(!u)return;const t=new C.VectorDatasetControl({position:l,...c});if(s.current=t,e){const d=i=>{e(i.state)};t.on("update",d),t.on("show",d),t.on("hide",d)}if(o){const d=i=>{i.dataset&&o(i.dataset)};t.on("load",d)}if(a){const d=i=>{i.error&&a(i.error,i.filename)};t.on("error",d)}return u.addControl(t,l),()=>{u.hasControl(t)&&u.removeControl(t),s.current=null}},[u]),(0,r.useEffect)(()=>{if(s.current){const t=Object.fromEntries(Object.entries(c).filter(([,d])=>d!==void 0));Object.keys(t).length>0&&s.current.update(t)}},[c.visible,c.showDropZone,c.fitBounds,c.fitBoundsPadding,c.backgroundColor,c.borderRadius,c.opacity,c.minzoom,c.maxzoom]),null}function D({map:u,onFeatureSelect:o,onInspect:a,onToggle:e,onStateChange:l,position:c="top-right",...s}){const t=(0,r.useRef)(null);return(0,r.useEffect)(()=>{if(!u)return;const d=new C.InspectControl({position:c,...s});if(t.current=d,l){const i=n=>{l(n.state)};d.on("update",i),d.on("show",i),d.on("hide",i),d.on("enable",i),d.on("disable",i),d.on("clear",i)}return o&&d.on("featureselect",i=>{o(i.feature||null)}),a&&d.on("featureselect",i=>{i.features&&a(i.features)}),e&&(d.on("enable",()=>e(!0)),d.on("disable",()=>e(!1))),u.addControl(d,c),()=>{u.hasControl(d)&&u.removeControl(d),t.current=null}},[u,c,l,o,a,e]),(0,r.useEffect)(()=>{if(t.current){const d={};s.visible!==void 0&&(d.visible=s.visible),s.enabled!==void 0&&(d.enabled=s.enabled),s.maxFeatures!==void 0&&(d.maxFeatures=s.maxFeatures),s.showGeometryType!==void 0&&(d.showGeometryType=s.showGeometryType),s.showLayerName!==void 0&&(d.showLayerName=s.showLayerName),s.maxWidth!==void 0&&(d.maxWidth=s.maxWidth),s.maxHeight!==void 0&&(d.maxHeight=s.maxHeight),s.backgroundColor!==void 0&&(d.backgroundColor=s.backgroundColor),s.borderRadius!==void 0&&(d.borderRadius=s.borderRadius),s.opacity!==void 0&&(d.opacity=s.opacity),s.fontSize!==void 0&&(d.fontSize=s.fontSize),s.fontColor!==void 0&&(d.fontColor=s.fontColor),s.minzoom!==void 0&&(d.minzoom=s.minzoom),s.maxzoom!==void 0&&(d.maxzoom=s.maxzoom),Object.keys(d).length>0&&t.current.update(d)}},[s.visible,s.enabled,s.maxFeatures,s.showGeometryType,s.showLayerName,s.maxWidth,s.maxHeight,s.backgroundColor,s.borderRadius,s.opacity,s.fontSize,s.fontColor,s.minzoom,s.maxzoom]),null}function H({map:u,onBBoxDraw:o,onDrawingToggle:a,onStateChange:e,position:l="bottom-left",...c}){const s=(0,r.useRef)(null);return(0,r.useEffect)(()=>{if(!u)return;const t=new C.ViewStateControl({position:l,...c});if(s.current=t,e){const d=i=>{e(i.state)};t.on("update",d),t.on("show",d),t.on("hide",d),t.on("expand",d),t.on("collapse",d),t.on("viewchange",d)}return o&&t.on("bboxdraw",d=>{d.bbox&&o(d.bbox)}),a&&(t.on("drawstart",()=>a(!0)),t.on("drawend",()=>a(!1))),u.addControl(t,l),()=>{u.hasControl(t)&&u.removeControl(t),s.current=null}},[u,l,e,o,a]),(0,r.useEffect)(()=>{if(s.current){const t={};c.visible!==void 0&&(t.visible=c.visible),c.collapsed!==void 0&&(t.collapsed=c.collapsed),c.precision!==void 0&&(t.precision=c.precision),c.panelWidth!==void 0&&(t.panelWidth=c.panelWidth),c.backgroundColor!==void 0&&(t.backgroundColor=c.backgroundColor),c.borderRadius!==void 0&&(t.borderRadius=c.borderRadius),c.opacity!==void 0&&(t.opacity=c.opacity),c.fontSize!==void 0&&(t.fontSize=c.fontSize),c.fontColor!==void 0&&(t.fontColor=c.fontColor),c.minzoom!==void 0&&(t.minzoom=c.minzoom),c.maxzoom!==void 0&&(t.maxzoom=c.maxzoom),Object.keys(t).length>0&&s.current.update(t)}},[c.visible,c.collapsed,c.precision,c.panelWidth,c.backgroundColor,c.borderRadius,c.opacity,c.fontSize,c.fontColor,c.minzoom,c.maxzoom]),null}function I({map:u,onStateChange:o,position:a="top-right",controls:e=[],...l}){const c=(0,r.useRef)(null);return(0,r.useEffect)(()=>{if(!u)return;const s=new C.ControlGrid({position:a,...l,controls:[]});if(c.current=s,o){const t=d=>{o(d.state)};s.on("update",t),s.on("show",t),s.on("hide",t),s.on("expand",t),s.on("collapse",t)}return u.addControl(s,a),()=>{u.hasControl(s)&&u.removeControl(s),c.current=null}},[u,a,o]),(0,r.useEffect)(()=>{const s=c.current;if(!s)return;const t=s.getControls(),d=e;for(const i of d)t.includes(i)||s.addControl(i);for(const i of t)d.includes(i)||s.removeControl(i)},[e]),(0,r.useEffect)(()=>{const s=c.current;if(!s)return;const t={};l.visible!==void 0&&(t.visible=l.visible),l.collapsed!==void 0&&(t.collapsed=l.collapsed),l.title!==void 0&&(t.title=l.title),l.rows!==void 0&&(t.rows=l.rows),l.columns!==void 0&&(t.columns=l.columns),l.showRowColumnControls!==void 0&&(t.showRowColumnControls=l.showRowColumnControls),l.collapsible!==void 0&&(t.collapsible=l.collapsible),l.backgroundColor!==void 0&&(t.backgroundColor=l.backgroundColor),l.padding!==void 0&&(t.padding=l.padding),l.borderRadius!==void 0&&(t.borderRadius=l.borderRadius),l.opacity!==void 0&&(t.opacity=l.opacity),l.gap!==void 0&&(t.gap=l.gap),l.minzoom!==void 0&&(t.minzoom=l.minzoom),l.maxzoom!==void 0&&(t.maxzoom=l.maxzoom),Object.keys(t).length>0&&s.update(t)},[l.visible,l.collapsed,l.title,l.rows,l.columns,l.showRowColumnControls,l.collapsible,l.backgroundColor,l.padding,l.borderRadius,l.opacity,l.gap,l.minzoom,l.maxzoom]),null}function W({map:u,onLayerAdd:o,onLayerRemove:a,onLayerUpdate:e,onError:l,onStateChange:c,position:s="top-right",...t}){const d=(0,r.useRef)(null);return(0,r.useEffect)(()=>{if(!u)return;const i=new C.CogLayerControl({position:s,...t});if(d.current=i,c){const n=m=>{c(m.state)};i.on("update",n),i.on("show",n),i.on("hide",n),i.on("expand",n),i.on("collapse",n)}return o&&i.on("layeradd",n=>{n.url&&o(n.url)}),a&&i.on("layerremove",()=>{a()}),e&&i.on("layerupdate",n=>{n.url&&e(n.url)}),l&&i.on("error",n=>{n.error&&l(n.error)}),u.addControl(i,s),()=>{u.hasControl(i)&&u.removeControl(i),d.current=null}},[u]),(0,r.useEffect)(()=>{if(d.current){const i=Object.fromEntries(Object.entries(t).filter(([,n])=>n!==void 0));Object.keys(i).length>0&&d.current.update(i)}},[t.visible,t.collapsed,t.backgroundColor,t.borderRadius,t.opacity,t.panelWidth,t.fontSize,t.fontColor,t.minzoom,t.maxzoom]),null}function _({map:u,onStateChange:o,position:a="bottom-left",...e}){const l=(0,r.useRef)(null);return(0,r.useEffect)(()=>{if(!u)return;const c=new C.MinimapControl({position:a,...e});if(l.current=c,o){const s=t=>{o(t.state)};c.on("show",s),c.on("hide",s),c.on("expand",s),c.on("collapse",s)}return u.addControl(c,a),()=>{u.hasControl(c)&&u.removeControl(c),l.current=null}},[u]),null}var h={visible:!0,vmin:0,vmax:1,colormap:"viridis"};function G(u){const[o,a]=(0,r.useState)({...h,...u});return{state:o,setState:a,setVisible:(0,r.useCallback)(e=>{a(l=>({...l,visible:e}))},[]),setVmin:(0,r.useCallback)(e=>{a(l=>({...l,vmin:e}))},[]),setVmax:(0,r.useCallback)(e=>{a(l=>({...l,vmax:e}))},[]),setRange:(0,r.useCallback)((e,l)=>{a(c=>({...c,vmin:e,vmax:l}))},[]),setColormap:(0,r.useCallback)(e=>{a(l=>({...l,colormap:e}))},[]),show:(0,r.useCallback)(()=>{a(e=>({...e,visible:!0}))},[]),hide:(0,r.useCallback)(()=>{a(e=>({...e,visible:!1}))},[]),toggle:(0,r.useCallback)(()=>{a(e=>({...e,visible:!e.visible}))},[]),reset:(0,r.useCallback)(()=>{a({...h,...u})},[u])}}var k={visible:!0,collapsed:!1,items:[]};function U(u){const[o,a]=(0,r.useState)({...k,...u});return{state:o,setState:a,setVisible:(0,r.useCallback)(e=>{a(l=>({...l,visible:e}))},[]),setCollapsed:(0,r.useCallback)(e=>{a(l=>({...l,collapsed:e}))},[]),setItems:(0,r.useCallback)(e=>{a(l=>({...l,items:[...e]}))},[]),addItem:(0,r.useCallback)(e=>{a(l=>({...l,items:[...l.items,e]}))},[]),removeItem:(0,r.useCallback)(e=>{a(l=>({...l,items:l.items.filter(c=>c.label!==e)}))},[]),updateItem:(0,r.useCallback)((e,l)=>{a(c=>({...c,items:c.items.map(s=>s.label===e?{...s,...l}:s)}))},[]),show:(0,r.useCallback)(()=>{a(e=>({...e,visible:!0}))},[]),hide:(0,r.useCallback)(()=>{a(e=>({...e,visible:!1}))},[]),expand:(0,r.useCallback)(()=>{a(e=>({...e,collapsed:!1}))},[]),collapse:(0,r.useCallback)(()=>{a(e=>({...e,collapsed:!0}))},[]),toggle:(0,r.useCallback)(()=>{a(e=>({...e,collapsed:!e.collapsed}))},[]),toggleVisibility:(0,r.useCallback)(()=>{a(e=>({...e,visible:!e.visible}))},[]),reset:(0,r.useCallback)(()=>{a({...k,...u})},[u])}}var v={visible:!0,collapsed:!1,html:""};function $(u){const[o,a]=(0,r.useState)({...v,...u}),e=(0,r.useCallback)(d=>{a(i=>({...i,visible:d}))},[]),l=(0,r.useCallback)(d=>{a(i=>({...i,html:d}))},[]),c=(0,r.useCallback)(()=>{a(d=>({...d,visible:!0}))},[]),s=(0,r.useCallback)(()=>{a(d=>({...d,visible:!1}))},[]),t=(0,r.useCallback)(()=>{a(d=>({...d,visible:!d.visible}))},[]);return{state:o,setState:a,setVisible:e,setHtml:l,setCollapsed:(0,r.useCallback)(d=>{a(i=>({...i,collapsed:d}))},[]),show:c,hide:s,expand:(0,r.useCallback)(()=>{a(d=>({...d,collapsed:!1}))},[]),collapse:(0,r.useCallback)(()=>{a(d=>({...d,collapsed:!0}))},[]),toggle:(0,r.useCallback)(()=>{a(d=>({...d,collapsed:!d.collapsed}))},[]),toggleVisibility:t,reset:(0,r.useCallback)(()=>{a({...v,...u})},[u])}}var g={visible:!0,collapsed:!0,selectedBasemap:null,searchText:"",loading:!1,error:null,belowLabels:!1};function N(u){const[o,a]=(0,r.useState)({...g,...u});return{state:o,setState:a,setVisible:(0,r.useCallback)(e=>{a(l=>({...l,visible:e}))},[]),setCollapsed:(0,r.useCallback)(e=>{a(l=>({...l,collapsed:e}))},[]),setBasemap:(0,r.useCallback)(e=>{a(l=>({...l,selectedBasemap:e}))},[]),setSearch:(0,r.useCallback)(e=>{a(l=>({...l,searchText:e}))},[]),setLoading:(0,r.useCallback)(e=>{a(l=>({...l,loading:e}))},[]),setError:(0,r.useCallback)(e=>{a(l=>({...l,error:e}))},[]),setBelowLabels:(0,r.useCallback)(e=>{a(l=>({...l,belowLabels:e}))},[]),show:(0,r.useCallback)(()=>{a(e=>({...e,visible:!0}))},[]),hide:(0,r.useCallback)(()=>{a(e=>({...e,visible:!1}))},[]),expand:(0,r.useCallback)(()=>{a(e=>({...e,collapsed:!1}))},[]),collapse:(0,r.useCallback)(()=>{a(e=>({...e,collapsed:!0}))},[]),toggle:(0,r.useCallback)(()=>{a(e=>({...e,collapsed:!e.collapsed}))},[]),toggleVisibility:(0,r.useCallback)(()=>{a(e=>({...e,visible:!e.visible}))},[]),clearSearch:(0,r.useCallback)(()=>{a(e=>({...e,searchText:""}))},[]),reset:(0,r.useCallback)(()=>{a({...g,...u})},[u])}}var x={visible:!0,enabled:!1,exaggeration:1,hillshade:!0};function q(u){const[o,a]=(0,r.useState)({...x,...u});return{state:o,setState:a,setVisible:(0,r.useCallback)(e=>{a(l=>({...l,visible:e}))},[]),setEnabled:(0,r.useCallback)(e=>{a(l=>({...l,enabled:e}))},[]),setExaggeration:(0,r.useCallback)(e=>{const l=Math.max(.1,Math.min(10,e));a(c=>({...c,exaggeration:l}))},[]),setHillshade:(0,r.useCallback)(e=>{a(l=>({...l,hillshade:e}))},[]),enable:(0,r.useCallback)(()=>{a(e=>({...e,enabled:!0}))},[]),disable:(0,r.useCallback)(()=>{a(e=>({...e,enabled:!1}))},[]),toggle:(0,r.useCallback)(()=>{a(e=>({...e,enabled:!e.enabled}))},[]),show:(0,r.useCallback)(()=>{a(e=>({...e,visible:!0}))},[]),hide:(0,r.useCallback)(()=>{a(e=>({...e,visible:!1}))},[]),toggleVisibility:(0,r.useCallback)(()=>{a(e=>({...e,visible:!e.visible}))},[]),enableHillshade:(0,r.useCallback)(()=>{a(e=>({...e,hillshade:!0}))},[]),disableHillshade:(0,r.useCallback)(()=>{a(e=>({...e,hillshade:!1}))},[]),toggleHillshade:(0,r.useCallback)(()=>{a(e=>({...e,hillshade:!e.hillshade}))},[]),reset:(0,r.useCallback)(()=>{a({...x,...u})},[u])}}var R={visible:!0,collapsed:!0,query:"",results:[],loading:!1,selectedResult:null,error:null};function Z(u){const[o,a]=(0,r.useState)({...R,...u}),e=(0,r.useCallback)(b=>{a(f=>({...f,visible:b}))},[]),l=(0,r.useCallback)(b=>{a(f=>({...f,collapsed:b}))},[]),c=(0,r.useCallback)(b=>{a(f=>({...f,query:b}))},[]),s=(0,r.useCallback)(b=>{a(f=>({...f,results:b}))},[]),t=(0,r.useCallback)(b=>{a(f=>({...f,loading:b}))},[]),d=(0,r.useCallback)(b=>{a(f=>({...f,selectedResult:b}))},[]),i=(0,r.useCallback)(b=>{a(f=>({...f,error:b}))},[]),n=(0,r.useCallback)(()=>{a(b=>({...b,visible:!0}))},[]),m=(0,r.useCallback)(()=>{a(b=>({...b,visible:!1}))},[]),V=(0,r.useCallback)(()=>{a(b=>({...b,visible:!b.visible}))},[]);return{state:o,setState:a,setVisible:e,setCollapsed:l,setQuery:c,setResults:s,setLoading:t,selectResult:d,setError:i,show:n,hide:m,expand:(0,r.useCallback)(()=>{a(b=>({...b,collapsed:!1}))},[]),collapse:(0,r.useCallback)(()=>{a(b=>({...b,collapsed:!0,results:[]}))},[]),toggle:(0,r.useCallback)(()=>{a(b=>({...b,collapsed:!b.collapsed,results:b.collapsed?b.results:[]}))},[]),toggleVisibility:V,clear:(0,r.useCallback)(()=>{a(b=>({...b,query:"",results:[],selectedResult:null,error:null}))},[]),reset:(0,r.useCallback)(()=>{a({...R,...u})},[u])}}var w={visible:!0,isDragging:!1,isLoading:!1,loadedDatasets:[],error:null};function P(u){const[o,a]=(0,r.useState)({...w,...u});return{state:o,setState:a,setVisible:(0,r.useCallback)(e=>{a(l=>({...l,visible:e}))},[]),show:(0,r.useCallback)(()=>{a(e=>({...e,visible:!0}))},[]),hide:(0,r.useCallback)(()=>{a(e=>({...e,visible:!1}))},[]),toggleVisibility:(0,r.useCallback)(()=>{a(e=>({...e,visible:!e.visible}))},[]),addDataset:(0,r.useCallback)(e=>{a(l=>({...l,loadedDatasets:[...l.loadedDatasets,e],error:null}))},[]),removeDataset:(0,r.useCallback)(e=>{a(l=>({...l,loadedDatasets:l.loadedDatasets.filter(c=>c.id!==e)}))},[]),clearAll:(0,r.useCallback)(()=>{a(e=>({...e,loadedDatasets:[]}))},[]),setError:(0,r.useCallback)(e=>{a(l=>({...l,error:e}))},[]),clearError:(0,r.useCallback)(()=>{a(e=>({...e,error:null}))},[]),reset:(0,r.useCallback)(()=>{a({...w,...u})},[u])}}var y={visible:!0,enabled:!1,inspectedFeatures:[],selectedIndex:0,error:null};function Q(u){const[o,a]=(0,r.useState)({...y,...u});return{state:o,setState:a,setVisible:(0,r.useCallback)(e=>{a(l=>({...l,visible:e}))},[]),setEnabled:(0,r.useCallback)(e=>{a(l=>({...l,enabled:e}))},[]),enable:(0,r.useCallback)(()=>{a(e=>({...e,enabled:!0}))},[]),disable:(0,r.useCallback)(()=>{a(e=>({...e,enabled:!1,inspectedFeatures:[],selectedIndex:0}))},[]),toggle:(0,r.useCallback)(()=>{a(e=>({...e,enabled:!e.enabled,inspectedFeatures:e.enabled?[]:e.inspectedFeatures,selectedIndex:e.enabled?0:e.selectedIndex}))},[]),setInspectedFeatures:(0,r.useCallback)(e=>{a(l=>({...l,inspectedFeatures:e,selectedIndex:0}))},[]),selectFeature:(0,r.useCallback)(e=>{a(l=>({...l,selectedIndex:Math.max(0,Math.min(e,l.inspectedFeatures.length-1))}))},[]),nextFeature:(0,r.useCallback)(()=>{a(e=>e.inspectedFeatures.length<=1?e:{...e,selectedIndex:(e.selectedIndex+1)%e.inspectedFeatures.length})},[]),previousFeature:(0,r.useCallback)(()=>{a(e=>e.inspectedFeatures.length<=1?e:{...e,selectedIndex:e.selectedIndex===0?e.inspectedFeatures.length-1:e.selectedIndex-1})},[]),clear:(0,r.useCallback)(()=>{a(e=>({...e,inspectedFeatures:[],selectedIndex:0,error:null}))},[]),setError:(0,r.useCallback)(e=>{a(l=>({...l,error:e}))},[]),show:(0,r.useCallback)(()=>{a(e=>({...e,visible:!0}))},[]),hide:(0,r.useCallback)(()=>{a(e=>({...e,visible:!1}))},[]),reset:(0,r.useCallback)(()=>{a({...y,...u})},[u]),currentFeature:o.inspectedFeatures[o.selectedIndex]||null,featureCount:o.inspectedFeatures.length}}var z={visible:!0,collapsed:!0,center:[0,0],bounds:[0,0,0,0],zoom:0,pitch:0,bearing:0,drawingBBox:!1,drawnBBox:null};function J(u){const[o,a]=(0,r.useState)({...z,...u});return{state:o,setState:a,setVisible:(0,r.useCallback)(e=>{a(l=>({...l,visible:e}))},[]),setCollapsed:(0,r.useCallback)(e=>{a(l=>({...l,collapsed:e}))},[]),expand:(0,r.useCallback)(()=>{a(e=>({...e,collapsed:!1}))},[]),collapse:(0,r.useCallback)(()=>{a(e=>({...e,collapsed:!0}))},[]),toggle:(0,r.useCallback)(()=>{a(e=>({...e,collapsed:!e.collapsed}))},[]),setDrawingBBox:(0,r.useCallback)(e=>{a(l=>({...l,drawingBBox:e}))},[]),setDrawnBBox:(0,r.useCallback)(e=>{a(l=>({...l,drawnBBox:e}))},[]),clearBBox:(0,r.useCallback)(()=>{a(e=>({...e,drawnBBox:null,drawingBBox:!1}))},[]),show:(0,r.useCallback)(()=>{a(e=>({...e,visible:!0}))},[]),hide:(0,r.useCallback)(()=>{a(e=>({...e,visible:!1}))},[]),reset:(0,r.useCallback)(()=>{a({...z,...u})},[u])}}var E={visible:!0,collapsed:!1,rows:2,columns:2};function K(u){const[o,a]=(0,r.useState)({...E,...u});return{state:o,setState:a,setVisible:(0,r.useCallback)(e=>{a(l=>({...l,visible:e}))},[]),setCollapsed:(0,r.useCallback)(e=>{a(l=>({...l,collapsed:e}))},[]),setRows:(0,r.useCallback)(e=>{a(l=>({...l,rows:Math.max(1,Math.min(12,Math.round(e)))}))},[]),setColumns:(0,r.useCallback)(e=>{a(l=>({...l,columns:Math.max(1,Math.min(12,Math.round(e)))}))},[]),expand:(0,r.useCallback)(()=>{a(e=>({...e,collapsed:!1}))},[]),collapse:(0,r.useCallback)(()=>{a(e=>({...e,collapsed:!0}))},[]),toggle:(0,r.useCallback)(()=>{a(e=>({...e,collapsed:!e.collapsed}))},[]),show:(0,r.useCallback)(()=>{a(e=>({...e,visible:!0}))},[]),hide:(0,r.useCallback)(()=>{a(e=>({...e,visible:!1}))},[]),reset:(0,r.useCallback)(()=>{a({...E,...u})},[u])}}var T={visible:!0,collapsed:!0,url:"",bands:"1",colormap:"viridis",rescaleMin:0,rescaleMax:255,nodata:void 0,layerOpacity:1,pickable:!0,hasLayer:!1,layerCount:0,layers:[],loading:!1,error:null,status:null,layerName:""};function X(u){const[o,a]=(0,r.useState)({...T,...u});return{state:o,setState:a,setVisible:(0,r.useCallback)(e=>{a(l=>({...l,visible:e}))},[]),setCollapsed:(0,r.useCallback)(e=>{a(l=>({...l,collapsed:e}))},[]),setUrl:(0,r.useCallback)(e=>{a(l=>({...l,url:e}))},[]),setBands:(0,r.useCallback)(e=>{a(l=>({...l,bands:e}))},[]),setColormap:(0,r.useCallback)(e=>{a(l=>({...l,colormap:e}))},[]),setRescaleMin:(0,r.useCallback)(e=>{a(l=>({...l,rescaleMin:e}))},[]),setRescaleMax:(0,r.useCallback)(e=>{a(l=>({...l,rescaleMax:e}))},[]),setNodata:(0,r.useCallback)(e=>{a(l=>({...l,nodata:e}))},[]),setOpacity:(0,r.useCallback)(e=>{const l=Math.max(0,Math.min(1,e));a(c=>({...c,layerOpacity:l}))},[]),show:(0,r.useCallback)(()=>{a(e=>({...e,visible:!0}))},[]),hide:(0,r.useCallback)(()=>{a(e=>({...e,visible:!1}))},[]),expand:(0,r.useCallback)(()=>{a(e=>({...e,collapsed:!1}))},[]),collapse:(0,r.useCallback)(()=>{a(e=>({...e,collapsed:!0}))},[]),toggleVisibility:(0,r.useCallback)(()=>{a(e=>({...e,visible:!e.visible}))},[]),togglePanel:(0,r.useCallback)(()=>{a(e=>({...e,collapsed:!e.collapsed}))},[]),reset:(0,r.useCallback)(()=>{a({...T,...u})},[u])}}var F={visible:!0,collapsed:!1};function Y(u){const[o,a]=(0,r.useState)({...F,...u});return{state:o,setState:a,setVisible:(0,r.useCallback)(e=>{a(l=>({...l,visible:e}))},[]),setCollapsed:(0,r.useCallback)(e=>{a(l=>({...l,collapsed:e}))},[]),show:(0,r.useCallback)(()=>{a(e=>({...e,visible:!0}))},[]),hide:(0,r.useCallback)(()=>{a(e=>({...e,visible:!1}))},[]),expand:(0,r.useCallback)(()=>{a(e=>({...e,collapsed:!1}))},[]),collapse:(0,r.useCallback)(()=>{a(e=>({...e,collapsed:!0}))},[]),toggle:(0,r.useCallback)(()=>{a(e=>({...e,collapsed:!e.collapsed}))},[]),reset:(0,r.useCallback)(()=>{a({...F,...u})},[u])}}exports.BasemapReact=S;exports.CogLayerReact=W;exports.ColorbarReact=L;exports.ControlGridReact=I;exports.HtmlControlReact=O;exports.InspectControlReact=D;exports.LegendReact=M;exports.MinimapControlReact=_;exports.SearchControlReact=A;exports.TerrainReact=j;exports.VectorDatasetReact=B;exports.ViewStateControlReact=H;exports.useBasemap=N;exports.useCogLayer=X;exports.useColorbar=G;exports.useControlGrid=K;exports.useHtmlControl=$;exports.useInspectControl=Q;exports.useLegend=U;exports.useMinimapControl=Y;exports.useSearchControl=Z;exports.useTerrain=q;exports.useVectorDataset=P;exports.useViewState=J;
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const C=require("./ControlGrid-DupuKV5Y.cjs");let r=require("react");function L({map:u,onStateChange:o,position:a="bottom-right",...e}){const l=(0,r.useRef)(null);return(0,r.useEffect)(()=>{if(!u)return;const c=new C.Colorbar({position:a,...e});return l.current=c,o&&(c.on("update",s=>{o(s.state)}),c.on("show",s=>{o(s.state)}),c.on("hide",s=>{o(s.state)})),u.addControl(c,a),()=>{u.hasControl(c)&&u.removeControl(c),l.current=null}},[u,a,o]),(0,r.useEffect)(()=>{if(l.current){const c=Object.fromEntries(Object.entries(e).filter(([,s])=>s!==void 0));Object.keys(c).length>0&&l.current.update(c)}},[e.colormap,e.colorbars,e.colorStops,e.vmin,e.vmax,e.label,e.units,e.visible,e.orientation,e.barThickness,e.barLength,e.backgroundColor,e.opacity,e.fontSize,e.fontColor,e.minzoom,e.maxzoom]),null}function M({map:u,onStateChange:o,position:a="bottom-left",...e}){const l=(0,r.useRef)(null);return(0,r.useEffect)(()=>{if(!u)return;const c=new C.Legend({position:a,...e});if(l.current=c,o){const s=t=>{o(t.state)};c.on("update",s),c.on("show",s),c.on("hide",s),c.on("collapse",s),c.on("expand",s)}return u.addControl(c,a),()=>{u.hasControl(c)&&u.removeControl(c),l.current=null}},[u]),(0,r.useEffect)(()=>{if(l.current){const c=Object.fromEntries(Object.entries(e).filter(([,s])=>s!==void 0));Object.keys(c).length>0&&l.current.update(c)}},[e.items,e.legends,e.title,e.visible,e.collapsed,e.collapsible,e.width,e.maxHeight,e.backgroundColor,e.opacity,e.fontSize,e.fontColor,e.swatchSize,e.minzoom,e.maxzoom]),null}function O({map:u,onStateChange:o,position:a="top-left",...e}){const l=(0,r.useRef)(null);return(0,r.useEffect)(()=>{if(!u)return;const c=new C.HtmlControl({position:a,...e});if(l.current=c,o){const s=t=>{o(t.state)};c.on("update",s),c.on("show",s),c.on("hide",s),c.on("expand",s),c.on("collapse",s)}return u.addControl(c,a),()=>{u.hasControl(c)&&u.removeControl(c),l.current=null}},[u,a,o]),(0,r.useEffect)(()=>{l.current&&e.html!==void 0&&l.current.setHtml(e.html)},[e.html]),(0,r.useEffect)(()=>{if(l.current){const c={};e.htmls!==void 0&&(c.htmls=e.htmls),e.visible!==void 0&&(c.visible=e.visible),e.title!==void 0&&(c.title=e.title),e.collapsible!==void 0&&(c.collapsible=e.collapsible),e.collapsed!==void 0&&(c.collapsed=e.collapsed),e.backgroundColor!==void 0&&(c.backgroundColor=e.backgroundColor),e.padding!==void 0&&(c.padding=e.padding),e.borderRadius!==void 0&&(c.borderRadius=e.borderRadius),e.opacity!==void 0&&(c.opacity=e.opacity),e.maxWidth!==void 0&&(c.maxWidth=e.maxWidth),e.maxHeight!==void 0&&(c.maxHeight=e.maxHeight),e.fontSize!==void 0&&(c.fontSize=e.fontSize),e.fontColor!==void 0&&(c.fontColor=e.fontColor),e.minzoom!==void 0&&(c.minzoom=e.minzoom),e.maxzoom!==void 0&&(c.maxzoom=e.maxzoom),Object.keys(c).length>0&&l.current.update(c)}},[e.visible,e.htmls,e.title,e.collapsible,e.collapsed,e.backgroundColor,e.padding,e.borderRadius,e.opacity,e.maxWidth,e.maxHeight,e.fontSize,e.fontColor,e.minzoom,e.maxzoom]),null}function S({map:u,onBasemapChange:o,onStateChange:a,position:e="top-right",...l}){const c=(0,r.useRef)(null);return(0,r.useEffect)(()=>{if(!u)return;const s=new C.BasemapControl({position:e,...l});if(c.current=s,a){const t=d=>{a(d.state)};s.on("update",t),s.on("show",t),s.on("hide",t),s.on("collapse",t),s.on("expand",t)}if(o){const t=d=>{d.basemap&&o(d.basemap)};s.on("basemapchange",t)}return u.addControl(s,e),()=>{u.hasControl(s)&&u.removeControl(s),c.current=null}},[u]),(0,r.useEffect)(()=>{if(c.current){const s=Object.fromEntries(Object.entries(l).filter(([,t])=>t!==void 0));Object.keys(s).length>0&&c.current.update(s)}},[l.basemaps,l.defaultBasemap,l.visible,l.collapsed,l.collapsible,l.displayMode,l.showSearch,l.filterGroups,l.excludeGroups,l.excludeBroken,l.backgroundColor,l.padding,l.borderRadius,l.opacity,l.maxWidth,l.maxHeight,l.fontSize,l.fontColor,l.minzoom,l.maxzoom]),null}function j({map:u,onTerrainChange:o,onStateChange:a,position:e="top-right",...l}){const c=(0,r.useRef)(null);return(0,r.useEffect)(()=>{if(!u)return;const s=new C.TerrainControl({position:e,...l});if(c.current=s,a){const t=d=>{a(d.state)};s.on("update",t),s.on("show",t),s.on("hide",t)}if(o){const t=d=>{o(d.state.enabled)};s.on("terrainchange",t)}return u.addControl(s,e),()=>{u.hasControl(s)&&u.removeControl(s),c.current=null}},[u]),(0,r.useEffect)(()=>{if(c.current){const s=Object.fromEntries(Object.entries(l).filter(([,t])=>t!==void 0));Object.keys(s).length>0&&c.current.update(s)}},[l.enabled,l.exaggeration,l.hillshade,l.hillshadeExaggeration,l.visible,l.backgroundColor,l.borderRadius,l.opacity,l.minzoom,l.maxzoom]),null}function A({map:u,onResultSelect:o,onStateChange:a,position:e="top-right",...l}){const c=(0,r.useRef)(null);return(0,r.useEffect)(()=>{if(!u)return;const s=new C.SearchControl({position:e,...l});if(c.current=s,a){const t=d=>{a(d.state)};s.on("update",t),s.on("show",t),s.on("hide",t),s.on("expand",t),s.on("collapse",t),s.on("search",t),s.on("clear",t)}return o&&s.on("resultselect",t=>{t.result&&o(t.result)}),u.addControl(s,e),()=>{u.hasControl(s)&&u.removeControl(s),c.current=null}},[u,e,a,o]),(0,r.useEffect)(()=>{if(c.current){const s={};l.visible!==void 0&&(s.visible=l.visible),l.collapsed!==void 0&&(s.collapsed=l.collapsed),l.placeholder!==void 0&&(s.placeholder=l.placeholder),l.maxResults!==void 0&&(s.maxResults=l.maxResults),l.flyToZoom!==void 0&&(s.flyToZoom=l.flyToZoom),l.showMarker!==void 0&&(s.showMarker=l.showMarker),l.markerColor!==void 0&&(s.markerColor=l.markerColor),l.backgroundColor!==void 0&&(s.backgroundColor=l.backgroundColor),l.borderRadius!==void 0&&(s.borderRadius=l.borderRadius),l.opacity!==void 0&&(s.opacity=l.opacity),l.width!==void 0&&(s.width=l.width),l.fontSize!==void 0&&(s.fontSize=l.fontSize),l.fontColor!==void 0&&(s.fontColor=l.fontColor),l.minzoom!==void 0&&(s.minzoom=l.minzoom),l.maxzoom!==void 0&&(s.maxzoom=l.maxzoom),Object.keys(s).length>0&&c.current.update(s)}},[l.visible,l.collapsed,l.placeholder,l.maxResults,l.flyToZoom,l.showMarker,l.markerColor,l.backgroundColor,l.borderRadius,l.opacity,l.width,l.fontSize,l.fontColor,l.minzoom,l.maxzoom]),null}function B({map:u,onDatasetLoad:o,onError:a,onStateChange:e,position:l="top-right",...c}){const s=(0,r.useRef)(null);return(0,r.useEffect)(()=>{if(!u)return;const t=new C.VectorDatasetControl({position:l,...c});if(s.current=t,e){const d=i=>{e(i.state)};t.on("update",d),t.on("show",d),t.on("hide",d)}if(o){const d=i=>{i.dataset&&o(i.dataset)};t.on("load",d)}if(a){const d=i=>{i.error&&a(i.error,i.filename)};t.on("error",d)}return u.addControl(t,l),()=>{u.hasControl(t)&&u.removeControl(t),s.current=null}},[u]),(0,r.useEffect)(()=>{if(s.current){const t=Object.fromEntries(Object.entries(c).filter(([,d])=>d!==void 0));Object.keys(t).length>0&&s.current.update(t)}},[c.visible,c.showDropZone,c.fitBounds,c.fitBoundsPadding,c.backgroundColor,c.borderRadius,c.opacity,c.minzoom,c.maxzoom]),null}function D({map:u,onFeatureSelect:o,onInspect:a,onToggle:e,onStateChange:l,position:c="top-right",...s}){const t=(0,r.useRef)(null);return(0,r.useEffect)(()=>{if(!u)return;const d=new C.InspectControl({position:c,...s});if(t.current=d,l){const i=n=>{l(n.state)};d.on("update",i),d.on("show",i),d.on("hide",i),d.on("enable",i),d.on("disable",i),d.on("clear",i)}return o&&d.on("featureselect",i=>{o(i.feature||null)}),a&&d.on("featureselect",i=>{i.features&&a(i.features)}),e&&(d.on("enable",()=>e(!0)),d.on("disable",()=>e(!1))),u.addControl(d,c),()=>{u.hasControl(d)&&u.removeControl(d),t.current=null}},[u,c,l,o,a,e]),(0,r.useEffect)(()=>{if(t.current){const d={};s.visible!==void 0&&(d.visible=s.visible),s.enabled!==void 0&&(d.enabled=s.enabled),s.maxFeatures!==void 0&&(d.maxFeatures=s.maxFeatures),s.showGeometryType!==void 0&&(d.showGeometryType=s.showGeometryType),s.showLayerName!==void 0&&(d.showLayerName=s.showLayerName),s.maxWidth!==void 0&&(d.maxWidth=s.maxWidth),s.maxHeight!==void 0&&(d.maxHeight=s.maxHeight),s.backgroundColor!==void 0&&(d.backgroundColor=s.backgroundColor),s.borderRadius!==void 0&&(d.borderRadius=s.borderRadius),s.opacity!==void 0&&(d.opacity=s.opacity),s.fontSize!==void 0&&(d.fontSize=s.fontSize),s.fontColor!==void 0&&(d.fontColor=s.fontColor),s.minzoom!==void 0&&(d.minzoom=s.minzoom),s.maxzoom!==void 0&&(d.maxzoom=s.maxzoom),Object.keys(d).length>0&&t.current.update(d)}},[s.visible,s.enabled,s.maxFeatures,s.showGeometryType,s.showLayerName,s.maxWidth,s.maxHeight,s.backgroundColor,s.borderRadius,s.opacity,s.fontSize,s.fontColor,s.minzoom,s.maxzoom]),null}function H({map:u,onBBoxDraw:o,onDrawingToggle:a,onStateChange:e,position:l="bottom-left",...c}){const s=(0,r.useRef)(null);return(0,r.useEffect)(()=>{if(!u)return;const t=new C.ViewStateControl({position:l,...c});if(s.current=t,e){const d=i=>{e(i.state)};t.on("update",d),t.on("show",d),t.on("hide",d),t.on("expand",d),t.on("collapse",d),t.on("viewchange",d)}return o&&t.on("bboxdraw",d=>{d.bbox&&o(d.bbox)}),a&&(t.on("drawstart",()=>a(!0)),t.on("drawend",()=>a(!1))),u.addControl(t,l),()=>{u.hasControl(t)&&u.removeControl(t),s.current=null}},[u,l,e,o,a]),(0,r.useEffect)(()=>{if(s.current){const t={};c.visible!==void 0&&(t.visible=c.visible),c.collapsed!==void 0&&(t.collapsed=c.collapsed),c.precision!==void 0&&(t.precision=c.precision),c.panelWidth!==void 0&&(t.panelWidth=c.panelWidth),c.backgroundColor!==void 0&&(t.backgroundColor=c.backgroundColor),c.borderRadius!==void 0&&(t.borderRadius=c.borderRadius),c.opacity!==void 0&&(t.opacity=c.opacity),c.fontSize!==void 0&&(t.fontSize=c.fontSize),c.fontColor!==void 0&&(t.fontColor=c.fontColor),c.minzoom!==void 0&&(t.minzoom=c.minzoom),c.maxzoom!==void 0&&(t.maxzoom=c.maxzoom),Object.keys(t).length>0&&s.current.update(t)}},[c.visible,c.collapsed,c.precision,c.panelWidth,c.backgroundColor,c.borderRadius,c.opacity,c.fontSize,c.fontColor,c.minzoom,c.maxzoom]),null}function I({map:u,onStateChange:o,position:a="top-right",controls:e=[],...l}){const c=(0,r.useRef)(null);return(0,r.useEffect)(()=>{if(!u)return;const s=new C.ControlGrid({position:a,...l,controls:[]});if(c.current=s,o){const t=d=>{o(d.state)};s.on("update",t),s.on("show",t),s.on("hide",t),s.on("expand",t),s.on("collapse",t)}return u.addControl(s,a),()=>{u.hasControl(s)&&u.removeControl(s),c.current=null}},[u,a,o]),(0,r.useEffect)(()=>{const s=c.current;if(!s)return;const t=s.getControls(),d=e;for(const i of d)t.includes(i)||s.addControl(i);for(const i of t)d.includes(i)||s.removeControl(i)},[e]),(0,r.useEffect)(()=>{const s=c.current;if(!s)return;const t={};l.visible!==void 0&&(t.visible=l.visible),l.collapsed!==void 0&&(t.collapsed=l.collapsed),l.title!==void 0&&(t.title=l.title),l.rows!==void 0&&(t.rows=l.rows),l.columns!==void 0&&(t.columns=l.columns),l.showRowColumnControls!==void 0&&(t.showRowColumnControls=l.showRowColumnControls),l.collapsible!==void 0&&(t.collapsible=l.collapsible),l.backgroundColor!==void 0&&(t.backgroundColor=l.backgroundColor),l.padding!==void 0&&(t.padding=l.padding),l.borderRadius!==void 0&&(t.borderRadius=l.borderRadius),l.opacity!==void 0&&(t.opacity=l.opacity),l.gap!==void 0&&(t.gap=l.gap),l.minzoom!==void 0&&(t.minzoom=l.minzoom),l.maxzoom!==void 0&&(t.maxzoom=l.maxzoom),Object.keys(t).length>0&&s.update(t)},[l.visible,l.collapsed,l.title,l.rows,l.columns,l.showRowColumnControls,l.collapsible,l.backgroundColor,l.padding,l.borderRadius,l.opacity,l.gap,l.minzoom,l.maxzoom]),null}function W({map:u,onLayerAdd:o,onLayerRemove:a,onLayerUpdate:e,onError:l,onStateChange:c,position:s="top-right",...t}){const d=(0,r.useRef)(null);return(0,r.useEffect)(()=>{if(!u)return;const i=new C.CogLayerControl({position:s,...t});if(d.current=i,c){const n=m=>{c(m.state)};i.on("update",n),i.on("show",n),i.on("hide",n),i.on("expand",n),i.on("collapse",n)}return o&&i.on("layeradd",n=>{n.url&&o(n.url)}),a&&i.on("layerremove",()=>{a()}),e&&i.on("layerupdate",n=>{n.url&&e(n.url)}),l&&i.on("error",n=>{n.error&&l(n.error)}),u.addControl(i,s),()=>{u.hasControl(i)&&u.removeControl(i),d.current=null}},[u]),(0,r.useEffect)(()=>{if(d.current){const i=Object.fromEntries(Object.entries(t).filter(([,n])=>n!==void 0));Object.keys(i).length>0&&d.current.update(i)}},[t.visible,t.collapsed,t.backgroundColor,t.borderRadius,t.opacity,t.panelWidth,t.fontSize,t.fontColor,t.minzoom,t.maxzoom]),null}function _({map:u,onStateChange:o,position:a="bottom-left",...e}){const l=(0,r.useRef)(null);return(0,r.useEffect)(()=>{if(!u)return;const c=new C.MinimapControl({position:a,...e});if(l.current=c,o){const s=t=>{o(t.state)};c.on("show",s),c.on("hide",s),c.on("expand",s),c.on("collapse",s)}return u.addControl(c,a),()=>{u.hasControl(c)&&u.removeControl(c),l.current=null}},[u]),null}var h={visible:!0,vmin:0,vmax:1,colormap:"viridis"};function G(u){const[o,a]=(0,r.useState)({...h,...u});return{state:o,setState:a,setVisible:(0,r.useCallback)(e=>{a(l=>({...l,visible:e}))},[]),setVmin:(0,r.useCallback)(e=>{a(l=>({...l,vmin:e}))},[]),setVmax:(0,r.useCallback)(e=>{a(l=>({...l,vmax:e}))},[]),setRange:(0,r.useCallback)((e,l)=>{a(c=>({...c,vmin:e,vmax:l}))},[]),setColormap:(0,r.useCallback)(e=>{a(l=>({...l,colormap:e}))},[]),show:(0,r.useCallback)(()=>{a(e=>({...e,visible:!0}))},[]),hide:(0,r.useCallback)(()=>{a(e=>({...e,visible:!1}))},[]),toggle:(0,r.useCallback)(()=>{a(e=>({...e,visible:!e.visible}))},[]),reset:(0,r.useCallback)(()=>{a({...h,...u})},[u])}}var k={visible:!0,collapsed:!1,items:[]};function U(u){const[o,a]=(0,r.useState)({...k,...u});return{state:o,setState:a,setVisible:(0,r.useCallback)(e=>{a(l=>({...l,visible:e}))},[]),setCollapsed:(0,r.useCallback)(e=>{a(l=>({...l,collapsed:e}))},[]),setItems:(0,r.useCallback)(e=>{a(l=>({...l,items:[...e]}))},[]),addItem:(0,r.useCallback)(e=>{a(l=>({...l,items:[...l.items,e]}))},[]),removeItem:(0,r.useCallback)(e=>{a(l=>({...l,items:l.items.filter(c=>c.label!==e)}))},[]),updateItem:(0,r.useCallback)((e,l)=>{a(c=>({...c,items:c.items.map(s=>s.label===e?{...s,...l}:s)}))},[]),show:(0,r.useCallback)(()=>{a(e=>({...e,visible:!0}))},[]),hide:(0,r.useCallback)(()=>{a(e=>({...e,visible:!1}))},[]),expand:(0,r.useCallback)(()=>{a(e=>({...e,collapsed:!1}))},[]),collapse:(0,r.useCallback)(()=>{a(e=>({...e,collapsed:!0}))},[]),toggle:(0,r.useCallback)(()=>{a(e=>({...e,collapsed:!e.collapsed}))},[]),toggleVisibility:(0,r.useCallback)(()=>{a(e=>({...e,visible:!e.visible}))},[]),reset:(0,r.useCallback)(()=>{a({...k,...u})},[u])}}var v={visible:!0,collapsed:!1,html:""};function $(u){const[o,a]=(0,r.useState)({...v,...u}),e=(0,r.useCallback)(d=>{a(i=>({...i,visible:d}))},[]),l=(0,r.useCallback)(d=>{a(i=>({...i,html:d}))},[]),c=(0,r.useCallback)(()=>{a(d=>({...d,visible:!0}))},[]),s=(0,r.useCallback)(()=>{a(d=>({...d,visible:!1}))},[]),t=(0,r.useCallback)(()=>{a(d=>({...d,visible:!d.visible}))},[]);return{state:o,setState:a,setVisible:e,setHtml:l,setCollapsed:(0,r.useCallback)(d=>{a(i=>({...i,collapsed:d}))},[]),show:c,hide:s,expand:(0,r.useCallback)(()=>{a(d=>({...d,collapsed:!1}))},[]),collapse:(0,r.useCallback)(()=>{a(d=>({...d,collapsed:!0}))},[]),toggle:(0,r.useCallback)(()=>{a(d=>({...d,collapsed:!d.collapsed}))},[]),toggleVisibility:t,reset:(0,r.useCallback)(()=>{a({...v,...u})},[u])}}var g={visible:!0,collapsed:!0,selectedBasemap:null,searchText:"",loading:!1,error:null,belowLabels:!1};function N(u){const[o,a]=(0,r.useState)({...g,...u});return{state:o,setState:a,setVisible:(0,r.useCallback)(e=>{a(l=>({...l,visible:e}))},[]),setCollapsed:(0,r.useCallback)(e=>{a(l=>({...l,collapsed:e}))},[]),setBasemap:(0,r.useCallback)(e=>{a(l=>({...l,selectedBasemap:e}))},[]),setSearch:(0,r.useCallback)(e=>{a(l=>({...l,searchText:e}))},[]),setLoading:(0,r.useCallback)(e=>{a(l=>({...l,loading:e}))},[]),setError:(0,r.useCallback)(e=>{a(l=>({...l,error:e}))},[]),setBelowLabels:(0,r.useCallback)(e=>{a(l=>({...l,belowLabels:e}))},[]),show:(0,r.useCallback)(()=>{a(e=>({...e,visible:!0}))},[]),hide:(0,r.useCallback)(()=>{a(e=>({...e,visible:!1}))},[]),expand:(0,r.useCallback)(()=>{a(e=>({...e,collapsed:!1}))},[]),collapse:(0,r.useCallback)(()=>{a(e=>({...e,collapsed:!0}))},[]),toggle:(0,r.useCallback)(()=>{a(e=>({...e,collapsed:!e.collapsed}))},[]),toggleVisibility:(0,r.useCallback)(()=>{a(e=>({...e,visible:!e.visible}))},[]),clearSearch:(0,r.useCallback)(()=>{a(e=>({...e,searchText:""}))},[]),reset:(0,r.useCallback)(()=>{a({...g,...u})},[u])}}var x={visible:!0,enabled:!1,exaggeration:1,hillshade:!0};function q(u){const[o,a]=(0,r.useState)({...x,...u});return{state:o,setState:a,setVisible:(0,r.useCallback)(e=>{a(l=>({...l,visible:e}))},[]),setEnabled:(0,r.useCallback)(e=>{a(l=>({...l,enabled:e}))},[]),setExaggeration:(0,r.useCallback)(e=>{const l=Math.max(.1,Math.min(10,e));a(c=>({...c,exaggeration:l}))},[]),setHillshade:(0,r.useCallback)(e=>{a(l=>({...l,hillshade:e}))},[]),enable:(0,r.useCallback)(()=>{a(e=>({...e,enabled:!0}))},[]),disable:(0,r.useCallback)(()=>{a(e=>({...e,enabled:!1}))},[]),toggle:(0,r.useCallback)(()=>{a(e=>({...e,enabled:!e.enabled}))},[]),show:(0,r.useCallback)(()=>{a(e=>({...e,visible:!0}))},[]),hide:(0,r.useCallback)(()=>{a(e=>({...e,visible:!1}))},[]),toggleVisibility:(0,r.useCallback)(()=>{a(e=>({...e,visible:!e.visible}))},[]),enableHillshade:(0,r.useCallback)(()=>{a(e=>({...e,hillshade:!0}))},[]),disableHillshade:(0,r.useCallback)(()=>{a(e=>({...e,hillshade:!1}))},[]),toggleHillshade:(0,r.useCallback)(()=>{a(e=>({...e,hillshade:!e.hillshade}))},[]),reset:(0,r.useCallback)(()=>{a({...x,...u})},[u])}}var R={visible:!0,collapsed:!0,query:"",results:[],loading:!1,selectedResult:null,error:null};function Z(u){const[o,a]=(0,r.useState)({...R,...u}),e=(0,r.useCallback)(b=>{a(f=>({...f,visible:b}))},[]),l=(0,r.useCallback)(b=>{a(f=>({...f,collapsed:b}))},[]),c=(0,r.useCallback)(b=>{a(f=>({...f,query:b}))},[]),s=(0,r.useCallback)(b=>{a(f=>({...f,results:b}))},[]),t=(0,r.useCallback)(b=>{a(f=>({...f,loading:b}))},[]),d=(0,r.useCallback)(b=>{a(f=>({...f,selectedResult:b}))},[]),i=(0,r.useCallback)(b=>{a(f=>({...f,error:b}))},[]),n=(0,r.useCallback)(()=>{a(b=>({...b,visible:!0}))},[]),m=(0,r.useCallback)(()=>{a(b=>({...b,visible:!1}))},[]),V=(0,r.useCallback)(()=>{a(b=>({...b,visible:!b.visible}))},[]);return{state:o,setState:a,setVisible:e,setCollapsed:l,setQuery:c,setResults:s,setLoading:t,selectResult:d,setError:i,show:n,hide:m,expand:(0,r.useCallback)(()=>{a(b=>({...b,collapsed:!1}))},[]),collapse:(0,r.useCallback)(()=>{a(b=>({...b,collapsed:!0,results:[]}))},[]),toggle:(0,r.useCallback)(()=>{a(b=>({...b,collapsed:!b.collapsed,results:b.collapsed?b.results:[]}))},[]),toggleVisibility:V,clear:(0,r.useCallback)(()=>{a(b=>({...b,query:"",results:[],selectedResult:null,error:null}))},[]),reset:(0,r.useCallback)(()=>{a({...R,...u})},[u])}}var w={visible:!0,isDragging:!1,isLoading:!1,loadedDatasets:[],error:null};function P(u){const[o,a]=(0,r.useState)({...w,...u});return{state:o,setState:a,setVisible:(0,r.useCallback)(e=>{a(l=>({...l,visible:e}))},[]),show:(0,r.useCallback)(()=>{a(e=>({...e,visible:!0}))},[]),hide:(0,r.useCallback)(()=>{a(e=>({...e,visible:!1}))},[]),toggleVisibility:(0,r.useCallback)(()=>{a(e=>({...e,visible:!e.visible}))},[]),addDataset:(0,r.useCallback)(e=>{a(l=>({...l,loadedDatasets:[...l.loadedDatasets,e],error:null}))},[]),removeDataset:(0,r.useCallback)(e=>{a(l=>({...l,loadedDatasets:l.loadedDatasets.filter(c=>c.id!==e)}))},[]),clearAll:(0,r.useCallback)(()=>{a(e=>({...e,loadedDatasets:[]}))},[]),setError:(0,r.useCallback)(e=>{a(l=>({...l,error:e}))},[]),clearError:(0,r.useCallback)(()=>{a(e=>({...e,error:null}))},[]),reset:(0,r.useCallback)(()=>{a({...w,...u})},[u])}}var y={visible:!0,enabled:!1,inspectedFeatures:[],selectedIndex:0,error:null};function Q(u){const[o,a]=(0,r.useState)({...y,...u});return{state:o,setState:a,setVisible:(0,r.useCallback)(e=>{a(l=>({...l,visible:e}))},[]),setEnabled:(0,r.useCallback)(e=>{a(l=>({...l,enabled:e}))},[]),enable:(0,r.useCallback)(()=>{a(e=>({...e,enabled:!0}))},[]),disable:(0,r.useCallback)(()=>{a(e=>({...e,enabled:!1,inspectedFeatures:[],selectedIndex:0}))},[]),toggle:(0,r.useCallback)(()=>{a(e=>({...e,enabled:!e.enabled,inspectedFeatures:e.enabled?[]:e.inspectedFeatures,selectedIndex:e.enabled?0:e.selectedIndex}))},[]),setInspectedFeatures:(0,r.useCallback)(e=>{a(l=>({...l,inspectedFeatures:e,selectedIndex:0}))},[]),selectFeature:(0,r.useCallback)(e=>{a(l=>({...l,selectedIndex:Math.max(0,Math.min(e,l.inspectedFeatures.length-1))}))},[]),nextFeature:(0,r.useCallback)(()=>{a(e=>e.inspectedFeatures.length<=1?e:{...e,selectedIndex:(e.selectedIndex+1)%e.inspectedFeatures.length})},[]),previousFeature:(0,r.useCallback)(()=>{a(e=>e.inspectedFeatures.length<=1?e:{...e,selectedIndex:e.selectedIndex===0?e.inspectedFeatures.length-1:e.selectedIndex-1})},[]),clear:(0,r.useCallback)(()=>{a(e=>({...e,inspectedFeatures:[],selectedIndex:0,error:null}))},[]),setError:(0,r.useCallback)(e=>{a(l=>({...l,error:e}))},[]),show:(0,r.useCallback)(()=>{a(e=>({...e,visible:!0}))},[]),hide:(0,r.useCallback)(()=>{a(e=>({...e,visible:!1}))},[]),reset:(0,r.useCallback)(()=>{a({...y,...u})},[u]),currentFeature:o.inspectedFeatures[o.selectedIndex]||null,featureCount:o.inspectedFeatures.length}}var z={visible:!0,collapsed:!0,center:[0,0],bounds:[0,0,0,0],zoom:0,pitch:0,bearing:0,drawingBBox:!1,drawnBBox:null};function J(u){const[o,a]=(0,r.useState)({...z,...u});return{state:o,setState:a,setVisible:(0,r.useCallback)(e=>{a(l=>({...l,visible:e}))},[]),setCollapsed:(0,r.useCallback)(e=>{a(l=>({...l,collapsed:e}))},[]),expand:(0,r.useCallback)(()=>{a(e=>({...e,collapsed:!1}))},[]),collapse:(0,r.useCallback)(()=>{a(e=>({...e,collapsed:!0}))},[]),toggle:(0,r.useCallback)(()=>{a(e=>({...e,collapsed:!e.collapsed}))},[]),setDrawingBBox:(0,r.useCallback)(e=>{a(l=>({...l,drawingBBox:e}))},[]),setDrawnBBox:(0,r.useCallback)(e=>{a(l=>({...l,drawnBBox:e}))},[]),clearBBox:(0,r.useCallback)(()=>{a(e=>({...e,drawnBBox:null,drawingBBox:!1}))},[]),show:(0,r.useCallback)(()=>{a(e=>({...e,visible:!0}))},[]),hide:(0,r.useCallback)(()=>{a(e=>({...e,visible:!1}))},[]),reset:(0,r.useCallback)(()=>{a({...z,...u})},[u])}}var E={visible:!0,collapsed:!1,rows:2,columns:2};function K(u){const[o,a]=(0,r.useState)({...E,...u});return{state:o,setState:a,setVisible:(0,r.useCallback)(e=>{a(l=>({...l,visible:e}))},[]),setCollapsed:(0,r.useCallback)(e=>{a(l=>({...l,collapsed:e}))},[]),setRows:(0,r.useCallback)(e=>{a(l=>({...l,rows:Math.max(1,Math.min(12,Math.round(e)))}))},[]),setColumns:(0,r.useCallback)(e=>{a(l=>({...l,columns:Math.max(1,Math.min(12,Math.round(e)))}))},[]),expand:(0,r.useCallback)(()=>{a(e=>({...e,collapsed:!1}))},[]),collapse:(0,r.useCallback)(()=>{a(e=>({...e,collapsed:!0}))},[]),toggle:(0,r.useCallback)(()=>{a(e=>({...e,collapsed:!e.collapsed}))},[]),show:(0,r.useCallback)(()=>{a(e=>({...e,visible:!0}))},[]),hide:(0,r.useCallback)(()=>{a(e=>({...e,visible:!1}))},[]),reset:(0,r.useCallback)(()=>{a({...E,...u})},[u])}}var T={visible:!0,collapsed:!0,url:"",bands:"1",colormap:"viridis",rescaleMin:0,rescaleMax:255,nodata:void 0,layerOpacity:1,pickable:!0,hasLayer:!1,layerCount:0,layers:[],loading:!1,error:null,status:null,layerName:""};function X(u){const[o,a]=(0,r.useState)({...T,...u});return{state:o,setState:a,setVisible:(0,r.useCallback)(e=>{a(l=>({...l,visible:e}))},[]),setCollapsed:(0,r.useCallback)(e=>{a(l=>({...l,collapsed:e}))},[]),setUrl:(0,r.useCallback)(e=>{a(l=>({...l,url:e}))},[]),setBands:(0,r.useCallback)(e=>{a(l=>({...l,bands:e}))},[]),setColormap:(0,r.useCallback)(e=>{a(l=>({...l,colormap:e}))},[]),setRescaleMin:(0,r.useCallback)(e=>{a(l=>({...l,rescaleMin:e}))},[]),setRescaleMax:(0,r.useCallback)(e=>{a(l=>({...l,rescaleMax:e}))},[]),setNodata:(0,r.useCallback)(e=>{a(l=>({...l,nodata:e}))},[]),setOpacity:(0,r.useCallback)(e=>{const l=Math.max(0,Math.min(1,e));a(c=>({...c,layerOpacity:l}))},[]),show:(0,r.useCallback)(()=>{a(e=>({...e,visible:!0}))},[]),hide:(0,r.useCallback)(()=>{a(e=>({...e,visible:!1}))},[]),expand:(0,r.useCallback)(()=>{a(e=>({...e,collapsed:!1}))},[]),collapse:(0,r.useCallback)(()=>{a(e=>({...e,collapsed:!0}))},[]),toggleVisibility:(0,r.useCallback)(()=>{a(e=>({...e,visible:!e.visible}))},[]),togglePanel:(0,r.useCallback)(()=>{a(e=>({...e,collapsed:!e.collapsed}))},[]),reset:(0,r.useCallback)(()=>{a({...T,...u})},[u])}}var F={visible:!0,collapsed:!1};function Y(u){const[o,a]=(0,r.useState)({...F,...u});return{state:o,setState:a,setVisible:(0,r.useCallback)(e=>{a(l=>({...l,visible:e}))},[]),setCollapsed:(0,r.useCallback)(e=>{a(l=>({...l,collapsed:e}))},[]),show:(0,r.useCallback)(()=>{a(e=>({...e,visible:!0}))},[]),hide:(0,r.useCallback)(()=>{a(e=>({...e,visible:!1}))},[]),expand:(0,r.useCallback)(()=>{a(e=>({...e,collapsed:!1}))},[]),collapse:(0,r.useCallback)(()=>{a(e=>({...e,collapsed:!0}))},[]),toggle:(0,r.useCallback)(()=>{a(e=>({...e,collapsed:!e.collapsed}))},[]),reset:(0,r.useCallback)(()=>{a({...F,...u})},[u])}}exports.BasemapReact=S;exports.CogLayerReact=W;exports.ColorbarReact=L;exports.ControlGridReact=I;exports.HtmlControlReact=O;exports.InspectControlReact=D;exports.LegendReact=M;exports.MinimapControlReact=_;exports.SearchControlReact=A;exports.TerrainReact=j;exports.VectorDatasetReact=B;exports.ViewStateControlReact=H;exports.useBasemap=N;exports.useCogLayer=X;exports.useColorbar=G;exports.useControlGrid=K;exports.useHtmlControl=$;exports.useInspectControl=Q;exports.useLegend=U;exports.useMinimapControl=Y;exports.useSearchControl=Z;exports.useTerrain=q;exports.useVectorDataset=P;exports.useViewState=J;
|
package/dist/react.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { F as A, I as M, L as j, N as B, P as D, dt as I, ft as H, ht as W, mt as U, pt as _, t as $, ut as G } from "./ControlGrid-
|
|
1
|
+
import { F as A, I as M, L as j, N as B, P as D, dt as I, ft as H, ht as W, mt as U, pt as _, t as $, ut as G } from "./ControlGrid-fp9puHto.js";
|
|
2
2
|
import { useCallback as d, useEffect as f, useRef as h, useState as v } from "react";
|
|
3
3
|
function Z({ map: s, onStateChange: u, position: r = "bottom-right", ...e }) {
|
|
4
4
|
const l = h(null);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BookmarkControl.d.ts","sourceRoot":"","sources":["../../../../src/lib/core/BookmarkControl.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;AAC9B,OAAO,gCAAgC,CAAC;AACxC,OAAO,KAA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AEG;IACH,OAAO,CAAC,aAAa;IAoDrB;;OAEG;IACH,OAAO,CAAC,YAAY;IAwBpB;;OAEG;IACH,OAAO,CAAC,YAAY;IAapB;;OAEG;IACH,OAAO,CAAC,gBAAgB;IAWxB;;OAEG;IACH,OAAO,CAAC,cAAc;IAwCtB;;OAEG;IACH,OAAO,CAAC,cAAc;IAqBtB;;OAEG;IACH,OAAO,CAAC,kBAAkB;IAwB1B;;OAEG;IACH,OAAO,CAAC,aAAa;IA4CrB;;OAEG;IACH,OAAO,CAAC,kBAAkB;IAwE1B;;OAEG;IACH,OAAO,CAAC,UAAU;IA6BlB;;OAEG;IACH,OAAO,CAAC,aAAa;IAKrB;;OAEG;IACH,OAAO,CAAC,uBAAuB;IAkD/B;;OAEG;IACH,OAAO,CAAC,kBAAkB;IAoB1B;;OAEG;IACH,OAAO,CAAC,SAAS;IAsBjB;;OAEG;IACH,OAAO,CAAC,iBAAiB;IAuBzB;;OAEG;IACH,IAAI,IAAI,IAAI;IASZ;;OAEG;IACH,IAAI,IAAI,IAAI;IASZ;;OAEG;IACH,QAAQ,IAAI,mBAAmB;IAI/B;;OAEG;IACH,eAAe,IAAI,WAAW,EAAE;IAIhC;;OAEG;IACH,OAAO,CAAC,IAAI,EAAE,WAAW,GAAG,IAAI;IAKhC;;OAEG;IACH,eAAe,CAAC,IAAI,EAAE,YAAY,GAAG,IAAI;IAQzC;;OAEG;IACH,WAAW,CAAC,IAAI,EAAE,QAAQ,GAAG,IAAI;IAQjC;;OAEG;IACH,KAAK,IAAI,IAAI;CAId"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { IControl, Map as MapLibreMap, ControlPosition } from 'maplibre-gl';
|
|
2
|
-
import { PrintControlOptions, PrintControlState, PrintEvent, PrintEventHandler, PrintColorbarConfig } from './types';
|
|
2
|
+
import { PrintControlOptions, PrintControlState, PrintEvent, PrintEventHandler, PrintColorbarConfig, PrintPageSize, PrintOrientation, PrintFitMode, PrintFormat } from './types';
|
|
3
3
|
/**
|
|
4
4
|
* A control for exporting the current map view as an image.
|
|
5
5
|
*
|
|
@@ -47,6 +47,12 @@ export declare class PrintControl implements IControl {
|
|
|
47
47
|
private _widthInput?;
|
|
48
48
|
private _heightInput?;
|
|
49
49
|
private _customSizeInputs?;
|
|
50
|
+
private _pageSizeSelect?;
|
|
51
|
+
private _orientationSelect?;
|
|
52
|
+
private _dpiSelect?;
|
|
53
|
+
private _marginInput?;
|
|
54
|
+
private _fitModeSelect?;
|
|
55
|
+
private _pageBackgroundInput?;
|
|
50
56
|
private _exportBtn?;
|
|
51
57
|
private _copyBtn?;
|
|
52
58
|
private _feedbackEl?;
|
|
@@ -86,18 +92,99 @@ export declare class PrintControl implements IControl {
|
|
|
86
92
|
* Create the panel content.
|
|
87
93
|
*/
|
|
88
94
|
private _createPanel;
|
|
95
|
+
/**
|
|
96
|
+
* Create a labeled field wrapping a control element.
|
|
97
|
+
*/
|
|
98
|
+
private _makeField;
|
|
99
|
+
/**
|
|
100
|
+
* Create a styled select element from value/label option pairs.
|
|
101
|
+
*/
|
|
102
|
+
private _makeSelect;
|
|
103
|
+
/**
|
|
104
|
+
* Normalize a color string to a 6-digit hex value usable by `<input type="color">`.
|
|
105
|
+
*/
|
|
106
|
+
private _toHexColor;
|
|
107
|
+
/**
|
|
108
|
+
* Create the page options section (size, orientation, DPI, margin, fit, background).
|
|
109
|
+
*/
|
|
110
|
+
private _createPageOptions;
|
|
111
|
+
/**
|
|
112
|
+
* Disable page options that have no effect in the legacy 'fit' page mode.
|
|
113
|
+
*/
|
|
114
|
+
private _updatePageOptionsDisabled;
|
|
89
115
|
/**
|
|
90
116
|
* Toggle quality field visibility based on format.
|
|
91
117
|
*/
|
|
92
118
|
private _updateQualityVisibility;
|
|
93
119
|
/**
|
|
94
|
-
* Toggle copy button visibility (hidden for
|
|
120
|
+
* Toggle copy button visibility (hidden for vector/document formats).
|
|
95
121
|
*/
|
|
96
122
|
private _updateCopyBtnVisibility;
|
|
97
123
|
/**
|
|
98
|
-
*
|
|
124
|
+
* Resolve the DPI used for physical sizing (PDF points, SVG inches, raster
|
|
125
|
+
* metadata). `dpi` is ignored in the legacy `'fit'` page mode, so a fixed
|
|
126
|
+
* 96 DPI is used there to keep that output deterministic.
|
|
127
|
+
*
|
|
128
|
+
* @returns The effective dots-per-inch.
|
|
129
|
+
*/
|
|
130
|
+
private _effectiveDpi;
|
|
131
|
+
/**
|
|
132
|
+
* Export the canvas to a PDF file using jspdf. The composed canvas already
|
|
133
|
+
* represents the full page (page size, margins, and overlays baked in), so
|
|
134
|
+
* the PDF page is sized to match and the image fills it edge to edge.
|
|
135
|
+
*
|
|
136
|
+
* @param canvas - The composed export canvas.
|
|
99
137
|
*/
|
|
100
138
|
private _exportPdf;
|
|
139
|
+
/**
|
|
140
|
+
* Export the canvas to an SVG file. The rendered page is embedded as a
|
|
141
|
+
* base64 PNG `<image>` sized to the page dimensions. A WebGL map cannot be
|
|
142
|
+
* reconstructed as true vectors, so the map content remains raster.
|
|
143
|
+
*
|
|
144
|
+
* @param canvas - The composed export canvas.
|
|
145
|
+
*/
|
|
146
|
+
private _exportSvg;
|
|
147
|
+
/**
|
|
148
|
+
* Compute a PNG/zlib CRC-32 over the given bytes.
|
|
149
|
+
*
|
|
150
|
+
* @param bytes - The bytes to checksum.
|
|
151
|
+
* @returns The unsigned 32-bit CRC.
|
|
152
|
+
*/
|
|
153
|
+
private _crc32;
|
|
154
|
+
/**
|
|
155
|
+
* Insert a `pHYs` chunk into a PNG so image viewers report the correct
|
|
156
|
+
* physical (print) size. Canvas-generated PNGs carry no resolution metadata,
|
|
157
|
+
* so without this a Letter page at 150 DPI is read as ~17x13 inches at 96 DPI.
|
|
158
|
+
*
|
|
159
|
+
* @param bytes - The original PNG bytes.
|
|
160
|
+
* @param dpi - The target resolution in dots per inch.
|
|
161
|
+
* @returns A new PNG byte array with the resolution embedded.
|
|
162
|
+
*/
|
|
163
|
+
private _pngWithDpi;
|
|
164
|
+
/**
|
|
165
|
+
* Patch the JFIF APP0 density fields of a JPEG so it reports the correct DPI.
|
|
166
|
+
*
|
|
167
|
+
* @param bytes - The original JPEG bytes (mutated in place).
|
|
168
|
+
* @param dpi - The target resolution in dots per inch.
|
|
169
|
+
* @returns The same byte array with the density fields set when a JFIF
|
|
170
|
+
* header is present.
|
|
171
|
+
*/
|
|
172
|
+
private _jpegWithDpi;
|
|
173
|
+
/**
|
|
174
|
+
* Re-encode a raster blob with embedded DPI metadata.
|
|
175
|
+
*
|
|
176
|
+
* @param blob - The PNG or JPEG blob produced by the canvas.
|
|
177
|
+
* @param format - The raster format.
|
|
178
|
+
* @returns A new blob carrying the current DPI, or the original on failure.
|
|
179
|
+
*/
|
|
180
|
+
private _embedDpi;
|
|
181
|
+
/**
|
|
182
|
+
* Read a blob as a base64 data URL.
|
|
183
|
+
*
|
|
184
|
+
* @param blob - The blob to encode.
|
|
185
|
+
* @returns The data URL string.
|
|
186
|
+
*/
|
|
187
|
+
private _blobToDataUrl;
|
|
101
188
|
/**
|
|
102
189
|
* Toggle custom size inputs visibility.
|
|
103
190
|
*/
|
|
@@ -164,6 +251,14 @@ export declare class PrintControl implements IControl {
|
|
|
164
251
|
* Draw a scale bar on the export canvas.
|
|
165
252
|
*/
|
|
166
253
|
private _drawScaleBar;
|
|
254
|
+
/**
|
|
255
|
+
* Compute the export page layout (pixel dimensions, content rect, and the
|
|
256
|
+
* destination rectangle the map is drawn into) for the current state.
|
|
257
|
+
*
|
|
258
|
+
* @param mapCanvas - The captured map canvas, used for the source aspect ratio.
|
|
259
|
+
* @returns The resolved page layout.
|
|
260
|
+
*/
|
|
261
|
+
private _getPageLayout;
|
|
167
262
|
/**
|
|
168
263
|
* Create the export canvas from the map.
|
|
169
264
|
*/
|
|
@@ -195,7 +290,7 @@ export declare class PrintControl implements IControl {
|
|
|
195
290
|
/**
|
|
196
291
|
* Set the export format.
|
|
197
292
|
*/
|
|
198
|
-
setFormat(format:
|
|
293
|
+
setFormat(format: PrintFormat): this;
|
|
199
294
|
/**
|
|
200
295
|
* Set the JPEG quality.
|
|
201
296
|
*/
|
|
@@ -208,7 +303,7 @@ export declare class PrintControl implements IControl {
|
|
|
208
303
|
* Export the map programmatically and return a data URL.
|
|
209
304
|
*/
|
|
210
305
|
exportMap(options?: {
|
|
211
|
-
format?:
|
|
306
|
+
format?: PrintFormat;
|
|
212
307
|
quality?: number;
|
|
213
308
|
filename?: string;
|
|
214
309
|
title?: string;
|
|
@@ -217,6 +312,12 @@ export declare class PrintControl implements IControl {
|
|
|
217
312
|
colorbar?: PrintColorbarConfig;
|
|
218
313
|
width?: number;
|
|
219
314
|
height?: number;
|
|
315
|
+
pageSize?: PrintPageSize;
|
|
316
|
+
orientation?: PrintOrientation;
|
|
317
|
+
dpi?: number;
|
|
318
|
+
margin?: number;
|
|
319
|
+
pageBackground?: string;
|
|
320
|
+
fitMode?: PrintFitMode;
|
|
220
321
|
}): Promise<string>;
|
|
221
322
|
/**
|
|
222
323
|
* Set the colorbar configuration.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PrintControl.d.ts","sourceRoot":"","sources":["../../../../src/lib/core/PrintControl.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;AAC9B,OAAO,6BAA6B,CAAC;AACrC,OAAO,KAAK,EACV,QAAQ,EACR,GAAG,IAAI,WAAW,EAClB,eAAe,EAChB,MAAM,aAAa,CAAC;AACrB,OAAO,KAAK,EACV,mBAAmB,EACnB,iBAAiB,EACjB,UAAU,EACV,iBAAiB,EACjB,mBAAmB,
|
|
1
|
+
{"version":3,"file":"PrintControl.d.ts","sourceRoot":"","sources":["../../../../src/lib/core/PrintControl.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;AAC9B,OAAO,6BAA6B,CAAC;AACrC,OAAO,KAAK,EACV,QAAQ,EACR,GAAG,IAAI,WAAW,EAClB,eAAe,EAChB,MAAM,aAAa,CAAC;AACrB,OAAO,KAAK,EACV,mBAAmB,EACnB,i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H,UAAU,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAYjC;;OAEG;IACH,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAS7B;;OAEG;IACG,SAAS,CAAC,OAAO,CAAC,EAAE;QACxB,MAAM,CAAC,EAAE,WAAW,CAAC;QACrB,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,iBAAiB,CAAC,EAAE,OAAO,CAAC;QAC5B,eAAe,CAAC,EAAE,OAAO,CAAC;QAC1B,QAAQ,CAAC,EAAE,mBAAmB,CAAC;QAC/B,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,QAAQ,CAAC,EAAE,aAAa,CAAC;QACzB,WAAW,CAAC,EAAE,gBAAgB,CAAC;QAC/B,GAAG,CAAC,EAAE,MAAM,CAAC;QACb,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,cAAc,CAAC,EAAE,MAAM,CAAC;QACxB,OAAO,CAAC,EAAE,YAAY,CAAC;KACxB,GAAG,OAAO,CAAC,MAAM,CAAC;IAmFnB;;OAEG;IACH,WAAW,CAAC,MAAM,EAAE,mBAAmB,GAAG,IAAI;CAgC/C"}
|
|
@@ -935,7 +935,10 @@ export interface ViewStateControlOptions {
|
|
|
935
935
|
panelWidth?: number;
|
|
936
936
|
/** Maximum height of the panel in pixels before scrolling. Default: 500. */
|
|
937
937
|
maxHeight?: number;
|
|
938
|
-
/**
|
|
938
|
+
/**
|
|
939
|
+
* Background color of the container. When unset (default), the control
|
|
940
|
+
* adapts to the system light/dark theme via CSS custom properties.
|
|
941
|
+
*/
|
|
939
942
|
backgroundColor?: string;
|
|
940
943
|
/** Border radius for container. */
|
|
941
944
|
borderRadius?: number;
|
|
@@ -943,7 +946,10 @@ export interface ViewStateControlOptions {
|
|
|
943
946
|
opacity?: number;
|
|
944
947
|
/** Font size in pixels. */
|
|
945
948
|
fontSize?: number;
|
|
946
|
-
/**
|
|
949
|
+
/**
|
|
950
|
+
* Font color of the panel. When unset (default), the panel text adapts to
|
|
951
|
+
* the system light/dark theme via CSS custom properties.
|
|
952
|
+
*/
|
|
947
953
|
fontColor?: string;
|
|
948
954
|
/** Minimum zoom level at which the control is visible. */
|
|
949
955
|
minzoom?: number;
|
|
@@ -2454,7 +2460,10 @@ export interface MeasureControlOptions {
|
|
|
2454
2460
|
panelWidth?: number;
|
|
2455
2461
|
/** Maximum height of the panel in pixels before scrolling. Default: 500. */
|
|
2456
2462
|
maxHeight?: number;
|
|
2457
|
-
/**
|
|
2463
|
+
/**
|
|
2464
|
+
* Background color of the panel. When unset (default), the panel adapts to
|
|
2465
|
+
* the system light/dark theme via CSS custom properties.
|
|
2466
|
+
*/
|
|
2458
2467
|
backgroundColor?: string;
|
|
2459
2468
|
/** Border radius in pixels. Default: 4. */
|
|
2460
2469
|
borderRadius?: number;
|
|
@@ -2462,7 +2471,10 @@ export interface MeasureControlOptions {
|
|
|
2462
2471
|
opacity?: number;
|
|
2463
2472
|
/** Font size in pixels. Default: 12. */
|
|
2464
2473
|
fontSize?: number;
|
|
2465
|
-
/**
|
|
2474
|
+
/**
|
|
2475
|
+
* Font color of the panel. When unset (default), the panel text adapts to
|
|
2476
|
+
* the system light/dark theme via CSS custom properties.
|
|
2477
|
+
*/
|
|
2466
2478
|
fontColor?: string;
|
|
2467
2479
|
/** Minimum zoom level at which the control is visible. */
|
|
2468
2480
|
minzoom?: number;
|
|
@@ -2648,13 +2660,19 @@ export interface BookmarkControlOptions {
|
|
|
2648
2660
|
panelWidth?: number;
|
|
2649
2661
|
/** Maximum height of the panel in pixels before scrolling. Default: 500. */
|
|
2650
2662
|
maxHeight?: number;
|
|
2651
|
-
/**
|
|
2663
|
+
/**
|
|
2664
|
+
* Background color of the panel. When unset (default), the panel adapts to
|
|
2665
|
+
* the system light/dark theme via CSS custom properties.
|
|
2666
|
+
*/
|
|
2652
2667
|
backgroundColor?: string;
|
|
2653
2668
|
/** Border radius in pixels. Default: 4. */
|
|
2654
2669
|
borderRadius?: number;
|
|
2655
2670
|
/** Font size in pixels. Default: 12. */
|
|
2656
2671
|
fontSize?: number;
|
|
2657
|
-
/**
|
|
2672
|
+
/**
|
|
2673
|
+
* Font color of the panel. When unset (default), the panel text adapts to
|
|
2674
|
+
* the system light/dark theme via CSS custom properties.
|
|
2675
|
+
*/
|
|
2658
2676
|
fontColor?: string;
|
|
2659
2677
|
/** Minimum zoom level at which the control is visible. */
|
|
2660
2678
|
minzoom?: number;
|
|
@@ -2713,6 +2731,25 @@ export interface PrintColorbarConfig {
|
|
|
2713
2731
|
/** Number of tick marks. Default: 5. */
|
|
2714
2732
|
tickCount?: number;
|
|
2715
2733
|
}
|
|
2734
|
+
/**
|
|
2735
|
+
* Standard page size presets for print export. `'fit'` keeps the current map
|
|
2736
|
+
* canvas size (legacy behavior); the others are physical paper sizes.
|
|
2737
|
+
*/
|
|
2738
|
+
export type PrintPageSize = "fit" | "a3" | "a4" | "a5" | "letter" | "legal" | "tabloid";
|
|
2739
|
+
/**
|
|
2740
|
+
* Page orientation for print export. `'auto'` follows the map aspect ratio.
|
|
2741
|
+
*/
|
|
2742
|
+
export type PrintOrientation = "auto" | "portrait" | "landscape";
|
|
2743
|
+
/**
|
|
2744
|
+
* How the map is fitted into the page content area when the map aspect ratio
|
|
2745
|
+
* differs from the page aspect ratio. `'contain'` letterboxes the whole map;
|
|
2746
|
+
* `'cover'` fills the page and crops the overflow.
|
|
2747
|
+
*/
|
|
2748
|
+
export type PrintFitMode = "contain" | "cover";
|
|
2749
|
+
/**
|
|
2750
|
+
* Supported export formats for the PrintControl.
|
|
2751
|
+
*/
|
|
2752
|
+
export type PrintFormat = "png" | "jpeg" | "pdf" | "svg";
|
|
2716
2753
|
/**
|
|
2717
2754
|
* Options for configuring the PrintControl.
|
|
2718
2755
|
*/
|
|
@@ -2726,7 +2763,7 @@ export interface PrintControlOptions {
|
|
|
2726
2763
|
/** Whether to start collapsed. Default: true. */
|
|
2727
2764
|
collapsed?: boolean;
|
|
2728
2765
|
/** Default image format. Default: 'png'. */
|
|
2729
|
-
format?:
|
|
2766
|
+
format?: PrintFormat;
|
|
2730
2767
|
/** JPEG quality (0-1). Default: 0.92. */
|
|
2731
2768
|
quality?: number;
|
|
2732
2769
|
/** Default filename (without extension). Default: 'map-export'. */
|
|
@@ -2751,11 +2788,41 @@ export interface PrintControlOptions {
|
|
|
2751
2788
|
width?: number;
|
|
2752
2789
|
/** Height override for export (pixels). If not set, uses current canvas size. */
|
|
2753
2790
|
height?: number;
|
|
2791
|
+
/**
|
|
2792
|
+
* Page size for export. `'fit'` (default) uses the current map canvas size
|
|
2793
|
+
* (or the Custom width/height) and preserves legacy behavior. Any paper
|
|
2794
|
+
* preset combines with `dpi` to determine the output pixel dimensions and is
|
|
2795
|
+
* used as the PDF/SVG page size.
|
|
2796
|
+
*/
|
|
2797
|
+
pageSize?: PrintPageSize;
|
|
2798
|
+
/** Page orientation. `'auto'` (default) follows the map aspect ratio. */
|
|
2799
|
+
orientation?: PrintOrientation;
|
|
2800
|
+
/**
|
|
2801
|
+
* Output resolution in dots per inch. Combined with a paper `pageSize` it
|
|
2802
|
+
* determines the export pixel dimensions (pixels = inches x dpi). Ignored
|
|
2803
|
+
* when `pageSize` is `'fit'`. Default: 96.
|
|
2804
|
+
*/
|
|
2805
|
+
dpi?: number;
|
|
2806
|
+
/** Page margin in points (1/72 inch) around the map. Ignored for `'fit'`. Default: 0. */
|
|
2807
|
+
margin?: number;
|
|
2808
|
+
/** Background color filled behind the map and in the margins. Default: '#ffffff'. */
|
|
2809
|
+
pageBackground?: string;
|
|
2810
|
+
/**
|
|
2811
|
+
* How the map is fitted into the page content area when aspect ratios
|
|
2812
|
+
* differ. `'contain'` (default) letterboxes; `'cover'` crops. Ignored for
|
|
2813
|
+
* `'fit'`.
|
|
2814
|
+
*/
|
|
2815
|
+
fitMode?: PrintFitMode;
|
|
2816
|
+
/** Whether to show the page options (size/orientation/DPI) in the panel. Default: false. */
|
|
2817
|
+
showPageOptions?: boolean;
|
|
2754
2818
|
/** Panel width in pixels. Default: 280. */
|
|
2755
2819
|
panelWidth?: number;
|
|
2756
2820
|
/** Maximum height of the panel in pixels before scrolling. Default: 500. */
|
|
2757
2821
|
maxHeight?: number;
|
|
2758
|
-
/**
|
|
2822
|
+
/**
|
|
2823
|
+
* Background color of the panel. When unset (default), the panel adapts to
|
|
2824
|
+
* the system light/dark theme via CSS custom properties.
|
|
2825
|
+
*/
|
|
2759
2826
|
backgroundColor?: string;
|
|
2760
2827
|
/** Border radius in pixels. Default: 4. */
|
|
2761
2828
|
borderRadius?: number;
|
|
@@ -2763,7 +2830,10 @@ export interface PrintControlOptions {
|
|
|
2763
2830
|
opacity?: number;
|
|
2764
2831
|
/** Font size in pixels. Default: 12. */
|
|
2765
2832
|
fontSize?: number;
|
|
2766
|
-
/**
|
|
2833
|
+
/**
|
|
2834
|
+
* Font color of the panel. When unset (default), the panel text adapts to
|
|
2835
|
+
* the system light/dark theme via CSS custom properties.
|
|
2836
|
+
*/
|
|
2767
2837
|
fontColor?: string;
|
|
2768
2838
|
/** Minimum zoom level at which the control is visible. */
|
|
2769
2839
|
minzoom?: number;
|
|
@@ -2779,7 +2849,7 @@ export interface PrintControlState {
|
|
|
2779
2849
|
/** Whether the panel is collapsed. */
|
|
2780
2850
|
collapsed: boolean;
|
|
2781
2851
|
/** Current image format. */
|
|
2782
|
-
format:
|
|
2852
|
+
format: PrintFormat;
|
|
2783
2853
|
/** JPEG quality (0-1). */
|
|
2784
2854
|
quality: number;
|
|
2785
2855
|
/** Current filename (without extension). */
|
|
@@ -2798,6 +2868,18 @@ export interface PrintControlState {
|
|
|
2798
2868
|
width: number | null;
|
|
2799
2869
|
/** Custom height (null = use current canvas size). */
|
|
2800
2870
|
height: number | null;
|
|
2871
|
+
/** Page size for export. */
|
|
2872
|
+
pageSize: PrintPageSize;
|
|
2873
|
+
/** Page orientation. */
|
|
2874
|
+
orientation: PrintOrientation;
|
|
2875
|
+
/** Output resolution in dots per inch. */
|
|
2876
|
+
dpi: number;
|
|
2877
|
+
/** Page margin in points. */
|
|
2878
|
+
margin: number;
|
|
2879
|
+
/** Background color filled behind the map and margins. */
|
|
2880
|
+
pageBackground: string;
|
|
2881
|
+
/** How the map is fitted into the page content area. */
|
|
2882
|
+
fitMode: PrintFitMode;
|
|
2801
2883
|
}
|
|
2802
2884
|
/**
|
|
2803
2885
|
* PrintControl event types.
|