proper panning
This commit is contained in:
parent
6dde3660df
commit
164eb4ba43
8 changed files with 32 additions and 58 deletions
6
crates/client/dist/index.html
vendored
6
crates/client/dist/index.html
vendored
|
@ -94,7 +94,7 @@
|
|||
}
|
||||
}
|
||||
</style>
|
||||
<link rel="modulepreload" href="/wxbox-client-432cad19da309f9d.js" crossorigin="anonymous" integrity="sha384-nrW4CTzLGI43dYXx4bsCC1MufwwJsv215lOCUjGPlKxUXnaSIj4SO1d9LLavD/iZ"><link rel="preload" href="/wxbox-client-432cad19da309f9d_bg.wasm" crossorigin="anonymous" integrity="sha384-OaZoP3+dHb0yt+DUsiqidExoGgtMXKSCAZgJw6EqccvkadD8EPCeb0Yct6+3tVBi" as="fetch" type="application/wasm"></head>
|
||||
<link rel="modulepreload" href="/wxbox-client-80142735797f0966.js" crossorigin="anonymous" integrity="sha384-Vt83Dej0N3ylPemIHXzytyKIxG97APHZN9wiDVs0l/Ke7cJAIwuTt06P9cfxlScr"><link rel="preload" href="/wxbox-client-80142735797f0966_bg.wasm" crossorigin="anonymous" integrity="sha384-cgdrHf785ZWa2q7jeTewH7zPTO9blVxrrz8Om8M6boiYE0iolbNJAoWkNUNbIZoe" as="fetch" type="application/wasm"></head>
|
||||
|
||||
<body>
|
||||
<!-- The WASM code will resize the canvas dynamically -->
|
||||
|
@ -111,8 +111,8 @@
|
|||
|
||||
|
||||
<script type="module">
|
||||
import init, * as bindings from '/wxbox-client-432cad19da309f9d.js';
|
||||
const wasm = await init({ module_or_path: '/wxbox-client-432cad19da309f9d_bg.wasm' });
|
||||
import init, * as bindings from '/wxbox-client-80142735797f0966.js';
|
||||
const wasm = await init({ module_or_path: '/wxbox-client-80142735797f0966_bg.wasm' });
|
||||
|
||||
|
||||
window.wasmBindings = bindings;
|
||||
|
|
Binary file not shown.
|
@ -212,7 +212,7 @@ function debugString(val) {
|
|||
return className;
|
||||
}
|
||||
function __wbg_adapter_32(arg0, arg1, arg2) {
|
||||
wasm.closure1007_externref_shim(arg0, arg1, arg2);
|
||||
wasm.closure72_externref_shim(arg0, arg1, arg2);
|
||||
}
|
||||
|
||||
function takeFromExternrefTable0(idx) {
|
||||
|
@ -220,17 +220,13 @@ function takeFromExternrefTable0(idx) {
|
|||
wasm.__externref_table_dealloc(idx);
|
||||
return value;
|
||||
}
|
||||
function __wbg_adapter_35(arg0, arg1) {
|
||||
const ret = wasm._dyn_core__ops__function__FnMut_____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h099b1487e92de126_multivalue_shim(arg0, arg1);
|
||||
function __wbg_adapter_37(arg0, arg1) {
|
||||
const ret = wasm._dyn_core__ops__function__FnMut_____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h0fb7ada914653eaa_multivalue_shim(arg0, arg1);
|
||||
if (ret[1]) {
|
||||
throw takeFromExternrefTable0(ret[0]);
|
||||
}
|
||||
}
|
||||
|
||||
function __wbg_adapter_40(arg0, arg1, arg2) {
|
||||
wasm.closure1693_externref_shim(arg0, arg1, arg2);
|
||||
}
|
||||
|
||||
/**
|
||||
* Chroma subsampling format
|
||||
* @enum {0 | 1 | 2 | 3}
|
||||
|
@ -1170,34 +1166,10 @@ function __wbg_get_imports() {
|
|||
const ret = new Function(getStringFromWasm0(arg0, arg1));
|
||||
return ret;
|
||||
};
|
||||
imports.wbg.__wbg_newwithbyteoffsetandlength_4b01f207bed23fc0 = function(arg0, arg1, arg2) {
|
||||
const ret = new Int8Array(arg0, arg1 >>> 0, arg2 >>> 0);
|
||||
return ret;
|
||||
};
|
||||
imports.wbg.__wbg_newwithbyteoffsetandlength_5910bdf845a168eb = function(arg0, arg1, arg2) {
|
||||
const ret = new Uint32Array(arg0, arg1 >>> 0, arg2 >>> 0);
|
||||
return ret;
|
||||
};
|
||||
imports.wbg.__wbg_newwithbyteoffsetandlength_6991ab0478cc4a43 = function(arg0, arg1, arg2) {
|
||||
const ret = new Int32Array(arg0, arg1 >>> 0, arg2 >>> 0);
|
||||
return ret;
|
||||
};
|
||||
imports.wbg.__wbg_newwithbyteoffsetandlength_69ec77b20853ae02 = function(arg0, arg1, arg2) {
|
||||
const ret = new Uint16Array(arg0, arg1 >>> 0, arg2 >>> 0);
|
||||
return ret;
|
||||
};
|
||||
imports.wbg.__wbg_newwithbyteoffsetandlength_b0192e1adfca2df1 = function(arg0, arg1, arg2) {
|
||||
const ret = new Int16Array(arg0, arg1 >>> 0, arg2 >>> 0);
|
||||
return ret;
|
||||
};
|
||||
imports.wbg.__wbg_newwithbyteoffsetandlength_ba35896968751d91 = function(arg0, arg1, arg2) {
|
||||
const ret = new Uint8Array(arg0, arg1 >>> 0, arg2 >>> 0);
|
||||
return ret;
|
||||
};
|
||||
imports.wbg.__wbg_newwithbyteoffsetandlength_f113a96374814bb2 = function(arg0, arg1, arg2) {
|
||||
const ret = new Float32Array(arg0, arg1 >>> 0, arg2 >>> 0);
|
||||
return ret;
|
||||
};
|
||||
imports.wbg.__wbg_newwithrecordfromstrtoblobpromise_43dee664be2df4ab = function() { return handleError(function (arg0) {
|
||||
const ret = new ClipboardItem(arg0);
|
||||
return ret;
|
||||
|
@ -1305,9 +1277,6 @@ function __wbg_get_imports() {
|
|||
imports.wbg.__wbg_readPixels_33f7af7601585ec6 = function() { return handleError(function (arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7) {
|
||||
arg0.readPixels(arg1, arg2, arg3, arg4, arg5 >>> 0, arg6 >>> 0, arg7);
|
||||
}, arguments) };
|
||||
imports.wbg.__wbg_readPixels_bc526324b691316a = function() { return handleError(function (arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7) {
|
||||
arg0.readPixels(arg1, arg2, arg3, arg4, arg5 >>> 0, arg6 >>> 0, arg7);
|
||||
}, arguments) };
|
||||
imports.wbg.__wbg_readPixels_ca434c18552fc5bc = function() { return handleError(function (arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7) {
|
||||
arg0.readPixels(arg1, arg2, arg3, arg4, arg5 >>> 0, arg6 >>> 0, arg7);
|
||||
}, arguments) };
|
||||
|
@ -1497,9 +1466,6 @@ function __wbg_get_imports() {
|
|||
imports.wbg.__wbg_texParameteri_d550886a76f21258 = function(arg0, arg1, arg2, arg3) {
|
||||
arg0.texParameteri(arg1 >>> 0, arg2 >>> 0, arg3);
|
||||
};
|
||||
imports.wbg.__wbg_texSubImage2D_0eeb9856a37cc769 = function() { return handleError(function (arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9) {
|
||||
arg0.texSubImage2D(arg1 >>> 0, arg2, arg3, arg4, arg5, arg6, arg7 >>> 0, arg8 >>> 0, arg9);
|
||||
}, arguments) };
|
||||
imports.wbg.__wbg_texSubImage2D_355ed8d7c2b07c22 = function() { return handleError(function (arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9) {
|
||||
arg0.texSubImage2D(arg1 >>> 0, arg2, arg3, arg4, arg5, arg6, arg7 >>> 0, arg8 >>> 0, arg9);
|
||||
}, arguments) };
|
||||
|
@ -1633,20 +1599,20 @@ function __wbg_get_imports() {
|
|||
const ret = false;
|
||||
return ret;
|
||||
};
|
||||
imports.wbg.__wbindgen_closure_wrapper3643 = function(arg0, arg1, arg2) {
|
||||
const ret = makeMutClosure(arg0, arg1, 1008, __wbg_adapter_32);
|
||||
imports.wbg.__wbindgen_closure_wrapper2730 = function(arg0, arg1, arg2) {
|
||||
const ret = makeMutClosure(arg0, arg1, 73, __wbg_adapter_32);
|
||||
return ret;
|
||||
};
|
||||
imports.wbg.__wbindgen_closure_wrapper3645 = function(arg0, arg1, arg2) {
|
||||
const ret = makeMutClosure(arg0, arg1, 1008, __wbg_adapter_35);
|
||||
imports.wbg.__wbindgen_closure_wrapper633 = function(arg0, arg1, arg2) {
|
||||
const ret = makeMutClosure(arg0, arg1, 73, __wbg_adapter_32);
|
||||
return ret;
|
||||
};
|
||||
imports.wbg.__wbindgen_closure_wrapper3647 = function(arg0, arg1, arg2) {
|
||||
const ret = makeMutClosure(arg0, arg1, 1008, __wbg_adapter_32);
|
||||
imports.wbg.__wbindgen_closure_wrapper635 = function(arg0, arg1, arg2) {
|
||||
const ret = makeMutClosure(arg0, arg1, 73, __wbg_adapter_32);
|
||||
return ret;
|
||||
};
|
||||
imports.wbg.__wbindgen_closure_wrapper6224 = function(arg0, arg1, arg2) {
|
||||
const ret = makeMutClosure(arg0, arg1, 1694, __wbg_adapter_40);
|
||||
imports.wbg.__wbindgen_closure_wrapper841 = function(arg0, arg1, arg2) {
|
||||
const ret = makeMutClosure(arg0, arg1, 73, __wbg_adapter_37);
|
||||
return ret;
|
||||
};
|
||||
imports.wbg.__wbindgen_debug_string = function(arg0, arg1) {
|
BIN
crates/client/dist/wxbox-client-80142735797f0966_bg.wasm
vendored
Normal file
BIN
crates/client/dist/wxbox-client-80142735797f0966_bg.wasm
vendored
Normal file
Binary file not shown.
|
@ -38,7 +38,7 @@ impl Map {
|
|||
})
|
||||
}
|
||||
pub fn process_input(&mut self, ctx: &egui::Context, ui: &mut Ui, rect: Rect, response: egui::Response) {
|
||||
let xy_delta = response.drag_motion();
|
||||
let xy_delta = response.drag_delta();
|
||||
let z_delta = if ui.rect_contains_pointer(rect) {
|
||||
ctx.input(|i| {
|
||||
let mut yd_sum = 0.0;
|
||||
|
@ -59,8 +59,23 @@ impl Map {
|
|||
})
|
||||
} else { 0.0 };
|
||||
|
||||
self.lat += xy_delta.y as f64 * 0.0005;
|
||||
self.long -= xy_delta.x as f64 * 0.0005;
|
||||
let n = 2.0_f64.powf(self.zoom);
|
||||
let x = self.long.to_radians();
|
||||
let y = ((self.lat.to_radians()).tan()).asinh();
|
||||
let x = (1.0 + (x / std::f64::consts::PI)) / 2.0;
|
||||
let y = (1.0 - (y / std::f64::consts::PI)) / 2.0;
|
||||
let mut x = x * n;
|
||||
let mut y = y * n;
|
||||
|
||||
x -= xy_delta.x as f64 * 1.0 / 256.0;
|
||||
y -= xy_delta.y as f64 * 1.0 / 256.0;
|
||||
|
||||
let long_deg = x / n * 360.0 - 180.0;
|
||||
let lat_rad = (std::f64::consts::PI * (1.0 - 2.0 * y / n)).sinh().atan();
|
||||
let lat_deg = lat_rad * 180.0 / std::f64::consts::PI;
|
||||
|
||||
self.long = long_deg;
|
||||
self.lat = lat_deg;
|
||||
|
||||
if !self.allow_nonint_zoom {
|
||||
if z_delta < 0.0 {
|
||||
|
@ -114,7 +129,6 @@ impl Map {
|
|||
fn load_tiles(&mut self, ctx: &egui::Context, viewport_width: usize, viewport_height: usize) -> Tileset {
|
||||
// lat, long is top left
|
||||
// tiles are rendered at 256x256. how many can we fit?
|
||||
debug!("viewport is {}px, we can render {}", viewport_width, viewport_width / 256);
|
||||
let tiles_x = (viewport_width as f32 / 256.0).ceil() as isize + 1;
|
||||
let tiles_y = (viewport_height as f32 / 256.0).ceil() as isize + 1;
|
||||
|
||||
|
|
|
@ -199,7 +199,6 @@ impl MapRender {
|
|||
let transform = nalgebra_glm::scale(&transform, &nalgebra_glm::vec3(tileset.zoom, tileset.zoom, 1.0));
|
||||
|
||||
|
||||
debug!("zoom factor: {}", tileset.zoom);
|
||||
|
||||
// screenspace-ify:
|
||||
// map to 0 to 1 space
|
||||
|
|
|
@ -109,7 +109,6 @@ impl GribMessage {
|
|||
let bitmap = bitmap.ok_or(GribError::MissingBitmap)?;
|
||||
let data = data.ok_or(GribError::MissingData)?;
|
||||
|
||||
debug!("{:?}", data_representation);
|
||||
|
||||
data_representation.load_data(data.data.clone())?;
|
||||
|
||||
|
|
|
@ -376,7 +376,6 @@ pub async fn source(
|
|||
}
|
||||
map
|
||||
} else {
|
||||
debug!("not found baselayer");
|
||||
return HttpResponse::new(StatusCode::NOT_FOUND);
|
||||
};
|
||||
|
||||
|
@ -416,15 +415,12 @@ pub async fn source(
|
|||
)
|
||||
.await
|
||||
} else {
|
||||
debug!("not found grib2 after reload in base cache");
|
||||
return HttpResponse::new(StatusCode::NOT_FOUND);
|
||||
}
|
||||
} else {
|
||||
debug!("not found grib2 in configuration");
|
||||
return HttpResponse::new(StatusCode::NOT_FOUND);
|
||||
}
|
||||
} else {
|
||||
debug!("not found datalayer registry");
|
||||
return HttpResponse::new(StatusCode::NOT_FOUND);
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue