ShapeTool class
#include <Jazz2/Editor/Tools/ShapeTool.h>
Draws a line, the outline of a rectangle, or an ellipse with the stamp.
The shape is chosen in the options of the tool (see ToolShape). A drag from one corner to the other shows the shape, it's painted when the pointer is let go, the right button erases it instead. Shift keeps a line at the steps of 45 degrees and a rectangle or an ellipse square. The stamp repeats from the corner the drag started at, so a pattern stays seamless, and the options of the tile tools apply as to the rectangle.
Base classes
- class StrokeTool
- Base of the tools that paint tiles.
Public static functions
- static void GetShapeCells(ToolShape shape, Vector2i from, Vector2i to, SmallVectorImpl<Vector2i>& cells)
- Returns the cells of a shape drawn from one cell to another, each once.
- static auto Constrain(ToolShape shape, Vector2i from, Vector2i to) -> Vector2i
- Returns the end of a drag kept at the steps of 45 degrees for a line, or square for the other shapes.
Constructors, destructors, conversion operators
Public functions
- auto GetType() const -> EditorToolType override
- Returns the type.
- void OnDeactivate() override
- Called when another tool is chosen, anything in progress is cancelled.
- void OnPointerDown(const ToolPointer& pointer) override
- Called when the pointer is pressed over the view.
- void OnPointerMove(const ToolPointer& pointer) override
- Called when the pointer moves over the view, pressed or not.
- void OnPointerUp(const ToolPointer& pointer) override
- Called when the pointer is released.
- void Cancel() override
- Cancels what the tool is doing.
- auto IsBusy() const -> bool override
- Returns
trueif the tool is in the middle of something. - void DrawOverlay(Painter& painter, const ToolPointer& hover, bool hoverValid) override
- Draws what the tool shows over the view.
- auto GetHint() const -> StringView override
- Returns a hint of how the tool is used.
- void BuildOptions(ToolOptionsBuilder& builder) override
- Makes the options of the tool shown in the toolbar while it's chosen, none by default.