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
parent 9e73cce281
commit e75714330c
41 changed files with 759 additions and 282 deletions

View file

@ -10,7 +10,9 @@ use utils::WasmLog;
use wasm_bindgen::prelude::*;
// the thread_local macro provides a way to initialize static variables with non-constant functions
thread_local! { pub static EDITOR_STATE: RefCell<Editor> = RefCell::new(Editor::new(Box::new(handle_response))) }
thread_local! {
pub static EDITOR_STATE: RefCell<Editor> = RefCell::new(Editor::new());
}
static LOGGER: WasmLog = WasmLog;
#[wasm_bindgen(start)]
@ -20,6 +22,12 @@ pub fn init() {
log::set_max_level(log::LevelFilter::Debug);
}
pub fn handle_responses(responses: Vec<FrontendMessage>) {
for response in responses.into_iter() {
handle_response(response)
}
}
#[wasm_bindgen(module = "/../src/utilities/response-handler-binding.ts")]
extern "C" {
#[wasm_bindgen(catch)]