Skip to content

Commit

Permalink
Merge pull request #20 from 2gis/fix-depth-clear-with-resize
Browse files Browse the repository at this point in the history
fix
  • Loading branch information
Kuznecoff authored Mar 9, 2023
2 parents 8b863d0 + 0895ed0 commit d44f6b3
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 11 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@2gis/deck2gis-layer",
"version": "1.1.9",
"version": "1.1.10",
"description": "",
"main": "dist/deck2gislayer.js",
"typings": "dist/types/index.d.ts",
Expand Down
18 changes: 10 additions & 8 deletions src/deckgl2gisLayer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -203,22 +203,24 @@ export class Deck2gisLayer<LayerT extends Layer> implements DeckCustomLayer {
return;
}
const mapSize = this.map.getSize();
if (this.deck.width !== mapSize[0] || this.deck.height !== mapSize[1]) {
(this.deck as any).animationLoop._resizeCanvasDrawingBuffer();
(this.deck as any).animationLoop._resizeViewport();
const renderTarget = this.frameBuffer.bind(this.gl);
onMapResize(this.map, this.deck, renderTarget);
}
const { _2gisData } = this.deck.props as CustomRenderProps;
const gl = this.gl;
this.frameBuffer.bind(gl);
gl.clearColor(1, 1, 1, 0);

if (_2gisData._2gisFramestart) {
if (this.deck.width !== mapSize[0] || this.deck.height !== mapSize[1]) {
(this.deck as any).animationLoop._resizeCanvasDrawingBuffer();
(this.deck as any).animationLoop._resizeViewport();
const renderTarget = this.frameBuffer.bind(this.gl);
onMapResize(this.map, this.deck, renderTarget);
}
this.frameBuffer.bind(gl);
gl.clearColor(1, 1, 1, 0);
gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT);
_2gisData._2gisCurrentViewport = undefined;
_2gisData._2gisFramestart = false;
} else {
this.frameBuffer.bind(gl);
gl.clearColor(1, 1, 1, 0);
gl.clear(gl.COLOR_BUFFER_BIT);
}

Expand Down

0 comments on commit d44f6b3

Please sign in to comment.