Account for DPI scaling in granular dragging
This commit is contained in:
parent
e13d79b288
commit
2816b9418e
|
@ -535,17 +535,17 @@ impl View for ParamSlider {
|
||||||
starting_value: self.param_base.unmodulated_normalized_value(),
|
starting_value: self.param_base.unmodulated_normalized_value(),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// These positions should be compensated for the DPI scale so it remains
|
||||||
|
// consistent
|
||||||
|
let start_x =
|
||||||
|
util::remap_current_entity_x_t(cx, granular_drag_status.starting_value);
|
||||||
|
let delta_x = ((*x - granular_drag_status.starting_x_coordinate)
|
||||||
|
* GRANULAR_DRAG_MULTIPLIER)
|
||||||
|
* cx.style.dpi_factor as f32;
|
||||||
|
|
||||||
self.set_normalized_value_drag(
|
self.set_normalized_value_drag(
|
||||||
cx,
|
cx,
|
||||||
util::remap_current_entity_x_coordinate(
|
util::remap_current_entity_x_coordinate(cx, start_x + delta_x),
|
||||||
cx,
|
|
||||||
// This can be optimized a bit
|
|
||||||
util::remap_current_entity_x_t(
|
|
||||||
cx,
|
|
||||||
granular_drag_status.starting_value,
|
|
||||||
) + ((*x - granular_drag_status.starting_x_coordinate)
|
|
||||||
* GRANULAR_DRAG_MULTIPLIER),
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
self.granular_drag_status = None;
|
self.granular_drag_status = None;
|
||||||
|
|
|
@ -344,23 +344,28 @@ impl View for XyPad {
|
||||||
.unmodulated_normalized_value(),
|
.unmodulated_normalized_value(),
|
||||||
});
|
});
|
||||||
|
|
||||||
self.set_normalized_values_for_mouse_pos(
|
// These positions should be compensated for the DPI scale so it remains
|
||||||
cx,
|
// consistent
|
||||||
(
|
let start_x = util::remap_current_entity_x_t(
|
||||||
// This can be optimized a bit
|
|
||||||
util::remap_current_entity_x_t(
|
|
||||||
cx,
|
cx,
|
||||||
granular_drag_status.x_starting_value,
|
granular_drag_status.x_starting_value,
|
||||||
) + ((*x - granular_drag_status.starting_x_coordinate)
|
);
|
||||||
* GRANULAR_DRAG_MULTIPLIER),
|
let delta_x = ((*x - granular_drag_status.starting_x_coordinate)
|
||||||
(util::remap_current_entity_y_t(
|
* GRANULAR_DRAG_MULTIPLIER)
|
||||||
|
* dpi_scale;
|
||||||
|
let start_y = util::remap_current_entity_y_t(
|
||||||
cx,
|
cx,
|
||||||
// NOTE: Just like above, the corodinates go from top to bottom
|
// NOTE: Just like above, the corodinates go from top to bottom
|
||||||
// while we want the X-Y pad to go from bottom to top
|
// while we want the X-Y pad to go from bottom to top
|
||||||
1.0 - granular_drag_status.y_starting_value,
|
1.0 - granular_drag_status.y_starting_value,
|
||||||
) + ((*y - granular_drag_status.starting_y_coordinate)
|
);
|
||||||
* GRANULAR_DRAG_MULTIPLIER)),
|
let delta_y = ((*y - granular_drag_status.starting_y_coordinate)
|
||||||
),
|
* GRANULAR_DRAG_MULTIPLIER)
|
||||||
|
* dpi_scale;
|
||||||
|
|
||||||
|
self.set_normalized_values_for_mouse_pos(
|
||||||
|
cx,
|
||||||
|
(start_x + delta_x, start_y + delta_y),
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
self.granular_drag_status = None;
|
self.granular_drag_status = None;
|
||||||
|
|
Loading…
Reference in a new issue