diff options
| author | Oskar Nyberg <oskar@mullvad.net> | 2024-03-20 11:05:18 +0100 |
|---|---|---|
| committer | Oskar Nyberg <oskar@mullvad.net> | 2024-03-20 11:05:18 +0100 |
| commit | 4b4304f57a8236e349654f8841d09e6db1432dc2 (patch) | |
| tree | 21757b043e3268e83066eb8ee1d8d9ff6d3c001d /gui/src/renderer/lib | |
| parent | 625a7874ec2341a268a67162b4d6af3e804d7473 (diff) | |
| parent | 4ba956b8da8fb25f36b0ccac1c700b11205d7861 (diff) | |
| download | mullvadvpn-4b4304f57a8236e349654f8841d09e6db1432dc2.tar.xz mullvadvpn-4b4304f57a8236e349654f8841d09e6db1432dc2.zip | |
Merge branch 'map-scaling-incorrectly-des-692'
Diffstat (limited to 'gui/src/renderer/lib')
| -rw-r--r-- | gui/src/renderer/lib/3dmap.ts | 4 | ||||
| -rw-r--r-- | gui/src/renderer/lib/utilityHooks.ts | 9 |
2 files changed, 13 insertions, 0 deletions
diff --git a/gui/src/renderer/lib/3dmap.ts b/gui/src/renderer/lib/3dmap.ts index 61f86d97b9..f74efcf5df 100644 --- a/gui/src/renderer/lib/3dmap.ts +++ b/gui/src/renderer/lib/3dmap.ts @@ -451,6 +451,10 @@ export default class GlMap { this.zoomAnimations = []; } + public updateViewport() { + this.gl.viewport(0, 0, this.gl.drawingBufferWidth, this.gl.drawingBufferHeight); + } + // Move the location marker to `newCoordinate` (with state `connectionState`). // Queues an animation to `newCoordinate` if `animate` is true. Otherwise it moves // directly to that location. diff --git a/gui/src/renderer/lib/utilityHooks.ts b/gui/src/renderer/lib/utilityHooks.ts index 8c3925762e..81a5579dd6 100644 --- a/gui/src/renderer/lib/utilityHooks.ts +++ b/gui/src/renderer/lib/utilityHooks.ts @@ -69,3 +69,12 @@ export function useNormalBridgeSettings() { const bridgeSettings = useSelector((state) => state.settings.bridgeSettings); return bridgeSettings.normal; } + +// This hook returns a function that can be used to force a rerender of a component, and +// additionally also returns a variable that can be used to trigger effects as a result. This is a +// hack and should be avoided unless there are no better ways. +export function useRerenderer(): [() => void, number] { + const [count, setCount] = useState(0); + const rerender = useCallback(() => setCount((count) => count + 1), []); + return [rerender, count]; +} |
