src/editmodes/selectmode.cc

changeset 823
1a2f593f0c02
child 824
6add2126e7ff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/editmodes/selectmode.cc	Fri Jul 04 22:19:01 2014 +0300
@@ -0,0 +1,35 @@
+#include <QMouseEvent>
+#include "../glRenderer.h"
+#include "selectmode.h"
+
+SelectMode::SelectMode (GLRenderer* renderer) :
+	Super (renderer) {}
+
+EditModeType SelectMode::type() const
+{
+	return EditModeType::Select;
+}
+
+void SelectMode::mouseReleased (MouseEventData const& data)
+{
+	if (not data.mouseMoved)
+		_rangepick = false;
+
+	if (not _rangepick)
+		_addpick = (data.keymods & Qt::ControlModifier);
+
+	if (not data.mouseMoved || _rangepick)
+		renderer()->pick (data.ev->x(), data.ev->y());
+}
+
+void SelectMode::mousePressed (MouseEventData const& data)
+{
+	if (data.ev->modifiers() & Qt::ControlModifier)
+	{
+		_rangepick = true;
+		_rangeStart.setX (data.ev->x());
+		_rangeStart.setY (data.ev->y());
+		_addpick = (data.keymods & Qt::AltModifier);
+		data.ev->accept();
+	}
+}
\ No newline at end of file

mercurial