forked from mirror/openmw-tes3mp
properly abort drags from outside the worldspace widget (code was leaving unclean dragging flags behind)
This commit is contained in:
parent
70745487f3
commit
51a4e3fa7d
3 changed files with 20 additions and 13 deletions
|
@ -97,10 +97,7 @@ void CSVRender::InstanceMode::setEditLock (bool locked)
|
|||
mLocked = locked;
|
||||
|
||||
if (mLocked)
|
||||
{
|
||||
mDragMode = DragMode_None;
|
||||
getWorldspaceWidget().reset (Mask_Reference);
|
||||
}
|
||||
getWorldspaceWidget().abortDrag();
|
||||
}
|
||||
|
||||
void CSVRender::InstanceMode::primaryEditPressed (osg::ref_ptr<TagBase> tag)
|
||||
|
@ -457,7 +454,6 @@ int CSVRender::InstanceMode::getSubMode() const
|
|||
|
||||
void CSVRender::InstanceMode::subModeChanged (const std::string& id)
|
||||
{
|
||||
mDragMode = DragMode_None;
|
||||
getWorldspaceWidget().reset (Mask_Reference);
|
||||
getWorldspaceWidget().abortDrag();
|
||||
getWorldspaceWidget().setSubMode (getSubModeFromId (id), Mask_Reference);
|
||||
}
|
||||
|
|
|
@ -364,6 +364,17 @@ osg::Vec3f CSVRender::WorldspaceWidget::getIntersectionPoint (const QPoint& loca
|
|||
return start + direction * CSMPrefs::get()["Scene Drops"]["distance"].toInt();
|
||||
}
|
||||
|
||||
void CSVRender::WorldspaceWidget::abortDrag()
|
||||
{
|
||||
if (mDragging)
|
||||
{
|
||||
EditMode& editMode = dynamic_cast<CSVRender::EditMode&> (*mEditMode->getCurrent());
|
||||
|
||||
editMode.dragAborted();
|
||||
mDragging = false;
|
||||
}
|
||||
}
|
||||
|
||||
void CSVRender::WorldspaceWidget::dragEnterEvent (QDragEnterEvent* event)
|
||||
{
|
||||
const CSMWorld::TableMimeData* mime = dynamic_cast<const CSMWorld::TableMimeData*> (event->mimeData());
|
||||
|
@ -736,13 +747,7 @@ void CSVRender::WorldspaceWidget::keyPressEvent (QKeyEvent *event)
|
|||
{
|
||||
if(event->key() == Qt::Key_Escape)
|
||||
{
|
||||
if (mDragging)
|
||||
{
|
||||
EditMode& editMode = dynamic_cast<CSVRender::EditMode&> (*mEditMode->getCurrent());
|
||||
|
||||
editMode.dragAborted();
|
||||
mDragging = false;
|
||||
}
|
||||
abortDrag();
|
||||
}
|
||||
else
|
||||
RenderWidget::keyPressEvent(event);
|
||||
|
|
|
@ -161,6 +161,12 @@ namespace CSVRender
|
|||
/// Erase all overrides and restore the visual representation to its true state.
|
||||
virtual void reset (unsigned int elementMask) = 0;
|
||||
|
||||
/// \note Drags will be automatically aborted when the aborting is triggered
|
||||
/// (either explicitly or implicitly) from within this class. This function only
|
||||
/// needs to be called, when the drag abort is triggered externally (e.g. from
|
||||
/// an edit mode).
|
||||
void abortDrag();
|
||||
|
||||
protected:
|
||||
|
||||
/// Visual elements in a scene
|
||||
|
|
Loading…
Reference in a new issue