fix: end offset

This commit is contained in:
not-elm
2025-08-10 23:43:40 +09:00
parent dd6854b176
commit bbb82a5a00
6 changed files with 707 additions and 32 deletions

724
Cargo.lock generated

File diff suppressed because it is too large Load Diff

View File

@@ -9,6 +9,7 @@ repository.workspace = true
readme.workspace = true readme.workspace = true
keywords.workspace = true keywords.workspace = true
categories.workspace = true categories.workspace = true
exclude = ["assets/"]
[workspace] [workspace]
resolver = "2" resolver = "2"

View File

@@ -52,7 +52,6 @@ impl ImplApp for BrowserProcessAppBuilder {
let Some(command_line) = command_line else { let Some(command_line) = command_line else {
return; return;
}; };
//TODO: フラグで切り替えるようにする
command_line.append_switch(Some(&"use-mock-keychain".into())); command_line.append_switch(Some(&"use-mock-keychain".into()));
#[cfg(feature = "debug")] #[cfg(feature = "debug")]
{ {

View File

@@ -15,7 +15,7 @@ impl DataResponser {
pub fn prepare(&mut self, data: Vec<u8>, range: &Option<(usize, Option<usize>)>) { pub fn prepare(&mut self, data: Vec<u8>, range: &Option<(usize, Option<usize>)>) {
if let Some((start, end)) = range { if let Some((start, end)) = range {
self.offset = *start; self.offset = *start;
self.end_offset = end.unwrap_or(data.len()-1); self.end_offset = end.unwrap_or(data.len());
self.data = data; self.data = data;
} else { } else {
self.offset = 0; self.offset = 0;
@@ -40,7 +40,7 @@ impl DataResponser {
return None; return None;
} }
let slice = &self.data[start..=end.min(self.data.len()-1)]; let slice = &self.data[start..end.min(self.data.len())];
self.offset += slice.len(); self.offset += slice.len();
Some(slice) Some(slice)
} }

View File

@@ -8,7 +8,6 @@ repository.workspace = true
publish = false publish = false
[dependencies] [dependencies]
bevy = { workspace = true, features = ["file_watcher"]} bevy = { workspace = true, default-features = true, features = ["file_watcher"]}
bevy_remote = { workspace = true }
bevy_cef = { workspace = true, features = ["debug"] } bevy_cef = { workspace = true, features = ["debug"] }

View File

@@ -12,7 +12,7 @@ fn main() {
spawn_camera, spawn_camera,
spawn_directional_light, spawn_directional_light,
spawn_github_webview, spawn_github_webview,
spawn_google_search_webview, spawn_github_io_webview,
spawn_ground, spawn_ground,
enable_ime, enable_ime,
), ),
@@ -64,13 +64,13 @@ fn spawn_github_webview(
)); ));
} }
fn spawn_google_search_webview( fn spawn_github_io_webview(
mut commands: Commands, mut commands: Commands,
mut meshes: ResMut<Assets<Mesh>>, mut meshes: ResMut<Assets<Mesh>>,
mut materials: ResMut<Assets<WebviewExtendStandardMaterial>>, mut materials: ResMut<Assets<WebviewExtendStandardMaterial>>,
) { ) {
commands.spawn(( commands.spawn((
CefWebviewUri::new("https://not-elm.github.io/bevy_cef/"), CefWebviewUri::new("https://not-elm.github.io/bevy_cef"),
WebviewSize(Vec2::splat(800.0)), WebviewSize(Vec2::splat(800.0)),
Mesh3d(meshes.add(Plane3d::new(Vec3::Z, Vec2::ONE))), Mesh3d(meshes.add(Plane3d::new(Vec3::Z, Vec2::ONE))),
MeshMaterial3d(materials.add(WebviewExtendStandardMaterial::default())), MeshMaterial3d(materials.add(WebviewExtendStandardMaterial::default())),