mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-26 09:35:38 -05:00
fix the icon sizing issue (#13522)
This commit is contained in:
@@ -3,7 +3,6 @@
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { endsWith } from 'vs/base/common/strings';
|
||||
import * as types from 'vs/base/common/types';
|
||||
|
||||
export function isHidden(element: HTMLElement): boolean {
|
||||
@@ -22,21 +21,22 @@ export function convertSize(size: number | string | undefined, defaultValue?: st
|
||||
return defaultValue;
|
||||
}
|
||||
let convertedSize: string = size ? size.toString() : defaultValue;
|
||||
if (!endsWith(convertedSize.toLowerCase(), 'px') && !endsWith(convertedSize.toLowerCase(), '%')) {
|
||||
convertedSize = convertedSize.toLowerCase();
|
||||
if (!convertedSize.endsWith('px') && !convertedSize.endsWith('%')) {
|
||||
convertedSize = convertedSize + 'px';
|
||||
}
|
||||
return convertedSize;
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts a size value into its number representation. Supports px, em and unspecified units.
|
||||
* Converts a size value into its number representation. Supports px, em and unspecified units.
|
||||
* @param size The size value to convert
|
||||
*/
|
||||
export function convertSizeToNumber(size: number | string | undefined): number {
|
||||
if (size && typeof (size) === 'string') {
|
||||
if (endsWith(size.toLowerCase(), 'px')) {
|
||||
if (size.toLowerCase().endsWith('px')) {
|
||||
return +size.replace('px', '');
|
||||
} else if (endsWith(size.toLowerCase(), 'em')) {
|
||||
} else if (size.toLowerCase().endsWith('em')) {
|
||||
return +size.replace('em', '') * 11;
|
||||
}
|
||||
} else if (!size) {
|
||||
|
||||
Reference in New Issue
Block a user