mirror of
https://github.com/penpot/penpot.git
synced 2026-03-20 17:33:44 +00:00
🔧 Show label if wasm text editor is enabled
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
pub const DEBUG_VISIBLE: u32 = 0x01;
|
||||
pub const PROFILE_REBUILD_TILES: u32 = 0x02;
|
||||
pub const FAST_MODE: u32 = 0x04;
|
||||
pub const INFO_TEXT: u32 = 0x08;
|
||||
|
||||
@@ -46,16 +46,25 @@ pub fn render_wasm_label(render_state: &mut RenderState) {
|
||||
let mut paint = skia::Paint::default();
|
||||
paint.set_color(skia::Color::GRAY);
|
||||
|
||||
let str = if render_state.options.is_debug_visible() {
|
||||
let mut str = if render_state.options.is_debug_visible() {
|
||||
"WASM RENDERER (DEBUG)"
|
||||
} else {
|
||||
"WASM RENDERER"
|
||||
};
|
||||
let (scalar, _) = render_state.fonts.debug_font().measure_str(str, None);
|
||||
let p = skia::Point::new(width as f32 - 25.0 - scalar, height as f32 - 25.0);
|
||||
let mut p = skia::Point::new(width as f32 - 25.0 - scalar, height as f32 - 25.0);
|
||||
|
||||
let debug_font = render_state.fonts.debug_font();
|
||||
canvas.draw_str(str, p, debug_font, &paint);
|
||||
|
||||
if render_state.options.show_info_text() {
|
||||
str = "TEXT EDITOR / V3";
|
||||
|
||||
let (scalar, _) = render_state.fonts.debug_font().measure_str(str, None);
|
||||
p.x = width as f32 - 25.0 - scalar;
|
||||
p.y -= 20.0;
|
||||
canvas.draw_str(str, p, debug_font, &paint);
|
||||
}
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
|
||||
@@ -31,4 +31,8 @@ impl RenderOptions {
|
||||
pub fn dpr(&self) -> f32 {
|
||||
self.dpr.unwrap_or(1.0)
|
||||
}
|
||||
|
||||
pub fn show_info_text(&self) -> bool {
|
||||
self.flags & options::INFO_TEXT == options::INFO_TEXT
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user