Commit 17f3e1a8 authored by Aleksei Kanash's avatar Aleksei Kanash

Fix to SANKORE-307

parent ec10a0d3
...@@ -649,11 +649,11 @@ QRectF UBLibraryController::visibleSceneRect() ...@@ -649,11 +649,11 @@ QRectF UBLibraryController::visibleSceneRect()
void UBLibraryController::addImagesToCurrentPage(const QList<QUrl>& images) void UBLibraryController::addImagesToCurrentPage(const QList<QUrl>& images)
{ {
QPointF pos = visibleSceneRect().center(); QPointF pos = UBApplication::boardController->activeScene()->normalizedSceneRect().center();
foreach(const QUrl url, images) foreach(const QUrl url, images)
{ {
mLastItemOffsetIndex++;
mLastItemOffsetIndex = qMin(mLastItemOffsetIndex, 5); mLastItemOffsetIndex = qMin(mLastItemOffsetIndex, 5);
QGraphicsItem* itemInScene = 0; QGraphicsItem* itemInScene = 0;
...@@ -662,6 +662,8 @@ void UBLibraryController::addImagesToCurrentPage(const QList<QUrl>& images) ...@@ -662,6 +662,8 @@ void UBLibraryController::addImagesToCurrentPage(const QList<QUrl>& images)
QString mimeType = UBFileSystemUtils::mimeTypeFromFileName( QString mimeType = UBFileSystemUtils::mimeTypeFromFileName(
url.toString()); url.toString());
pos = QPointF(pos.x() + 50 * mLastItemOffsetIndex, pos.y() + 50 * mLastItemOffsetIndex);
mLastItemOffsetIndex++;
//TODO UB 4.x move this logic to the scene .. //TODO UB 4.x move this logic to the scene ..
if (mimeType == "image/svg+xml") { if (mimeType == "image/svg+xml") {
itemInScene = activeScene()->addSvg(url, pos); itemInScene = activeScene()->addSvg(url, pos);
...@@ -673,8 +675,6 @@ void UBLibraryController::addImagesToCurrentPage(const QList<QUrl>& images) ...@@ -673,8 +675,6 @@ void UBLibraryController::addImagesToCurrentPage(const QList<QUrl>& images)
if (itemInScene) { if (itemInScene) {
itemInScene = activeScene()->scaleToFitDocumentSize(itemInScene, false, UBSettings::objectInControlViewMargin); itemInScene = activeScene()->scaleToFitDocumentSize(itemInScene, false, UBSettings::objectInControlViewMargin);
itemInScene->setPos(QPoint(pos.x() + 50 * mLastItemOffsetIndex, pos.y() + 50 * mLastItemOffsetIndex));
} }
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment