From 5bd95351d59ba5d4e4fd9310fb91af2db3bda179 Mon Sep 17 00:00:00 2001 From: Gabriel <74922336+sheeley820@users.noreply.github.com> Date: Thu, 14 Sep 2023 09:48:47 -0400 Subject: [PATCH] Allow users to set preserveDrawingBuffer in the options --- README.md | 4 ++++ src/VectorTileLayer.js | 8 ++++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 84fb2da..f3890f1 100644 --- a/README.md +++ b/README.md @@ -128,6 +128,10 @@ L.esri.Vector.vectorTileLayer("SERVICE_URL", { // (this may not be necessary when specifying a SERVICE_URL) portalUrl: "https://www.arcgis.com", // default value + // optional: set by default to `false` for performance reasons + // set to `true` to resolve WebGL printing issues in Firefox + preserveDrawingBuffer: false, // default value + // optional: customize the style with a function that gets the default style from the service // and returns the new style to be used style: (style) => { diff --git a/src/VectorTileLayer.js b/src/VectorTileLayer.js index fe98b0b..72d2510 100644 --- a/src/VectorTileLayer.js +++ b/src/VectorTileLayer.js @@ -5,7 +5,10 @@ import { maplibreGLJSLayer } from './MaplibreGLLayer'; export var VectorTileLayer = Layer.extend({ options: { // if portalUrl is not provided, default to ArcGIS Online - portalUrl: 'https://www.arcgis.com' + portalUrl: 'https://www.arcgis.com', + // for performance optimization default to `false` + // set to `true` to resolve printing issues in Firefox + preserveDrawingBuffer: false }, /** @@ -100,7 +103,8 @@ export var VectorTileLayer = Layer.extend({ this._maplibreGL = maplibreGLJSLayer({ style: style, pane: this.options.pane, - opacity: this.options.opacity + opacity: this.options.opacity, + preserveDrawingBuffer: this.options.preserveDrawingBuffer }); this._ready = true;