[PE] Fix rendering themes (on retina)

This commit is contained in:
Julia Radzhabova 2019-07-23 12:58:51 +03:00
parent 5a2d2abe6c
commit 135d353220
4 changed files with 13 additions and 13 deletions

View file

@ -1960,23 +1960,18 @@ define([
me.toolbar.listTheme.menuPicker.store.reset([]); // remove all
var themeStore = this.getCollection('SlideThemes'),
mainController = this.getApplication().getController('Main'),
imageUrl = (window.devicePixelRatio > 1) ? '../../../../sdkjs/common/Images/themes_thumbnail@2x.png' : '../../../../sdkjs/common/Images/themes_thumbnail.png';
mainController = this.getApplication().getController('Main');
if (themeStore) {
var arr1 = [], arr2 = [];
_.each(defaultThemes, function(theme, index) {
var tip = mainController.translationTable[theme.get_Name()] || theme.get_Name();
arr1.push(new Common.UI.DataViewModel({
imageUrl: imageUrl,
uid : Common.UI.getId(),
themeId : theme.get_Index(),
tip : tip,
itemWidth : 85,
itemHeight : 38,
offsety : index * 38
}));
arr2.push({
imageUrl: imageUrl,
uid : Common.UI.getId(),
themeId : theme.get_Index(),
tip : tip,
@ -1991,8 +1986,6 @@ define([
uid : Common.UI.getId(),
themeId : theme.get_Index(),
tip : tip,
itemWidth : 85,
itemHeight : 38,
offsety : 0
}));
arr2.push({

View file

@ -2031,8 +2031,8 @@ define([
style: 'max-height: 300px;',
store : PE.getCollection('SlideThemes'),
itemTemplate: _.template([
'<div class="style" id="<%= id %>" style="width: <%= itemWidth %>px;">',
'<div style="background-image: url(<%= imageUrl %>); width: <%= itemWidth %>px; height: <%= itemHeight %>px;background-position: 0 -<%= offsety %>px;background-size: cover;"/>',
'<div class="style" id="<%= id %>"">',
'<div class="item-theme" style="' + '<% if (typeof imageUrl !== "undefined") { %>' + 'background-image: url(<%= imageUrl %>);' + '<% } %> background-position: 0 -<%= offsety %>px;"/>',
'</div>'
].join(''))
}).on('item:click', function(picker, item, record, e) {

View file

@ -804,12 +804,12 @@ define([
me.listTheme.fieldPicker.itemTemplate = _.template([
'<div class="style" id="<%= id %>">',
'<div style="background-image: url(<%= imageUrl %>); width: ' + me.listTheme.itemWidth + 'px; height: ' + me.listTheme.itemHeight + 'px; background-position: 0 -<%= offsety %>px;"/>',
'<div class="item-theme" style="' + '<% if (typeof imageUrl !== "undefined") { %>' + 'background-image: url(<%= imageUrl %>);' + '<% } %> background-position: 0 -<%= offsety %>px;"/>',
'</div>'
].join(''));
me.listTheme.menuPicker.itemTemplate = _.template([
'<div class="style" id="<%= id %>">',
'<div style="background-image: url(<%= imageUrl %>); width: ' + me.listTheme.itemWidth + 'px; height: ' + me.listTheme.itemHeight + 'px; background-position: 0 -<%= offsety %>px;"/>',
'<div class="item-theme" style="' + '<% if (typeof imageUrl !== "undefined") { %>' + 'background-image: url(<%= imageUrl %>);' + '<% } %> background-position: 0 -<%= offsety %>px;"/>',
'</div>'
].join(''));

View file

@ -332,4 +332,11 @@
z-index: @zindex-dropdown - 20;
background-color: @gray-light;
border: 1px solid @gray;
}
}
.item-theme {
width: 85px;
height: 38px;
.background-ximage('../../../../../../sdkjs/common/Images/themes_thumbnail.png', '../../../../../../sdkjs/common/Images/themes_thumbnail@2x.png', 85px);
background-size: cover
}