Fix repeat(no-further-actions) snapshot

master
Jeremy Hu 2018-04-09 08:32:02 +08:00
parent 5407eedad7
commit cd6a973fe7
4 changed files with 20 additions and 6 deletions

View File

@ -343,7 +343,7 @@ void SkeletonDocument::scaleNodeByAddRadius(QUuid nodeId, float amount)
} }
if (isPartReadonly(it->second.partId)) if (isPartReadonly(it->second.partId))
return; return;
it->second.radius += amount; it->second.setRadius(it->second.radius + amount);
emit nodeRadiusChanged(nodeId); emit nodeRadiusChanged(nodeId);
emit skeletonChanged(); emit skeletonChanged();
} }
@ -399,7 +399,7 @@ void SkeletonDocument::setNodeRadius(QUuid nodeId, float radius)
} }
if (isPartReadonly(it->second.partId)) if (isPartReadonly(it->second.partId))
return; return;
it->second.radius = radius; it->second.setRadius(radius);
emit nodeRadiusChanged(nodeId); emit nodeRadiusChanged(nodeId);
emit skeletonChanged(); emit skeletonChanged();
} }

View File

@ -33,6 +33,14 @@ public:
{ {
id = withId.isNull() ? QUuid::createUuid() : withId; id = withId.isNull() ? QUuid::createUuid() : withId;
} }
void setRadius(float toRadius)
{
if (toRadius < 0.01)
toRadius = 0.01;
else if (toRadius > 1)
toRadius = 1;
radius = toRadius;
}
QUuid id; QUuid id;
QUuid partId; QUuid partId;
QString name; QString name;

View File

@ -307,6 +307,7 @@ bool SkeletonGraphicsWidget::mouseMove(QMouseEvent *event)
} }
} }
m_lastScenePos = mouseScenePos; m_lastScenePos = mouseScenePos;
m_moveHappened = true;
return true; return true;
} }
} }
@ -381,7 +382,8 @@ bool SkeletonGraphicsWidget::mouseRelease(QMouseEvent *event)
} }
if (m_moveStarted) { if (m_moveStarted) {
m_moveStarted = false; m_moveStarted = false;
emit groupOperationAdded(); if (m_moveHappened)
emit groupOperationAdded();
} }
if (m_rangeSelectionStarted) { if (m_rangeSelectionStarted) {
m_selectionItem->hide(); m_selectionItem->hide();
@ -477,9 +479,12 @@ bool SkeletonGraphicsWidget::mousePress(QMouseEvent *event)
} }
if (!m_rangeSelectionSet.empty()) { if (!m_rangeSelectionSet.empty()) {
if (!QGuiApplication::queryKeyboardModifiers().testFlag(Qt::ControlModifier)) { if (!QGuiApplication::queryKeyboardModifiers().testFlag(Qt::ControlModifier)) {
m_moveStarted = true; if (!m_moveStarted) {
m_lastScenePos = mouseEventScenePos(event); m_moveStarted = true;
processed = true; m_lastScenePos = mouseEventScenePos(event);
m_moveHappened = false;
processed = true;
}
} }
} }
if (processed) { if (processed) {

View File

@ -331,6 +331,7 @@ private:
bool m_rangeSelectionStarted; bool m_rangeSelectionStarted;
std::set<QGraphicsItem *> m_rangeSelectionSet; std::set<QGraphicsItem *> m_rangeSelectionSet;
bool m_mouseEventFromSelf; bool m_mouseEventFromSelf;
bool m_moveHappened;
}; };
class SkeletonGraphicsContainerWidget : public QWidget class SkeletonGraphicsContainerWidget : public QWidget