MeshLib Documentation
Loading...
Searching...
No Matches
MRMoveObjectByMouse.h
Go to the documentation of this file.
1#pragma once
5#include "MRMesh/MRPlane3.h"
7#include "MRCommonPlugins/exports.h"
8#include "imgui.h"
9
10namespace MR
11{
12
13class Object;
14
15class MoveObjectByMouse : public StateListenerPlugin<DragStartListener, DragListener, DragEndListener, PostDrawListener>
16{
17public:
20
21 MRCOMMONPLUGINS_API static MoveObjectByMouse* instance();
22
23 virtual bool onDisable_() override;
24 virtual void drawDialog( float menuScaling, ImGuiContext* ) override;
25
26 virtual bool blocking() const override { return false; };
27
28private:
29 // Transformation mode
30 enum class XfMode { Move, Rotate, Scale };
31 // Transformation target: pick an object or move selected object(s)
32 enum class XfTarget { Picked, Selected };
33
34 virtual bool onDragStart_( MouseButton btn, int modifiers ) override;
35 virtual bool onDrag_( int x, int y ) override;
36 virtual bool onDragEnd_( MouseButton btn, int modifiers ) override;
37 virtual void postDraw_() override;
38
39 // Same as basic implementation but allows to move selected objects together by holding Shift
40 class MoveObjectByMouseWithSelected : public MoveObjectByMouseImpl
41 {
42 protected:
43 TransformMode pick_( MouseButton button, int modifiers,
44 std::vector<std::shared_ptr<Object>>& objects, Vector3f& centerPoint, Vector3f& startPoint ) override;
45
46 public:
47 // Options are provided externally rather than directly from modifiers
48 UI::RadioButtonOrModifierState modXfMode{}; // XfMode
49 UI::RadioButtonOrModifierState modXfTarget{}; // XfTarget
50 } moveByMouse_;
51};
52
53}
TransformMode
Transformation mode.
Definition MRMoveObjectByMouseImpl.h:53
Definition MRMoveObjectByMouse.h:16
virtual bool onDisable_() override
virtual void drawDialog(float menuScaling, ImGuiContext *) override
static MRCOMMONPLUGINS_API MoveObjectByMouse * instance()
virtual bool blocking() const override
Definition MRMoveObjectByMouse.h:26
Definition MRViewerFwd.h:60
Definition MRCameraOrientationPlugin.h:8
MouseButton
Definition MRMouse.h:9