Commit 99681418 authored by Claudio Valerio's avatar Claudio Valerio

Merge branch 'master' of github.com:Sankore/Sankore-3.1

parents 4abdacd0 17f3e1a8
...@@ -638,11 +638,11 @@ QRectF UBLibraryController::visibleSceneRect() ...@@ -638,11 +638,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;
...@@ -651,6 +651,8 @@ void UBLibraryController::addImagesToCurrentPage(const QList<QUrl>& images) ...@@ -651,6 +651,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);
...@@ -662,8 +664,6 @@ void UBLibraryController::addImagesToCurrentPage(const QList<QUrl>& images) ...@@ -662,8 +664,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