mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-09-24 03:38:11 +08:00
Implement anchor and handle point rendering with the Path Tool (#353)
* Implement Path Tool * Draw a red rectangle where the first point on the shape is * Correctly render anchors, handles, and connecting lines * Fix drain() which can panic * Refactor frontend messages to work as return values not callbacks * Reduce the number of unnecessary frontend updates * Fix stack overflow by using a loop * Group Document Render calls and put them at the end * Speed hacks for dirtification * Add performance * Bunch folder changed updates * Add triggers to redraw overlays to movement_handler * Polish the pixel-perfect rendering of vector manipulators * Restore scrollbars that were disabled * Cleanup * WIP Add shape outline rendering * Fix compiling * Add outlines to selected shapes * Fix outlines rendering over handles and anchors * Fix dirtification * Add a comment * Address code review feedback * Formatting * Small tweaks Co-authored-by: Oliver Davies <oliver@psyfer.io> Co-authored-by: Dennis Kobert <dennis@kobert.dev>
This commit is contained in:
co-authored by
Oliver Davies
Dennis Kobert
parent
4421b79ec4
commit
024ce9dcfa
+8
-9
@@ -26,9 +26,6 @@ pub use graphene::LayerId;
|
||||
#[doc(inline)]
|
||||
pub use graphene::document::Document as SvgDocument;
|
||||
|
||||
#[doc(inline)]
|
||||
pub use frontend::Callback;
|
||||
|
||||
use communication::dispatcher::Dispatcher;
|
||||
// TODO: serialize with serde to save the current editor state
|
||||
pub struct Editor {
|
||||
@@ -38,14 +35,16 @@ pub struct Editor {
|
||||
use message_prelude::*;
|
||||
|
||||
impl Editor {
|
||||
pub fn new(callback: Callback) -> Self {
|
||||
Self {
|
||||
dispatcher: Dispatcher::new(callback),
|
||||
}
|
||||
pub fn new() -> Self {
|
||||
Self { dispatcher: Dispatcher::new() }
|
||||
}
|
||||
|
||||
pub fn handle_message<T: Into<Message>>(&mut self, message: T) -> Result<(), EditorError> {
|
||||
self.dispatcher.handle_message(message)
|
||||
pub fn handle_message<T: Into<Message>>(&mut self, message: T) -> Result<Vec<FrontendMessage>, EditorError> {
|
||||
self.dispatcher.handle_message(message).map(|_| {
|
||||
let mut responses = Vec::new();
|
||||
std::mem::swap(&mut responses, &mut self.dispatcher.responses);
|
||||
responses
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user