mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-16 18:19:55 +00:00
some code simplification
This commit is contained in:
parent
c2a8be9048
commit
d57021b23c
2 changed files with 10 additions and 19 deletions
|
@ -27,7 +27,7 @@ int CSVRender::InstanceMode::getSubModeFromId (const std::string& id) const
|
|||
|
||||
CSVRender::InstanceMode::InstanceMode (WorldspaceWidget *worldspaceWidget, QWidget *parent)
|
||||
: EditMode (worldspaceWidget, QIcon (":placeholder"), Mask_Reference, "Instance editing",
|
||||
parent), mSubMode (0), mSelectionMode (0), mDragMode (DragMode_None), mDragAxis (0)
|
||||
parent), mSubMode (0), mSelectionMode (0), mDragMode (DragMode_None), mDragAxis (-1)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -165,10 +165,11 @@ bool CSVRender::InstanceMode::primaryEditStartDrag (osg::ref_ptr<TagBase> tag)
|
|||
if (CSVRender::ObjectMarkerTag *objectTag = dynamic_cast<CSVRender::ObjectMarkerTag *> (tag.get()))
|
||||
{
|
||||
mDragAxis = objectTag->mAxis;
|
||||
mDragMode = DragMode_MoveAxis;
|
||||
}
|
||||
else
|
||||
mDragMode = DragMode_Move;
|
||||
mDragAxis = -1;
|
||||
|
||||
mDragMode = DragMode_Move;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -197,17 +198,12 @@ void CSVRender::InstanceMode::drag (int diffX, int diffY, double speedFactor)
|
|||
|
||||
switch (mDragMode)
|
||||
{
|
||||
case DragMode_MoveAxis:
|
||||
{
|
||||
for (int i=0; i<3; ++i)
|
||||
if (i!=mDragAxis)
|
||||
offset[i] = 0;
|
||||
|
||||
// Fall through
|
||||
}
|
||||
|
||||
case DragMode_Move:
|
||||
{
|
||||
if (mDragAxis!=-1)
|
||||
for (int i=0; i<3; ++i)
|
||||
if (i!=mDragAxis)
|
||||
offset[i] = 0;
|
||||
|
||||
std::vector<osg::ref_ptr<TagBase> > selection =
|
||||
getWorldspaceWidget().getEdited (Mask_Reference);
|
||||
|
@ -242,10 +238,7 @@ void CSVRender::InstanceMode::dragCompleted()
|
|||
|
||||
switch (mDragMode)
|
||||
{
|
||||
case DragMode_Move:
|
||||
case DragMode_MoveAxis:
|
||||
|
||||
description = "Move Instances"; break;
|
||||
case DragMode_Move: description = "Move Instances"; break;
|
||||
|
||||
case DragMode_None: break;
|
||||
}
|
||||
|
|
|
@ -19,9 +19,7 @@ namespace CSVRender
|
|||
enum DragMode
|
||||
{
|
||||
DragMode_None,
|
||||
DragMode_Move,
|
||||
DragMode_MoveAxis
|
||||
|
||||
DragMode_Move
|
||||
};
|
||||
|
||||
CSVWidget::SceneToolMode *mSubMode;
|
||||
|
|
Loading…
Reference in a new issue