Merge pull request #2325 from ONLYOFFICE/feature/refactor-btns-svg-icon

[scaling] refactoring button's svg icon
This commit is contained in:
maxkadushkin
2023-04-11 11:45:05 +03:00
committed by GitHub
2 changed files with 2 additions and 45 deletions

View File

@ -186,8 +186,7 @@ define([
'<img src="<%= iconImg %>">' +
'<% } else { %>' +
'<% if (/svgicon/.test(iconCls)) {' +
'print(\'<svg class=\"icon uni-scale\"><use class=\"zoom-int\" xlink:href=\"#\' + /svgicon\\s(\\S+)/.exec(iconCls)[1] + \'\"></use>' +
'<use class=\"zoom-grit\" xlink:href=\"#\' + /svgicon\\s(\\S+)/.exec(iconCls)[1] + \'-150\"></use></svg>\');' +
'print(\'<svg class=\"icon uni-scale\"><use class=\"zoom-int\" xlink:href=\"#\' + /svgicon\\s(\\S+)/.exec(iconCls)[1] + \'\"></use></svg>\');' +
'} else ' +
'print(\'<i class=\"icon \' + iconCls + \'\">&nbsp;</i>\'); %>' +
'<% } %>';
@ -285,8 +284,7 @@ define([
// '<% if (iconCls != "") { print(\'<i class=\"icon \' + iconCls + \'\">&nbsp;</i>\'); }} %>',
'<% if (iconCls != "") { ' +
' if (/svgicon/.test(iconCls)) {' +
'print(\'<svg class=\"icon uni-scale\"><use class=\"zoom-int\" xlink:href=\"#\' + /svgicon\\s(\\S+)/.exec(iconCls)[1] + \'\"></use>' +
'<use class=\"zoom-grit\" xlink:href=\"#\' + /svgicon\\s(\\S+)/.exec(iconCls)[1] + \'-150\"></use></svg>\');' +
'print(\'<svg class=\"icon uni-scale\"><use class=\"zoom-int\" xlink:href=\"#\' + /svgicon\\s(\\S+)/.exec(iconCls)[1] + \'\"></use></svg>\');' +
'} else ' +
'print(\'<i class=\"icon \' + iconCls + \'\">&nbsp;</i>\'); ' +
'}} %>',
@ -749,7 +747,6 @@ define([
if (/svgicon/.test(this.iconCls)) {
var icon = /svgicon\s(\S+)/.exec(this.iconCls);
btnIconEl.find('use.zoom-int').attr('xlink:href', icon && icon.length>1 ? '#' + icon[1]: '');
btnIconEl.find('use.zoom-grit').attr('xlink:href', icon && icon.length>1 ? '#' + icon[1] + '-150' : '');
} else {
btnIconEl.removeClass(oldCls);
btnIconEl.addClass(cls || '');

View File

@ -1281,43 +1281,3 @@
min-width: 86px;
}
}
@class100: zoom-int;
@class150: zoom-grit;
svg.icon {
.@{class150} {
display: none;
}
//@media
//only screen and (-webkit-min-device-pixel-ratio: 1.5),
//only screen and (-webkit-min-device-pixel-ratio: 2.5),
//only screen and (min-resolution: 1.5dppx),
//only screen and (min-resolution: 2.5dppx),
//only screen and (min-resolution: 144dpi),
//only screen and (min-resolution: 240dpi) {
// .@{class100} {
// display: none;
// }
//
// .@{class150} {
// display: block;
// }
//}
@media
only screen and (-webkit-min-device-pixel-ratio: 2) and (-webkit-max-device-pixel-ratio: 2.4),
only screen and (-webkit-min-device-pixel-ratio: 4),
only screen and (min-resolution: 2dppx) and (max-resolution: 2.4dppx),
only screen and (min-resolution: 4dppx),
only screen and (min-resolution: 192dpi) and (max-resolution: 239dpi),
only screen and (min-resolution: 384dpi) {
.@{class100} {
display: block;
}
.@{class150} {
display: none;
}
}
}