Horizon
tool_drag_polygon_edge.hpp
1 #pragma once
2 #include "core/tool.hpp"
3 #include "util/keep_slope_util.hpp"
4 #include "tool_helper_plane.hpp"
5 
6 namespace horizon {
7 
8 class ToolDragPolygonEdge : public virtual ToolBase, public ToolHelperPlane {
9 public:
10  using ToolBase::ToolBase;
11  ToolResponse begin(const ToolArgs &args) override;
12  ToolResponse update(const ToolArgs &args) override;
13  bool can_begin() override;
14  bool is_specific() override
15  {
16  return true;
17  }
18  std::set<InToolActionID> get_actions() const override
19  {
20  using I = InToolActionID;
21  return {
22  I::LMB,
23  I::CANCEL,
24  I::RMB,
25  };
26  }
27 
28 private:
29  class PolyInfo : public KeepSlopeInfo {
30  public:
31  PolyInfo(const class Polygon &poly, int edge);
32 
33  Coordi arc_center_orig;
34  };
35  std::optional<PolyInfo> poly_info;
36 
37  class Polygon *poly = nullptr;
38  unsigned int edge = 0;
39  Coordi pos_orig;
40  void update_tip();
41 };
42 } // namespace horizon
This is what a Tool receives when the user did something.
Definition: tool_pub.hpp:23
Common interface for all Tools.
Definition: tool_pub.hpp:94
Definition: tool_drag_polygon_edge.hpp:8
bool can_begin() override
Definition: tool_drag_polygon_edge.cpp:9
bool is_specific() override
Definition: tool_drag_polygon_edge.hpp:14
ToolResponse update(const ToolArgs &args) override
Gets called whenever the user generated some sort of input.
Definition: tool_drag_polygon_edge.cpp:59
ToolResponse begin(const ToolArgs &args) override
Gets called right after the constructor has finished.
Definition: tool_drag_polygon_edge.cpp:33
Definition: tool_helper_plane.hpp:5
To signal back to the core what the Tool did, a Tool returns a ToolResponse.
Definition: tool_pub.hpp:40