pub const BBOX_MIN_SCREEN_SPAN_DP: f32 = 4.0;
pub const BBOX_BASE_HANDLE_SIZE_DP: f32 = 5.0;
pub const BBOX_HANDLE_ZOOM_EXP: f32 = 0.1;
pub const BBOX_KNOB_OUTWARD_OFFSET_FACTOR: f32 = 1.5;
pub const BBOX_KNOB_HIT_HALF_EXTENT_DP: f32 = 7.5;
pub const BBOX_RAY_FALLTHROUGH_MAX_T: f64 = 0.7;
pub const BBOX_RAY_SCALE_MAX_T: f64 = 1.7;
pub const BBOX_FLAT_AXIS_THRESHOLD_UPM: f64 = 1.0;
pub const BBOX_ALT_CENTER_SCALE_MULTIPLIER: f64 = 2.0;
pub const BBOX_DASH_STROKE_WIDTH_DP: f32 = 1.75;
pub const BBOX_KNOB_STROKE_WIDTH_DP: f32 = 0.8;
pub const BBOX_PILL_FONT_SIZE_DP: f32 = 11.0;
pub const BBOX_PILL_MIN_HEIGHT_DP: f32 = 12.0;
pub const BBOX_PILL_PAD_X_DP: f32 = 7.0;
pub const BBOX_PILL_CHAR_WIDTH_DP: f32 = 6.5;
pub const BBOX_PILL_OFFSET_DP: f32 = 6.0;
pub const BBOX_PILL_ROUND_FACTOR: f64 = 10.0;
pub const MARQUEE_MAX_SLANT_DEG: f64 = 60.0;
pub const MARQUEE_MAX_SLANT_TAN: f64 = 1.732_050_807_568_877_2;
pub const MARQUEE_ITALIC_SNAP_TOL_DEG: f64 = 2.0;
pub const TRANSFORM_ORIGIN_HIT_RADIUS_DP: f32 = 3.0;
pub const TRANSFORM_CLICK_THRESHOLD_DP: f32 = 2.0;
pub const TRANSFORM_MIN_PIVOT_DIST_UPM: f64 = 5.0;
pub const TRANSFORM_ROTATE_SHIFT_STEP_DEG: f64 = 45.0;
pub const SCALE_SHIFT_SIN_HORIZ_MAX: f64 = 0.2;
pub const SCALE_SHIFT_SIN_VERT_MIN: f64 = 0.86;
pub const SCALE_MIN_FACTOR: f64 = 0.01;
pub const SLANT_MAX_ANGLE_DEG: f64 = 89.0;
pub const ORIGIN_RETICLE_BG_RADIUS_DP: f32 = 8.0;
pub const ORIGIN_RETICLE_STROKE_WIDTH_DP: f32 = 1.2;
pub const ORIGIN_RETICLE_TICK_INNER_DP: f32 = 2.0;
pub const ORIGIN_RETICLE_TICK_OUTER_DP: f32 = 5.0;
pub const ORIGIN_RETICLE_CENTER_HALF_DP: f32 = 1.5;
pub const LASSO_MIN_SAMPLE_STEP_DP: f32 = 2.0;
pub const LASSO_STROKE_WIDTH_DP: f32 = 1.5;
pub const ZOOM_MARQUEE_MIN_SUM_DP: f32 = 10.0;
pub const ZOOM_TOOL_MIN_SCALE: f32 = 0.008;
pub const ZOOM_TOOL_MAX_SCALE: f32 = 40.0;
pub const ZOOM_STEP_NEXT_THRESHOLD: f32 = 1.08;
pub const ZOOM_STEP_PREV_THRESHOLD: f32 = 0.92;
pub const ZOOM_STEPS: [f32; 23] = [
0.008, 0.01, 0.012, 0.018, 0.024, 0.034, 0.05, 0.075, 0.1, 0.16, 0.24, 0.34, 0.5, 0.66, 1.0,
1.5, 2.0, 3.0, 4.0, 6.0, 10.0, 20.0, 40.0,
];
pub const CLIPBOARD_COLLISION_OFFSET_UPM: f64 = 10.0;
pub const PATH_COORD_EPS_UPM: f64 = 0.001;
pub const CURVE_ROOT_T_MIN: f64 = 0.001;
pub const CURVE_ROOT_T_MAX: f64 = 0.999;
pub const CURVE_ROOT_DEDUP_EPS: f64 = 0.0001;
pub const EXTREMUM_MIN_ENDPOINT_DIST_UPM: f64 = 0.8;
pub const EXTREMUM_SMOOTH_ABSORB_DIST_UPM: f64 = 30.0;
pub const INFLECTION_MIN_ENDPOINT_DIST_UPM: f64 = 20.0;
pub const INFLECTION_MIN_CHORD_HEIGHT_UPM: f64 = 0.5;
pub const TIDY_FINE_GRID_THRESHOLD: f64 = 0.99;
pub const TIDY_MINI_CONTOUR_FINE_UPM: f64 = 0.2;
pub const TIDY_MINI_CONTOUR_COARSE_UPM: f64 = 2.0;
pub const TIDY_ZERO_HANDLE_EPS_UPM: f64 = 0.15;
pub const TIDY_MERGE_ONCURVE_FINE_UPM: f64 = 0.01;
pub const TIDY_MERGE_ONCURVE_COARSE_UPM: f64 = 0.6;
pub const TIDY_COLLINEAR_SLOPE_EPS: f64 = 0.01;
pub const CONNECT_MERGE_DIST_UPM: f64 = 1.0;
pub const WARNING_OFFCURVE_DIST_UPM: f64 = 0.1;
pub const GS_COLINEAR_PERP_FACTOR: f64 = 0.25;
pub const WARNING_ONCURVE_RADIUS_EXTRA_DP: f32 = 4.5;
pub const WARNING_OFFCURVE_RADIUS_EXTRA_DP: f32 = 4.5;
pub const PILL_DIGIT_FONT_WIDTH_PX: u32 = 3;
pub const PILL_DIGIT_FONT_HEIGHT_PX: u32 = 5;
pub const PILL_DIGIT_ADVANCE_PX: f32 = 4.0;
#[must_use]
pub const fn pill_digit_bitmap_3x5(ch: char) -> [u8; 5] {
match ch.to_ascii_uppercase() {
'0' | 'O' => [0b111, 0b101, 0b101, 0b101, 0b111],
'1' | 'I' => [0b010, 0b110, 0b010, 0b010, 0b111],
'2' | 'Z' => [0b111, 0b001, 0b111, 0b100, 0b111],
'3' => [0b111, 0b001, 0b111, 0b001, 0b111],
'4' => [0b101, 0b101, 0b111, 0b001, 0b001],
'5' | 'S' => [0b111, 0b100, 0b111, 0b001, 0b111],
'6' | 'G' => [0b111, 0b100, 0b111, 0b101, 0b111],
'7' => [0b111, 0b001, 0b010, 0b010, 0b010],
'8' | 'B' => [0b111, 0b101, 0b111, 0b101, 0b111],
'9' => [0b111, 0b101, 0b111, 0b001, 0b111],
'A' => [0b010, 0b101, 0b111, 0b101, 0b101],
'C' => [0b111, 0b100, 0b100, 0b100, 0b111],
'D' => [0b110, 0b101, 0b101, 0b101, 0b110],
'E' => [0b111, 0b100, 0b111, 0b100, 0b111],
'F' => [0b111, 0b100, 0b111, 0b100, 0b100],
'H' => [0b101, 0b101, 0b111, 0b101, 0b101],
'J' => [0b001, 0b001, 0b001, 0b101, 0b111],
'K' => [0b101, 0b101, 0b110, 0b101, 0b101],
'L' => [0b100, 0b100, 0b100, 0b100, 0b111],
'M' => [0b101, 0b111, 0b111, 0b101, 0b101],
'N' => [0b111, 0b101, 0b101, 0b101, 0b101],
'P' => [0b111, 0b101, 0b111, 0b100, 0b100],
'Q' => [0b111, 0b101, 0b101, 0b111, 0b001],
'R' => [0b111, 0b101, 0b110, 0b101, 0b101],
'T' => [0b111, 0b010, 0b010, 0b010, 0b010],
'U' | 'V' => [0b101, 0b101, 0b101, 0b101, 0b111],
'W' => [0b101, 0b101, 0b111, 0b111, 0b101],
'X' => [0b101, 0b101, 0b010, 0b101, 0b101],
'Y' => [0b101, 0b101, 0b010, 0b010, 0b010],
':' => [0b000, 0b010, 0b000, 0b010, 0b000],
'.' => [0b000, 0b000, 0b000, 0b000, 0b010],
'-' => [0b000, 0b000, 0b111, 0b000, 0b000],
'_' => [0b000, 0b000, 0b000, 0b000, 0b111],
'=' => [0b000, 0b111, 0b000, 0b111, 0b000],
'/' => [0b001, 0b001, 0b010, 0b100, 0b100],
'(' => [0b010, 0b100, 0b100, 0b100, 0b010],
')' => [0b010, 0b001, 0b001, 0b001, 0b010],
'+' => [0b000, 0b010, 0b111, 0b010, 0b000],
'|' => [0b010, 0b010, 0b010, 0b010, 0b010],
'!' => [0b010, 0b010, 0b010, 0b000, 0b010],
_ => [0; 5],
}
}
pub const DEG_TO_RAD_F64: f64 = std::f64::consts::PI / 180.0;
pub const RAD_TO_DEG_F64: f64 = 180.0 / std::f64::consts::PI;
pub const RIGHT_ANGLE_DEG_F64: f64 = 90.0;
pub const FULL_CIRCLE_DEG_F64: f64 = 360.0;
#[must_use]
pub fn bbox_dashed_stroke_color32() -> egui::Color32 {
egui::Color32::from_rgba_unmultiplied(128, 128, 128, 191)
}
#[must_use]
pub fn bbox_knob_fill_color32() -> egui::Color32 {
egui::Color32::from_rgba_unmultiplied(102, 102, 102, 71)
}
#[must_use]
pub fn bbox_knob_stroke_color32() -> egui::Color32 {
egui::Color32::from_rgba_unmultiplied(102, 102, 102, 84)
}
#[must_use]
pub fn bbox_pill_bg_color32() -> egui::Color32 {
egui::Color32::from_rgba_unmultiplied(153, 153, 153, 230)
}
#[must_use]
pub fn bbox_pill_text_color32() -> egui::Color32 {
egui::Color32::from_rgba_unmultiplied(255, 255, 255, 255)
}
#[must_use]
pub fn origin_bg_fill_color32() -> egui::Color32 {
egui::Color32::from_rgba_unmultiplied(0, 0, 0, 51)
}
#[must_use]
pub fn origin_bg_stroke_color32() -> egui::Color32 {
egui::Color32::from_rgba_unmultiplied(128, 128, 128, 255)
}
#[must_use]
pub fn origin_tick_color32() -> egui::Color32 {
egui::Color32::from_rgba_unmultiplied(85, 85, 85, 255)
}
#[must_use]
pub fn lasso_fill_color32() -> egui::Color32 {
egui::Color32::from_rgba_unmultiplied(0, 122, 255, 84)
}
#[must_use]
pub fn lasso_stroke_color32() -> egui::Color32 {
egui::Color32::from_rgba_unmultiplied(0, 122, 255, 255)
}
#[must_use]
pub fn zoom_marquee_fill_color32() -> egui::Color32 {
egui::Color32::from_rgba_unmultiplied(128, 128, 128, 84)
}
#[must_use]
pub fn zoom_marquee_stroke_color32() -> egui::Color32 {
egui::Color32::from_rgba_unmultiplied(128, 128, 128, 255)
}
#[must_use]
pub fn duplicate_line_node_color32() -> egui::Color32 {
egui::Color32::from_rgba_unmultiplied(229, 57, 53, 153)
}
#[must_use]
pub fn duplicate_curve_node_color32() -> egui::Color32 {
egui::Color32::from_rgba_unmultiplied(253, 216, 53, 153)
}
pub const PREVIEW_PANEL_DEFAULT_HEIGHT_DP: f32 = 163.0;
pub const PREVIEW_PANEL_MIN_HEIGHT_DP: f32 = 60.0;
pub const PREVIEW_PANEL_PADDING_DP: f32 = 8.0;
pub const PREVIEW_PANEL_BASELINE_STROKE_WIDTH_DP: f32 = 1.0;
pub const PREVIEW_PANEL_AUTOFIT_MARGIN: f64 = 0.85;
#[must_use]
pub fn preview_panel_bg_normal() -> egui::Color32 {
egui::Color32::from_rgb(255, 255, 255)
}
#[must_use]
pub fn preview_panel_bg_inverted() -> egui::Color32 {
egui::Color32::from_rgb(26, 26, 26)
}
#[must_use]
pub fn preview_panel_fill_normal() -> egui::Color32 {
egui::Color32::from_rgb(0, 0, 0)
}
#[must_use]
pub fn preview_panel_fill_inverted() -> egui::Color32 {
egui::Color32::from_rgb(255, 255, 255)
}
#[must_use]
pub fn preview_panel_baseline_color() -> egui::Color32 {
egui::Color32::from_rgba_unmultiplied(128, 128, 128, 100)
}
#[must_use]
pub fn preview_panel_border_color() -> egui::Color32 {
egui::Color32::from_rgba_unmultiplied(128, 128, 128, 80)
}