refactor(editor): dedup native format_panel_number into op-editor-ui::util

Follow-up to the helper hoist: op-host-native press_helpers.rs still carried a
byte-identical format_panel_number copy (flagged in codex review). Re-point it
to the shared op_editor_ui::util helper.
This commit is contained in:
Kayshen-X 2026-06-19 09:35:08 +08:00
parent 2fe93047a1
commit 1d4ac76cbc

View file

@ -3,6 +3,7 @@
//! agent-settings modal press dispatcher.
use super::WidgetHostNative;
use op_editor_ui::util::format_panel_number;
use op_editor_ui::Point2D;
fn create_initial_size_for_tool(tool: op_editor_core::Tool) -> (f64, f64) {
@ -843,14 +844,6 @@ pub(in crate::widget_host) fn property_focus_initial(
}
}
fn format_panel_number(value: f32) -> String {
if value.fract().abs() < f32::EPSILON {
format!("{}", value.round() as i32)
} else {
format!("{value:.2}")
}
}
/// Translate a shell-core `ColorTarget` into op-editor-core's — used
/// by `press.rs`'s `OpenColorPicker` branch.
pub(in crate::widget_host) fn color_target(