Clamp the zoneviewwidget's topleft point to the scene view area; fix #754
This commit is contained in:
parent
06e5327595
commit
b9f0212c9b
1 changed files with 18 additions and 0 deletions
|
@ -185,6 +185,24 @@ void ZoneViewWidget::paint(QPainter *painter, const QStyleOptionGraphicsItem *op
|
|||
|
||||
void ZoneViewWidget::moveWidget(QPointF scenePos)
|
||||
{
|
||||
if(scenePos.x() < 0)
|
||||
{
|
||||
scenePos.setX(0);
|
||||
} else {
|
||||
qreal maxw = scene()->sceneRect().width() - 100;
|
||||
if(scenePos.x() > maxw)
|
||||
scenePos.setX(maxw);
|
||||
}
|
||||
|
||||
if(scenePos.y() < 0)
|
||||
{
|
||||
scenePos.setY(0);
|
||||
} else {
|
||||
qreal maxh = scene()->sceneRect().height() - 100;
|
||||
if(scenePos.y() > maxh)
|
||||
scenePos.setY(maxh);
|
||||
}
|
||||
|
||||
setPos(scenePos);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue