mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-09-15 22:28:10 +08:00
Improve rendering efficiency and add caching (#95)
Fixes #84 *Reduce heap allocations * Add caching for rendering svgs * Deduplicate UpdateCanvas Responses
This commit is contained in:
committed by
Keavon Chambers
parent
457c465342
commit
fc10575dfa
@@ -328,7 +328,7 @@ export default defineComponent({
|
||||
},
|
||||
},
|
||||
mounted() {
|
||||
registerResponseHandler(ResponseType["Document::UpdateCanvas"], (responseData) => {
|
||||
registerResponseHandler(ResponseType["Tool::UpdateCanvas"], (responseData) => {
|
||||
this.viewportSvg = responseData;
|
||||
});
|
||||
registerResponseHandler(ResponseType["Tool::SetActiveTool"], (responseData) => {
|
||||
|
||||
@@ -9,7 +9,7 @@ declare global {
|
||||
}
|
||||
|
||||
export enum ResponseType {
|
||||
"Document::UpdateCanvas" = "Document::UpdateCanvas",
|
||||
"Tool::UpdateCanvas" = "Tool::UpdateCanvas",
|
||||
"Document::ExpandFolder" = "Document::ExpandFolder",
|
||||
"Document::CollapseFolder" = "Document::CollapseFolder",
|
||||
"Tool::SetActiveTool" = "Tool::SetActiveTool",
|
||||
|
||||
@@ -31,7 +31,6 @@ fn handle_response(response: Response) {
|
||||
let response_type = response.to_string();
|
||||
match response {
|
||||
Response::Document(doc) => match doc {
|
||||
DocumentResponse::UpdateCanvas { document } => send_response(response_type, &[document]),
|
||||
DocumentResponse::ExpandFolder { path, children } => {
|
||||
let children = children
|
||||
.iter()
|
||||
@@ -41,7 +40,9 @@ fn handle_response(response: Response) {
|
||||
send_response(response_type, &[path_to_string(path), children])
|
||||
}
|
||||
DocumentResponse::CollapseFolder { path } => send_response(response_type, &[path_to_string(path)]),
|
||||
DocumentResponse::DocumentChanged => log::error!("Wasm wrapper got request to update the document"),
|
||||
},
|
||||
Response::Tool(ToolResponse::UpdateCanvas { document }) => send_response(response_type, &[document]),
|
||||
Response::Tool(ToolResponse::SetActiveTool { tool_name }) => send_response(response_type, &[tool_name]),
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user