From 8ab8776916d20c66f935d3b1469797f8be38f71a Mon Sep 17 00:00:00 2001
From: Quaternions <krakow20@gmail.com>
Date: Fri, 3 Jan 2025 21:43:40 -0800
Subject: [PATCH] outrageous resize hack

---
 strafe-client/src/graphics_worker.rs | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/strafe-client/src/graphics_worker.rs b/strafe-client/src/graphics_worker.rs
index 3fd3cd1..69214a8 100644
--- a/strafe-client/src/graphics_worker.rs
+++ b/strafe-client/src/graphics_worker.rs
@@ -18,6 +18,9 @@ WorkerDescription{
 */
 //up to three frames in flight, dropping new frame requests when all three are busy, and dropping output frames when one renders out of order
 
+fn print(message:&str){
+	web_sys::console::log_1(&message.into());
+}
 pub fn new(
 	mut graphics:graphics::GraphicsState,
 	mut config:wgpu::SurfaceConfiguration,
@@ -34,8 +37,16 @@ pub fn new(
 			Instruction::Resize(size,user_settings)=>{
 				println!("Resizing to {:?}",size);
 				//let t0=std::time::Instant::now();
-				config.width=size.width.clamp(1,2560/2);
-				config.height=size.height.clamp(1,1440/2);
+				match size{
+					winit::dpi::PhysicalSize{width:2560,height:1440}=>{
+						config.width=size.width.clamp(1,2560);
+						config.height=size.height.clamp(1,1440);
+					},
+					_=>{
+						config.width=size.width.clamp(1,1280);
+						config.height=size.height.clamp(1,720);
+					}
+				}
 				surface.configure(&device,&config);
 				graphics.resize(&device,&config,&user_settings);
 				//println!("Resize took {:?}",t0.elapsed());