diff --git a/apps/presentationeditor/mobile/app/view/add/AddSlide.js b/apps/presentationeditor/mobile/app/view/add/AddSlide.js
index 7dd090a69..eaa01e21b 100644
--- a/apps/presentationeditor/mobile/app/view/add/AddSlide.js
+++ b/apps/presentationeditor/mobile/app/view/add/AddSlide.js
@@ -103,9 +103,14 @@ define([
renderLayouts: function() {
var $layoutContainer = $('.container-add .slide-layout');
if ($layoutContainer.length > 0 && _layouts.length>0) {
- var columns = parseInt(($layoutContainer.width()-20) / (_layouts[0].itemWidth+2)), // magic
+ var itemWidth = _layouts[0].itemWidth,
+ columns = parseInt(($layoutContainer.width()-20) / (itemWidth+2)), // magic
row = -1,
layouts = [];
+ if (columns<1) {
+ columns = 1;
+ itemWidth = $layoutContainer.width()-20;
+ }
_.each(_layouts, function (layout, index) {
if (0 == index % columns) {
@@ -120,13 +125,14 @@ define([
'
',
'<% _.each(row, function(item) { %>',
'- ',
- '',
+ '',
'
',
'<% }); %>',
'
',
'<% }); %>'
].join(''))({
- layouts: layouts
+ layouts: layouts,
+ itemWidth: itemWidth
});
$layoutContainer.html(template);
diff --git a/apps/presentationeditor/mobile/app/view/edit/EditSlide.js b/apps/presentationeditor/mobile/app/view/edit/EditSlide.js
index 40e0d23b3..e8f5f6b05 100644
--- a/apps/presentationeditor/mobile/app/view/edit/EditSlide.js
+++ b/apps/presentationeditor/mobile/app/view/edit/EditSlide.js
@@ -259,10 +259,14 @@ define([
renderLayouts: function() {
var $layoutContainer = $('.container-edit .slide-layout');
if ($layoutContainer.length > 0 && _layouts.length>0) {
- var columns = parseInt(($layoutContainer.width()-20) / (_layouts[0].itemWidth+2)), // magic
+ var itemWidth = _layouts[0].itemWidth,
+ columns = parseInt(($layoutContainer.width()-20) / (itemWidth+2)), // magic
row = -1,
layouts = [];
-
+ if (columns<1) {
+ columns = 1;
+ itemWidth = $layoutContainer.width()-20;
+ }
_.each(_layouts, function (layout, index) {
if (0 == index % columns) {
layouts.push([]);
@@ -276,13 +280,14 @@ define([
'',
'<% _.each(row, function(item) { %>',
'- ',
- '',
+ '',
'
',
'<% }); %>',
'
',
'<% }); %>'
].join(''))({
- layouts: layouts
+ layouts: layouts,
+ itemWidth: itemWidth
});
$layoutContainer.html(template);