1
0
Fork 0

Simmplify safe mode granular drag mapping

This commit is contained in:
Robbert van der Helm 2022-11-29 20:34:02 +01:00
parent 3635cfb78e
commit 3ba0ddffee

View file

@ -405,25 +405,19 @@ impl View for RestrictedParamSlider {
}); });
// These positions should be compensated for the DPI scale so it remains // These positions should be compensated for the DPI scale so it remains
// consistent // consistent. When the range is restricted the `delta_x` should also change
let start_x = // accordingly.
util::remap_current_entity_x_t(cx, granular_drag_status.starting_value); let start_x = util::remap_current_entity_x_t(
cx,
// When the range is restricted the `delta_x` should also change (self.renormalize_display)(granular_drag_status.starting_value),
// accordingly );
let min_x = (self.renormalize_event)(0.0);
let max_x = (self.renormalize_event)(1.0);
let delta_x = (*x - granular_drag_status.starting_x_coordinate) let delta_x = (*x - granular_drag_status.starting_x_coordinate)
* GRANULAR_DRAG_MULTIPLIER * GRANULAR_DRAG_MULTIPLIER
* cx.style.dpi_factor as f32 * cx.style.dpi_factor as f32;
* (max_x - min_x);
// We don't use `set_normalized_value_drag` because these values are already self.set_normalized_value_drag(
// in the correct 'remapped' domain
self.param_base.set_normalized_value(
cx, cx,
util::remap_current_entity_x_coordinate(cx, start_x + delta_x) util::remap_current_entity_x_coordinate(cx, start_x + delta_x),
.clamp(min_x, max_x),
); );
} else { } else {
self.granular_drag_status = None; self.granular_drag_status = None;