Skip to content

Commit 2115617

Browse files
authored
revert DPR fix as it didn't work (#77)
1 parent 366b22f commit 2115617

File tree

3 files changed

+13
-4
lines changed

3 files changed

+13
-4
lines changed

.changeset/itchy-garlics-behave.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"react-three-map": patch
3+
---
4+
5+
Revert 748d7a7: Fix issues on DPR or browser zoom changes.

src/core/use-on-add.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,15 @@ export function useOnAdd(
7474
})
7575

7676
const onResize = useFunction(() => {
77+
if (!r3mRef.current.map) return;
7778
if (!r3mRef.current.state) return;
78-
// because we update size out of zustand, we just want to let it know that something changed
79-
r3mRef.current.state.set({});
79+
const canvas = r3mRef.current.map.getCanvas();
80+
r3mRef.current.state.setSize(
81+
canvas.clientWidth,
82+
canvas.clientHeight,
83+
false
84+
);
85+
8086
})
8187

8288
const onRemove = useFunction(() => {

src/core/use-render.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@ export function useRender(
1111
const render = useFunction((_gl: WebGL2RenderingContext, mapCamMx: number[]) => {
1212
const r3m = r3mRef.current;
1313
if (!r3m.state || !r3m.map) return;
14-
r3m.state.size.width = r3m.state.gl.domElement.clientWidth;
15-
r3m.state.size.height = r3m.state.gl.domElement.clientHeight;
1614
const camera = r3m.state.camera;
1715
const gl = r3m.state.gl;
1816
const advance = r3m.state.advance;

0 commit comments

Comments
 (0)