[PE][PE mobile] Bug 46911

This commit is contained in:
Julia Radzhabova 2021-02-16 17:05:47 +03:00
parent 7bca00ebc5
commit 41a907f48d
2 changed files with 19 additions and 13 deletions

View file

@ -110,8 +110,8 @@ define([
};
this._isAddingShape = false;
this.slideSizeArr = [
{ size: [9144000, 6858000], ratio: 9144000/6858000, type: Asc.c_oAscSlideSZType.SzScreen4x3},
{ size: [12192000, 6858000], ratio: 12192000/6858000, type: Asc.c_oAscSlideSZType.SzCustom} ];
{ size: [9144000, 6858000], ratio: 6858000/9144000, type: Asc.c_oAscSlideSZType.SzScreen4x3},
{ size: [12192000, 6858000], ratio: 6858000/12192000, type: Asc.c_oAscSlideSZType.SzCustom} ];
this.currentPageSize = {
type: Asc.c_oAscSlideSZType.SzCustom,
width: 0,
@ -628,7 +628,7 @@ define([
this.currentPageSize.height = height;
this.currentPageSize.type = type;
var ratio = (height>width) ? height/width : width/height;
var ratio = height/width;
var idx = -1;
for (var i = 0; i < this.slideSizeArr.length; i++) {
if (Math.abs(this.slideSizeArr[i].ratio - ratio) < 0.001 ) {
@ -1743,11 +1743,11 @@ define([
onSlideSize: function(menu, item) {
if (item.value !== 'advanced') {
var portrait = (this.currentPageSize.height > this.currentPageSize.width);
var newwidth = (this.currentPageSize.height / this.slideSizeArr[item.value].ratio);
this.currentPageSize = {
type : this.slideSizeArr[item.value].type,
width : this.slideSizeArr[item.value].size[portrait ? 1 : 0],
height : this.slideSizeArr[item.value].size[portrait ? 0 : 1]
width : newwidth,
height : this.currentPageSize.height
};
if (this.api)
@ -1763,8 +1763,7 @@ define([
if (result == 'ok') {
props = dlg.getSettings();
me.currentPageSize = { type: props[0], width: props[1], height: props[2] };
var portrait = (me.currentPageSize.height>me.currentPageSize.width),
ratio = (portrait) ? me.currentPageSize.height/me.currentPageSize.width : me.currentPageSize.width/me.currentPageSize.height,
var ratio = me.currentPageSize.height/me.currentPageSize.width,
idx = -1;
for (var i = 0; i < me.slideSizeArr.length; i++) {
if (Math.abs(me.slideSizeArr[i].ratio - ratio) < 0.001 ) {

View file

@ -57,7 +57,8 @@ define([
infoObj,
modalView,
_licInfo,
_lang;
_lang,
_currentPageSize;
var _slideSizeArr = [
[9144000, 6858000, Asc.c_oAscSlideSZType.SzScreen4x3], [12192000, 6858000, Asc.c_oAscSlideSZType.SzCustom]
@ -330,11 +331,12 @@ define([
// API handlers
onApiPageSize: function(width, height) {
_currentPageSize = {width: width, height: height};
var $input = $('#page-settings-view input[name="slide-size"]');
if ($input.length > 0) {
var ratio = (height>width) ? height/width : width/height;
var ratio = height/width;
for (var i = 0; i < _slideSizeArr.length; i++) {
if (Math.abs(_slideSizeArr[i][0]/_slideSizeArr[i][1] - ratio) < 0.001 ) {
if (Math.abs(_slideSizeArr[i][1]/_slideSizeArr[i][0] - ratio) < 0.001 ) {
$input.val([i]);
break;
}
@ -405,8 +407,13 @@ define([
_onSlideSize: function(e) {
var $target = $(e.currentTarget).find('input');
if ($target && this.api) {
var value = parseFloat($target.prop('value'));
this.api.changeSlideSize(_slideSizeArr[value][0], _slideSizeArr[value][1], _slideSizeArr[value][2]);
var value = parseFloat($target.prop('value')),
ratio = _slideSizeArr[value][1] / _slideSizeArr[value][0];
_currentPageSize = {
width : ((_currentPageSize.height || _slideSizeArr[value][1]) / ratio),
height : _currentPageSize.height
};
this.api.changeSlideSize(_currentPageSize.width, _currentPageSize.height, _slideSizeArr[value][2]);
}
},