From 52e9b6a6ee8f155561b919fab2f269f93ac7b32f Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Tue, 14 Mar 2017 13:51:39 +0300 Subject: [PATCH] [PE] bug 34035, 33978, 33945. --- .../mobile/app/controller/add/AddTable.js | 100 +++++++++--------- .../mobile/app/controller/edit/EditTable.js | 13 ++- 2 files changed, 60 insertions(+), 53 deletions(-) diff --git a/apps/presentationeditor/mobile/app/controller/add/AddTable.js b/apps/presentationeditor/mobile/app/controller/add/AddTable.js index 09ca64931..f44c18f41 100644 --- a/apps/presentationeditor/mobile/app/controller/add/AddTable.js +++ b/apps/presentationeditor/mobile/app/controller/add/AddTable.js @@ -91,64 +91,66 @@ define([ $target = $(e.currentTarget), type = $target.data('type'); + if ($('.modal.modal-in').length > 0) { + return; + } + PE.getController('AddContainer').hideModal(); - _.delay(function () { - if ($target) { - var picker; - var modal = uiApp.modal({ - title: me.textTableSize, - text: '', - afterText: - '
' + - '
' + - '
' + me.textColumns + '
' + - '
' + me.textRows + '
' + - '
' + - '
' + - '
', - buttons: [ - { - text: me.textCancel - }, - { - text: 'OK', - bold: true, - onClick: function () { - var size = picker.value; + if ($target) { + var picker; + var modal = uiApp.modal({ + title: me.textTableSize, + text: '', + afterText: + '
' + + '
' + + '
' + me.textColumns + '
' + + '
' + me.textRows + '
' + + '
' + + '
' + + '
', + buttons: [ + { + text: me.textCancel + }, + { + text: 'OK', + bold: true, + onClick: function () { + var size = picker.value; - if (me.api) { - me.api.put_Table(parseInt(size[0]), parseInt(size[1])); + if (me.api) { + me.api.put_Table(parseInt(size[0]), parseInt(size[1])); - var properties = new Asc.CTableProp(); - properties.put_TableStyle(type); + var properties = new Asc.CTableProp(); + properties.put_TableStyle(type); - me.api.tblApply(properties); - } + me.api.tblApply(properties); } } - ] - }); + } + ] + }); - picker = uiApp.picker({ - container: '#picker-table-size', - toolbar: false, - rotateEffect: true, - value: [3, 3], - cols: [{ - textAlign: 'left', - values: [1,2,3,4,5,6,7,8,9,10] - }, { - values: [1,2,3,4,5,6,7,8,9,10] - }] - }); + picker = uiApp.picker({ + container: '#picker-table-size', + toolbar: false, + rotateEffect: true, + value: [3, 3], + cols: [{ + textAlign: 'left', + values: [1,2,3,4,5,6,7,8,9,10] + }, { + values: [1,2,3,4,5,6,7,8,9,10] + }] + }); - // Vertical align - $$(modal).css({ - marginTop: - Math.round($$(modal).outerHeight() / 2) + 'px' - }); - } - }, 300); + // Vertical align + $$(modal).css({ + marginTop: - Math.round($$(modal).outerHeight() / 2) + 'px' + }); + } }, // Public diff --git a/apps/presentationeditor/mobile/app/controller/edit/EditTable.js b/apps/presentationeditor/mobile/app/controller/edit/EditTable.js index f2da51e9f..431eaa9ea 100644 --- a/apps/presentationeditor/mobile/app/controller/edit/EditTable.js +++ b/apps/presentationeditor/mobile/app/controller/edit/EditTable.js @@ -69,14 +69,19 @@ define([ return _sizes[index]; }, - sizeByValue: function (value) { + indexSizeByValue: function (value) { var index = 0; _.each(_sizes, function (size, idx) { if (Math.abs(size - value) < 0.25) { index = idx; } }); - return _sizes[index]; + + return index; + }, + + sizeByValue: function (value) { + return _sizes[this.indexSizeByValue(value)]; } } })(); @@ -182,7 +187,7 @@ define([ }, _initTableOptionsView: function() { - var margins = _tableObject.get_DefaultMargins(); + var margins = _tableObject.get_CellMargins(); if (margins) { var distance = Common.Utils.Metric.fnRecalcFromMM(margins.get_Left()); $('#table-options-margins input').val(distance); @@ -262,7 +267,7 @@ define([ // }); // } - $('#edit-table-bordersize input').val([borderSizeTransform.sizeByIndex(_cellBorderWidth)]); + $('#edit-table-bordersize input').val([borderSizeTransform.indexSizeByValue(_cellBorderWidth)]); $('#edit-table-bordersize .item-after').text(borderSizeTransform.sizeByValue(_cellBorderWidth) + ' ' + _metricText); var borderPalette = me.getView('EditTable').paletteBorderColor;