MCPcopy Create free account
hub / github.com/facebook/Rapid / trimmedExtent

Method trimmedExtent

modules/core/MapSystem.js:874–892  ·  view source on GitHub ↗

* trimmedExtent * Set/Get the map extent, but include some padding for header, footer, etc. * @param extent? Extent Object to fit the map to * @return map extent -or- this

(extent)

Source from the content-addressed store, hash-verified

872 * @return map extent -or- this
873 */
874 trimmedExtent(extent) {
875 if (extent === undefined) {
876 const headerY = 72;
877 const footerY = 30;
878// Add 50px overscan experiment, see UISystem.js
879// Maybe find a nicer way to include overscan and view padding into places like this.
880 // const pad = 10;
881 const pad = 70;
882 const viewport = this.context.viewport;
883 const [w, h] = viewport.dimensions;
884
885 return new Extent(
886 viewport.unproject([pad, h - footerY - pad]), // bottom-left
887 viewport.unproject([w - pad, headerY + pad]) // top-right
888 );
889 } else {
890 return this.setMapParams(extent.center(), this.trimmedExtentZoom(extent));
891 }
892 }
893
894
895 /**

Callers 5

fitZoomMethod · 0.80
continueDrawingFunction · 0.80
continueDrawingFunction · 0.80
showEntityIDFunction · 0.80

Calls 3

setMapParamsMethod · 0.95
trimmedExtentZoomMethod · 0.95
centerMethod · 0.80

Tested by

no test coverage detected