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  std::optional<PolyInfo> poly_info;
34 
35  class Polygon *poly = nullptr;
36  unsigned int edge = 0;
37  Coordi pos_orig;
38  void update_tip();
39 };
40 } // namespace horizon
This is what a Tool receives when the user did something.
Definition: tool.hpp:23
Common interface for all Tools.
Definition: tool.hpp:121
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:58
ToolResponse begin(const ToolArgs &args) override
Gets called right after the constructor has finished.
Definition: tool_drag_polygon_edge.cpp:32
Definition: tool_helper_plane.hpp:5
To signal back to the core what the Tool did, a Tool returns a ToolResponse.
Definition: tool.hpp:42