From 7fd6df50cee18db3b1496785339152ffaf578605 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jon=20Vald=C3=A9s?= Date: Thu, 27 Feb 2020 08:57:24 +0100 Subject: [PATCH] Exposed setting for particle density --- src/renderer/cursor_renderer/cursor_vfx.rs | 4 +--- src/renderer/cursor_renderer/mod.rs | 3 +++ 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/renderer/cursor_renderer/cursor_vfx.rs b/src/renderer/cursor_renderer/cursor_vfx.rs index b8b5662..b6150a8 100644 --- a/src/renderer/cursor_renderer/cursor_vfx.rs +++ b/src/renderer/cursor_renderer/cursor_vfx.rs @@ -181,8 +181,6 @@ impl ParticleTrail { } } -const PARTICLE_DENSITY: f32 = 0.008; - impl CursorVfx for ParticleTrail { fn update(&mut self, settings: &CursorSettings, current_cursor_dest: Point, dt: f32) -> bool { // Update lifetimes and remove dead particles @@ -209,7 +207,7 @@ impl CursorVfx for ParticleTrail { let travel_distance = travel.length(); // Increase amount of particles when cursor travels further // TODO -- particle count should not depend on font size - let particle_count = (travel_distance.powf(1.5) * PARTICLE_DENSITY) as usize; + let particle_count = (travel_distance.powf(1.5) * settings.vfx_particle_density * 0.01) as usize; let prev_p = self.previous_cursor_dest; diff --git a/src/renderer/cursor_renderer/mod.rs b/src/renderer/cursor_renderer/mod.rs index ae5a1d4..518acf5 100644 --- a/src/renderer/cursor_renderer/mod.rs +++ b/src/renderer/cursor_renderer/mod.rs @@ -26,6 +26,7 @@ pub struct CursorSettings { vfx_mode: cursor_vfx::VfxMode, vfx_opacity: f32, vfx_particle_lifetime: f32, + vfx_particle_density: f32, } pub fn initialize_settings() { @@ -36,6 +37,7 @@ pub fn initialize_settings() { vfx_mode: cursor_vfx::VfxMode::Disabled, vfx_opacity: 200.0, vfx_particle_lifetime: 1.2, + vfx_particle_density: 0.8, }); register_nvim_setting!("cursor_animation_length", CursorSettings::animation_length); @@ -43,6 +45,7 @@ pub fn initialize_settings() { register_nvim_setting!("cursor_vfx_mode", CursorSettings::vfx_mode); register_nvim_setting!("cursor_vfx_opacity", CursorSettings::vfx_opacity); register_nvim_setting!("cursor_vfx_particle_lifetime", CursorSettings::vfx_particle_lifetime); + register_nvim_setting!("cursor_vfx_particle_density", CursorSettings::vfx_particle_density); } // ----------------------------------------------------------------------------