Call ZoomFitBest() twice before show pattern.

--HG--
branch : develop
This commit is contained in:
dismine 2014-07-26 11:56:34 +03:00
parent 2cf032461d
commit c0c407f8a8
3 changed files with 28 additions and 8 deletions

View File

@ -2022,15 +2022,8 @@ void MainWindow::LoadPattern(const QString &fileName)
qApp->setOpeningPattern();// End opening file qApp->setOpeningPattern();// End opening file
VAbstractTool::NewSceneRect(sceneDraw, view);
VAbstractTool::NewSceneRect(sceneDetails, view);
//Fit scene size to best size for first show //Fit scene size to best size for first show
ActionDetails(true); ZoomFirstShow();
view->ZoomFitBest();
ActionDraw(true);
view->ZoomFitBest();
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
@ -2127,3 +2120,28 @@ void MainWindow::EndVisualization(bool click)
dialogTool->ShowDialog(click); dialogTool->ShowDialog(click);
} }
} }
//---------------------------------------------------------------------------------------------------------------------
/**
* @brief ZoomFirstShow Fit scene size to best size for first show
*/
void MainWindow::ZoomFirstShow()
{
/* If don't call ZoomFitBest() twice, after first scaling or moving pattern piece, scene change coordinate and whole
* pattern will be moved. Looks very ugly. It is best solution that i have now.
*/
ActionDetails(true);
view->ZoomFitBest();
ActionDraw(true);
view->ZoomFitBest();
VAbstractTool::NewSceneRect(sceneDraw, view);
VAbstractTool::NewSceneRect(sceneDetails, view);
ActionDetails(true);
view->ZoomFitBest();
ActionDraw(true);
view->ZoomFitBest();
}

View File

@ -239,6 +239,7 @@ private:
* @brief EndVisualization try show dialog after and working with tool visualization. * @brief EndVisualization try show dialog after and working with tool visualization.
*/ */
void EndVisualization(bool click = false); void EndVisualization(bool click = false);
void ZoomFirstShow();
}; };
#endif // MAINWINDOW_H #endif // MAINWINDOW_H

View File

@ -157,6 +157,7 @@ VToolArc* VToolArc::Create(const quint32 _id, const quint32 &center, QString &ra
VToolArc *toolArc = new VToolArc(doc, data, id, typeCreation); VToolArc *toolArc = new VToolArc(doc, data, id, typeCreation);
scene->addItem(toolArc); scene->addItem(toolArc);
connect(toolArc, &VToolArc::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem); connect(toolArc, &VToolArc::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem);
connect(scene, &VMainGraphicsScene::NewFactor, toolArc, &VToolArc::SetFactor);
connect(scene, &VMainGraphicsScene::DisableItem, toolArc, &VToolArc::Disable); connect(scene, &VMainGraphicsScene::DisableItem, toolArc, &VToolArc::Disable);
doc->AddTool(id, toolArc); doc->AddTool(id, toolArc);
doc->IncrementReferens(center); doc->IncrementReferens(center);