/
TextureToolSelectionTool.h
51 lines (42 loc) · 1.2 KB
/
TextureToolSelectionTool.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#pragma once
#include "i18n.h"
#include "itexturetoolmodel.h"
#include "math/Vector2.h"
#include "selection/SelectionMouseTools.h"
#include "selection/SelectionVolume.h"
namespace ui
{
class TextureToolSelectionTool :
public BasicSelectionTool
{
private:
Vector2 _start; // Position at mouseDown
Vector2 _current; // Position during mouseMove
public:
TextureToolSelectionTool()
{}
virtual const std::string& getName() override
{
static std::string name("TextureToolSelectionTool");
return name;
}
virtual const std::string& getDisplayName() override
{
static std::string displayName(_("Select"));
return displayName;
}
virtual void performSelectionTest(SelectionVolume& volume, SelectionType type, MouseTool::Event& ev) override
{
auto mouseEvent = dynamic_cast<TextureToolMouseEvent*>(&ev);
if (mouseEvent == nullptr) return;
if (type == SelectionType::Area)
{
GlobalTextureToolSelectionSystem().selectArea(volume, SelectionSystem::eToggle);
}
else
{
GlobalTextureToolSelectionSystem().selectPoint(volume, SelectionSystem::eToggle);
}
}
};
}