18 |
18 |
19 #include <QMouseEvent> |
19 #include <QMouseEvent> |
20 #include "magicwandmode.h" |
20 #include "magicwandmode.h" |
21 #include "../ldDocument.h" |
21 #include "../ldDocument.h" |
22 #include "../mainWindow.h" |
22 #include "../mainWindow.h" |
|
23 #include "../glRenderer.h" |
23 |
24 |
24 MagicWandMode::MagicWandMode (GLRenderer* renderer) : |
25 MagicWandMode::MagicWandMode (GLRenderer* renderer) : |
25 Super (renderer) |
26 Super (renderer) |
26 { |
27 { |
27 // Get vertex<->object data |
28 // Get vertex<->object data |
35 } |
36 } |
36 |
37 |
37 EditModeType MagicWandMode::type() const |
38 EditModeType MagicWandMode::type() const |
38 { |
39 { |
39 return EditModeType::MagicWand; |
40 return EditModeType::MagicWand; |
40 } |
|
41 |
|
42 bool MagicWandMode::allowFreeCamera() const |
|
43 { |
|
44 return true; |
|
45 } |
41 } |
46 |
42 |
47 void MagicWandMode::fillBoundaries (LDObjectPtr obj, QVector<BoundaryType>& boundaries, QVector<LDObjectPtr>& candidates) |
43 void MagicWandMode::fillBoundaries (LDObjectPtr obj, QVector<BoundaryType>& boundaries, QVector<LDObjectPtr>& candidates) |
48 { |
44 { |
49 // All boundaries obviously share vertices with the object, therefore they're all in the list |
45 // All boundaries obviously share vertices with the object, therefore they're all in the list |
200 bool MagicWandMode::mouseReleased (MouseEventData const& data) |
196 bool MagicWandMode::mouseReleased (MouseEventData const& data) |
201 { |
197 { |
202 if (Super::mouseReleased (data)) |
198 if (Super::mouseReleased (data)) |
203 return true; |
199 return true; |
204 |
200 |
205 MagicType wandtype = MagicWandMode::Set; |
201 if (data.releasedButtons & Qt::LeftButton) |
206 |
202 { |
207 if (data.keymods & Qt::ShiftModifier) |
203 MagicType wandtype = MagicWandMode::Set; |
208 wandtype = MagicWandMode::Additive; |
204 |
209 elif (data.keymods & Qt::ControlModifier) |
205 if (data.keymods & Qt::ShiftModifier) |
210 wandtype = MagicWandMode::Subtractive; |
206 wandtype = MagicWandMode::Additive; |
211 |
207 elif (data.keymods & Qt::ControlModifier) |
212 doMagic (renderer()->pickOneObject (data.ev->x(), data.ev->y()), wandtype); |
208 wandtype = MagicWandMode::Subtractive; |
213 return true; |
209 |
214 } |
210 doMagic (renderer()->pickOneObject (data.ev->x(), data.ev->y()), wandtype); |
|
211 return true; |
|
212 } |
|
213 |
|
214 return false; |
|
215 } |