Skip to content

Commit

Permalink
Fixed polygon drawing bug for canvas renderer
Browse files Browse the repository at this point in the history
  • Loading branch information
aviklai committed May 2, 2020
1 parent f1237a3 commit f94d5c6
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
9 changes: 7 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,19 @@ class ReactLeafletKml extends MapLayer<IProps> {
}
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);

0 comments on commit f94d5c6

Please sign in to comment.