-
Notifications
You must be signed in to change notification settings - Fork 22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Interactive tools for drawing geometric items #9
Comments
I would like to add to this another mode for selecting or picking already drawn geometry. This is probably the most used functionality and can probably also be implemented as a mode. As an algorithm for finding things under the mouse cursor we have the most important thing already, as we can do a quick sort of all |
Good idea @DerLando, I've pulled select mode out into its own issue. Something we'll need to keep in mind is the distinction between UI code/concepts (e.g. the modes) and things which are inherent to the CAD engine (e.g. a |
Ok so the idea is to make a clear distinction between the geometric backend and the ui/application frontend. Although I think providing an easy-to-use abstraction for the most basic building blocks of any
|
Yeah, I imagine we'd expose helper functions like fn select(world: &World, entity: Entity) {
world.write_storage::<Selected>().insert(entity, Selected);
}
/// Look up entities using their location in *Drawing Space*.
fn entities_under_point(
world: &World,
location: Vector,
tolerance: f64) -> impl Iterator<Item = (Entity, &DrawingObject)> {
...
}
/// Look up entities based on their location on a canvas.
fn entities_under_cursor(
world: &World,
viewport: &Viewport,
window_dimensions: kurbo::Size,
location: kurbo::Point,
tolerance: f64) -> impl Iterator<Item = (Entity, &DrawingObject)> {
...
} |
To be a CAD program our WebAssembly demo actually needs to draw things.
There should be a toolbar with buttons to enter specific "drawing modes". When you are in a mode the corresponding button stays pressed (letting the user know which mode they're in) and things like click events get passed to that mode.
For now we'll want to implement a formal mode system, with modes for:
The standard way to implement these modes is with some sort of state machine. I prefer trait objects over enums or strongly typed state machines because they scale more easily and are easier to work with.
(note: this is a big task and will probably require breaking into a dozen smaller issues along the way)
The text was updated successfully, but these errors were encountered: