diff options
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/edgeitem.cpp | 8 | ||||
-rw-r--r-- | src/gui/tikzscene.cpp | 40 | ||||
-rw-r--r-- | src/gui/tikzscene.h | 2 | ||||
-rw-r--r-- | src/gui/undocommands.cpp | 6 |
4 files changed, 29 insertions, 27 deletions
diff --git a/src/gui/edgeitem.cpp b/src/gui/edgeitem.cpp index 08a5ad1..ec87815 100644 --- a/src/gui/edgeitem.cpp +++ b/src/gui/edgeitem.cpp @@ -11,14 +11,14 @@ EdgeItem::EdgeItem(Edge *edge) _cp1Item = new QGraphicsEllipseItem(this); _cp1Item->setParentItem(this); - _cp1Item->setRect(GLOBAL_SCALEF * (-0.1), GLOBAL_SCALEF * (-0.1), - GLOBAL_SCALEF * 0.2, GLOBAL_SCALEF * 0.2); + _cp1Item->setRect(GLOBAL_SCALEF * (-0.05), GLOBAL_SCALEF * (-0.05), + GLOBAL_SCALEF * 0.1, GLOBAL_SCALEF * 0.1); _cp1Item->setVisible(false); _cp2Item = new QGraphicsEllipseItem(this); _cp2Item->setParentItem(this); - _cp2Item->setRect(GLOBAL_SCALEF * (-0.1), GLOBAL_SCALEF * (-0.1), - GLOBAL_SCALEF * 0.2, GLOBAL_SCALEF * 0.2); + _cp2Item->setRect(GLOBAL_SCALEF * (-0.05), GLOBAL_SCALEF * (-0.05), + GLOBAL_SCALEF * 0.1, GLOBAL_SCALEF * 0.1); _cp2Item->setVisible(false); readPos(); diff --git a/src/gui/tikzscene.cpp b/src/gui/tikzscene.cpp index 927809e..f303fab 100644 --- a/src/gui/tikzscene.cpp +++ b/src/gui/tikzscene.cpp @@ -84,7 +84,6 @@ void TikzScene::mousePressEvent(QGraphicsSceneMouseEvent *event) { if (!_enabled) return; - // current mouse position, in scene coordinates _mouseDownPos = event->scenePos(); @@ -498,6 +497,7 @@ int TikzScene::lineNumberForSelection() if (NodeItem *ni = dynamic_cast<NodeItem*>(gi)) return ni->node()->tikzLine(); if (EdgeItem *ei = dynamic_cast<EdgeItem*>(gi)) return ei->edge()->tikzLine(); } + return 0; } @@ -635,25 +635,25 @@ void TikzScene::reloadStyles() } } -void TikzScene::refreshSceneBounds() -{ -// if (!views().empty()) { -// QGraphicsView *v = views().first(); -// QRectF viewB = v->mapToScene(v->viewport()->rect()).boundingRect(); -// //QPointF tl = v->mapToScene(viewB.topLeft()); -// //viewB.setTopLeft(tl); - -// QRectF bounds = viewB.united(rectToScreen(graph()->realBbox().adjusted(-1.0f, -1.0f, 1.0f, 1.0f))); -// //qDebug() << viewB; - -// if (bounds != sceneRect()) { -// QPointF c = viewB.center(); -// setSceneRect(bounds); -// v->centerOn(c); -// } -// } - //setBounds(graphB); -} +// void TikzScene::refreshSceneBounds() +// { +// // if (!views().empty()) { +// // QGraphicsView *v = views().first(); +// // QRectF viewB = v->mapToScene(v->viewport()->rect()).boundingRect(); +// // //QPointF tl = v->mapToScene(viewB.topLeft()); +// // //viewB.setTopLeft(tl); +// +// // QRectF bounds = viewB.united(rectToScreen(graph()->realBbox().adjusted(-1.0f, -1.0f, 1.0f, 1.0f))); +// // //qDebug() << viewB; +// +// // if (bounds != sceneRect()) { +// // QPointF c = viewB.center(); +// // setSceneRect(bounds); +// // v->centerOn(c); +// // } +// // } +// //setBounds(graphB); +// } void TikzScene::refreshAdjacentEdges(QList<Node*> nodes) { diff --git a/src/gui/tikzscene.h b/src/gui/tikzscene.h index 3b4a1e1..fe1f784 100644 --- a/src/gui/tikzscene.h +++ b/src/gui/tikzscene.h @@ -36,7 +36,7 @@ public: TikzDocument *tikzDocument() const; void setTikzDocument(TikzDocument *tikzDocument); void reloadStyles(); - void refreshSceneBounds(); + //void refreshSceneBounds(); void applyActiveStyleToNodes(); void deleteSelectedItems(); void copyToClipboard(); diff --git a/src/gui/undocommands.cpp b/src/gui/undocommands.cpp index 4c5d0dc..6d3162c 100644 --- a/src/gui/undocommands.cpp +++ b/src/gui/undocommands.cpp @@ -11,14 +11,16 @@ GraphUpdateCommand::GraphUpdateCommand(TikzScene *scene, QUndoCommand *parent) : void GraphUpdateCommand::undo() { _scene->tikzDocument()->refreshTikz(); - _scene->refreshSceneBounds(); + //refreshSceneBounds does nothing + //_scene->refreshSceneBounds(); _scene->invalidate(); } void GraphUpdateCommand::redo() { _scene->tikzDocument()->refreshTikz(); - _scene->refreshSceneBounds(); + //refreshSceneBounds does nothing + //_scene->refreshSceneBounds(); _scene->invalidate(); } |