From f94d5c65afd9f989a17f76f2ce46c430e4f2c48d Mon Sep 17 00:00:00 2001 From: Avi Date: Sat, 2 May 2020 22:31:50 +0300 Subject: [PATCH] Fixed polygon drawing bug for canvas renderer --- package.json | 2 +- src/index.ts | 9 +++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index b5fe494..3ba8a16 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "react-leaflet-kml", - "version": "1.0.3", + "version": "1.0.4", "description": "React leaflet wrapper of leaflet-kml", "main": "lib/index.js", "types": "lib/index.d.ts", diff --git a/src/index.ts b/src/index.ts index 7436e19..c1a1f74 100644 --- a/src/index.ts +++ b/src/index.ts @@ -20,14 +20,19 @@ class ReactLeafletKml extends MapLayer { } return this.leafletElement; } + + public updateLeafletElement () { + if (this.props.leaflet.map.options.preferCanvas) { + this.props.leaflet.map._renderer._update(); + } + } public componentWillUnmount() { super.componentWillUnmount(); if (this.props.leaflet.map.options.preferCanvas) { - // Handling react-leaflet bug of canvas renderer not updating this.props.leaflet.map._renderer._update(); } } } -export default withLeaflet(ReactLeafletKml); +export default withLeaflet(ReactLeafletKml); \ No newline at end of file