Exposed setting for particle density

macos-click-through
Jon Valdés 5 years ago
parent 885aca19da
commit 7fd6df50ce

@ -181,8 +181,6 @@ impl ParticleTrail {
} }
} }
const PARTICLE_DENSITY: f32 = 0.008;
impl CursorVfx for ParticleTrail { impl CursorVfx for ParticleTrail {
fn update(&mut self, settings: &CursorSettings, current_cursor_dest: Point, dt: f32) -> bool { fn update(&mut self, settings: &CursorSettings, current_cursor_dest: Point, dt: f32) -> bool {
// Update lifetimes and remove dead particles // Update lifetimes and remove dead particles
@ -209,7 +207,7 @@ impl CursorVfx for ParticleTrail {
let travel_distance = travel.length(); let travel_distance = travel.length();
// Increase amount of particles when cursor travels further // Increase amount of particles when cursor travels further
// TODO -- particle count should not depend on font size // 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; let prev_p = self.previous_cursor_dest;

@ -26,6 +26,7 @@ pub struct CursorSettings {
vfx_mode: cursor_vfx::VfxMode, vfx_mode: cursor_vfx::VfxMode,
vfx_opacity: f32, vfx_opacity: f32,
vfx_particle_lifetime: f32, vfx_particle_lifetime: f32,
vfx_particle_density: f32,
} }
pub fn initialize_settings() { pub fn initialize_settings() {
@ -36,6 +37,7 @@ pub fn initialize_settings() {
vfx_mode: cursor_vfx::VfxMode::Disabled, vfx_mode: cursor_vfx::VfxMode::Disabled,
vfx_opacity: 200.0, vfx_opacity: 200.0,
vfx_particle_lifetime: 1.2, vfx_particle_lifetime: 1.2,
vfx_particle_density: 0.8,
}); });
register_nvim_setting!("cursor_animation_length", CursorSettings::animation_length); 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_mode", CursorSettings::vfx_mode);
register_nvim_setting!("cursor_vfx_opacity", CursorSettings::vfx_opacity); 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_lifetime", CursorSettings::vfx_particle_lifetime);
register_nvim_setting!("cursor_vfx_particle_density", CursorSettings::vfx_particle_density);
} }
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------

Loading…
Cancel
Save