cdglabs / apparatus

A hybrid graphics editor and programming environment for creating interactive diagrams.
http://aprt.us/
MIT License
1.03k stars 58 forks source link

Added ability to select anchors with mouse #42

Open joshuahhh opened 8 years ago

joshuahhh commented 8 years ago

@electronicwhisper: I wanted to play around with adding more point-like elements, so as a warm-up I added support for selecting & dragging anchor points. PTAL!

((( Things that seemed sort of funky to me but eventually turned out to make perfect sense:

  1. You still need to double-click your way down to the anchor from the path. I didn't expect this, before implementing the feature. But I should have, since it fits with Apparatus's general selection method.
  2. Since anchor points are children of the parent path, their highlights will show up when the parent is highlighted. That means putting your mouse near one anchor results in all the fellow anchors being highlighted. But again, this fits with how Apparatus's visualizes single- and double-click targets: double-click targets are never visualized.

This is an interesting point to revisit: is there a good way to signify the double-click affordance? )))

electronicwhisper commented 8 years ago

Great start!!

The dots should be somehow distinguished from the reposition/rescale dots, at least in this situation where you just have the shape selected.

image

(It is particularly confusing if you've just selected a square.)

I haven't entirely thought this through, but Sketch has a decent system for working with anchors. When you just select a shape, it has no handles for the anchor points. When you double click the shape it selects the first anchor point. When an anchor point is selected, all the anchor points in the same path get handles which you can use to select/drag them.

Shape is selected: image

After double click, first anchor is selected, other anchors have handles as long as any anchor in the path is selected: image

Also think about how the interface will work to add points. I want it to feel like using a "pen tool". Sketch might have the most sensible model, but I haven't catalogued all the possibilities / existing solutions.

As for visualizing what would happen with the double click, I think this would be a nice touch. Maybe if you have something selected, subtly highlight the shape that would be selected if you were to double click.