mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-09-24 13:48:12 +08:00
Fix viewport bounds getting out of sync at times, like when toggling rulers
This commit is contained in:
@@ -342,6 +342,13 @@ impl EditorHandle {
|
||||
self.dispatch(message);
|
||||
}
|
||||
|
||||
/// Zoom the canvas to fit all content
|
||||
#[wasm_bindgen(js_name = zoomCanvasToFitAll)]
|
||||
pub fn zoom_canvas_to_fit_all(&self) {
|
||||
let message = DocumentMessage::ZoomCanvasToFitAll;
|
||||
self.dispatch(message);
|
||||
}
|
||||
|
||||
/// Mouse movement within the screenspace bounds of the viewport
|
||||
#[wasm_bindgen(js_name = onMouseMove)]
|
||||
pub fn on_mouse_move(&self, x: f64, y: f64, mouse_keys: u8, modifiers: u8) {
|
||||
|
||||
@@ -93,11 +93,17 @@ impl log::Log for WasmLog {
|
||||
log::Level::Error => (error, "error", "color:red"),
|
||||
};
|
||||
|
||||
let file = record.file().unwrap_or_else(|| record.target());
|
||||
let line = record.line().map_or_else(|| "[Unknown]".to_string(), |line| line.to_string());
|
||||
let args = record.args();
|
||||
let msg = &format!("%c{name}\t{file}:{line}\n{args}"); // The %c is replaced by the message color
|
||||
log(msg, color)
|
||||
// The %c is replaced by the message color
|
||||
if record.level() == log::Level::Info {
|
||||
// We don't print the file name and line number for info-level logs because it's used for printing the message system logs
|
||||
log(&format!("%c{}\t{}", name, record.args()), color);
|
||||
} else {
|
||||
let file = record.file().unwrap_or_else(|| record.target());
|
||||
let line = record.line().map_or_else(|| "[Unknown]".to_string(), |line| line.to_string());
|
||||
let args = record.args();
|
||||
|
||||
log(&format!("%c{name}\t{file}:{line}\n{args}"), color);
|
||||
}
|
||||
}
|
||||
|
||||
fn flush(&self) {}
|
||||
|
||||
Reference in New Issue
Block a user