Merge pull request #773 from ctrlaltca/fix_754
Clamp the zoneviewwidget's topleft point to the scene view area; fix #754
This commit is contained in:
commit
a984a9ea69
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)
|
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);
|
setPos(scenePos);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue