Improve moving items on scene smart-pattern/valentina#53.

Increase delay to 160 ms. Set static margins.
This commit is contained in:
Roman Telezhynskyi 2020-06-20 12:08:59 +03:00
parent 0efb32d475
commit d08da56764
5 changed files with 10 additions and 10 deletions

View File

@ -195,8 +195,8 @@ QVariant VToolBasePoint::itemChange(QGraphicsItem::GraphicsItemChange change, co
if (VMainGraphicsView *view = qobject_cast<VMainGraphicsView *>(viewList.at(0)))
{
const qreal scale = SceneScale(scene());
const int xmargin = qCeil(50/scale);
const int ymargin = qCeil(50/scale);
const int xmargin = 5;
const int ymargin = 5;
const QRectF viewRect = VMainGraphicsView::SceneVisibleArea(view);
const QRectF itemRect = mapToScene(boundingRect()).boundingRect();

View File

@ -978,8 +978,8 @@ QVariant VToolSeamAllowance::itemChange(QGraphicsItem::GraphicsItemChange change
if (VMainGraphicsView *view = qobject_cast<VMainGraphicsView *>(viewList.at(0)))
{
const qreal scale = SceneScale(scene());
const int xmargin = qCeil(50/scale);
const int ymargin = qCeil(50/scale);
const int xmargin = 5;
const int ymargin = 5;
const QRectF viewRect = VMainGraphicsView::SceneVisibleArea(view);
const QRectF itemRect = mapToScene(boundingRect()|childrenBoundingRect()).boundingRect();
@ -988,7 +988,7 @@ QVariant VToolSeamAllowance::itemChange(QGraphicsItem::GraphicsItemChange change
if (itemRect.height() + 2*ymargin < viewRect.height() &&
itemRect.width() + 2*xmargin < viewRect.width())
{
view->EnsureVisibleWithDelay(itemRect, VMainGraphicsView::scrollDelay, xmargin, ymargin);
view->EnsureVisibleWithDelay(this, VMainGraphicsView::scrollDelay, xmargin, ymargin);
}
else
{

View File

@ -175,8 +175,8 @@ QVariant VControlPointSpline::itemChange(QGraphicsItem::GraphicsItemChange chang
if (VMainGraphicsView *view = qobject_cast<VMainGraphicsView *>(viewList.at(0)))
{
const qreal scale = SceneScale(scene());
const int xmargin = qCeil(50/scale);
const int ymargin = qCeil(50/scale);
const int xmargin = 5;
const int ymargin = 5;
const QRectF viewRect = VMainGraphicsView::SceneVisibleArea(view);
const QRectF itemRect = sceneBoundingRect();

View File

@ -202,8 +202,8 @@ QVariant VGraphicsSimpleTextItem::itemChange(GraphicsItemChange change, const QV
if (VMainGraphicsView *view = qobject_cast<VMainGraphicsView *>(viewList.at(0)))
{
const qreal scale = SceneScale(scene());
int xmargin = qCeil(50/scale);
int ymargin = qCeil(50/scale);
int xmargin = 5;
int ymargin = 5;
const QRectF viewRect = VMainGraphicsView::SceneVisibleArea(view);
const QRectF itemRect = mapToScene(boundingRect()).boundingRect();

View File

@ -411,7 +411,7 @@ void GraphicsViewZoom::PinchTriggered(QPinchGesture *gesture)
}
}
const unsigned long VMainGraphicsView::scrollDelay = 80;
const unsigned long VMainGraphicsView::scrollDelay = 160;
//---------------------------------------------------------------------------------------------------------------------
/**