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:
Keavon Chambers
2021-08-29 00:10:54 -07:00
co-authored by Oliver Davies Dennis Kobert
parent 4421b79ec4
commit 024ce9dcfa
41 changed files with 759 additions and 282 deletions
@@ -4,8 +4,6 @@ use crate::tool::tool_options::ToolOptions;
use crate::Color;
use serde::{Deserialize, Serialize};
pub type Callback = Box<dyn Fn(FrontendMessage)>;
#[impl_message(Message, Frontend)]
#[derive(PartialEq, Clone, Deserialize, Serialize, Debug)]
pub enum FrontendMessage {
@@ -29,34 +27,3 @@ pub enum FrontendMessage {
SetCanvasZoom { new_zoom: f64 },
SetCanvasRotation { new_radians: f64 },
}
pub struct FrontendMessageHandler {
callback: crate::Callback,
}
impl FrontendMessageHandler {
pub fn new(callback: Callback) -> Self {
Self { callback }
}
}
impl MessageHandler<FrontendMessage, ()> for FrontendMessageHandler {
fn process_action(&mut self, message: FrontendMessage, _data: (), _responses: &mut VecDeque<Message>) {
(self.callback)(message)
}
advertise_actions!(
FrontendMessageDiscriminant;
DisplayError,
CollapseFolder,
ExpandFolder,
SetActiveTool,
UpdateCanvas,
UpdateScrollbars,
EnableTextInput,
DisableTextInput,
SetCanvasZoom,
SetCanvasRotation,
OpenDocumentBrowse,
);
}
+1 -1
View File
@@ -1,4 +1,4 @@
pub mod frontend_message_handler;
pub mod layer_panel;
pub use frontend_message_handler::{Callback, FrontendMessage, FrontendMessageDiscriminant, FrontendMessageHandler};
pub use frontend_message_handler::{FrontendMessage, FrontendMessageDiscriminant};