mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-17 02:51:36 -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.
|
* 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';
|
import * as types from 'vs/base/common/types';
|
||||||
|
|
||||||
export function isHidden(element: HTMLElement): boolean {
|
export function isHidden(element: HTMLElement): boolean {
|
||||||
@@ -22,7 +21,8 @@ export function convertSize(size: number | string | undefined, defaultValue?: st
|
|||||||
return defaultValue;
|
return defaultValue;
|
||||||
}
|
}
|
||||||
let convertedSize: string = size ? size.toString() : 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';
|
convertedSize = convertedSize + 'px';
|
||||||
}
|
}
|
||||||
return convertedSize;
|
return convertedSize;
|
||||||
@@ -34,9 +34,9 @@ export function convertSize(size: number | string | undefined, defaultValue?: st
|
|||||||
*/
|
*/
|
||||||
export function convertSizeToNumber(size: number | string | undefined): number {
|
export function convertSizeToNumber(size: number | string | undefined): number {
|
||||||
if (size && typeof (size) === 'string') {
|
if (size && typeof (size) === 'string') {
|
||||||
if (endsWith(size.toLowerCase(), 'px')) {
|
if (size.toLowerCase().endsWith('px')) {
|
||||||
return +size.replace('px', '');
|
return +size.replace('px', '');
|
||||||
} else if (endsWith(size.toLowerCase(), 'em')) {
|
} else if (size.toLowerCase().endsWith('em')) {
|
||||||
return +size.replace('em', '') * 11;
|
return +size.replace('em', '') * 11;
|
||||||
}
|
}
|
||||||
} else if (!size) {
|
} else if (!size) {
|
||||||
|
|||||||
@@ -187,6 +187,14 @@ export default class ButtonComponent extends ComponentWithIconBase<azdata.Button
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected get defaultIconHeight(): number {
|
||||||
|
return 15;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected get defaultIconWidth(): number {
|
||||||
|
return 15;
|
||||||
|
}
|
||||||
|
|
||||||
// CSS-bound properties
|
// CSS-bound properties
|
||||||
|
|
||||||
private get label(): string {
|
private get label(): string {
|
||||||
|
|||||||
@@ -42,12 +42,20 @@ export abstract class ComponentWithIconBase<T extends azdata.ComponentWithIconPr
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected get defaultIconWidth(): number {
|
||||||
|
return 50;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected get defaultIconHeight(): number {
|
||||||
|
return 50;
|
||||||
|
}
|
||||||
|
|
||||||
public getIconWidth(): string {
|
public getIconWidth(): string {
|
||||||
return convertSize(this.iconWidth, '40px');
|
return convertSize(this.iconWidth, `${this.defaultIconWidth}px`);
|
||||||
}
|
}
|
||||||
|
|
||||||
public getIconHeight(): string {
|
public getIconHeight(): string {
|
||||||
return convertSize(this.iconHeight, '40px');
|
return convertSize(this.iconHeight, `${this.defaultIconHeight}px`);
|
||||||
}
|
}
|
||||||
|
|
||||||
public get iconPath(): string | URI | { light: string | URI; dark: string | URI } {
|
public get iconPath(): string | URI | { light: string | URI; dark: string | URI } {
|
||||||
@@ -55,11 +63,11 @@ export abstract class ComponentWithIconBase<T extends azdata.ComponentWithIconPr
|
|||||||
}
|
}
|
||||||
|
|
||||||
public get iconHeight(): number | string {
|
public get iconHeight(): number | string {
|
||||||
return this.getPropertyOrDefault<number | string>((props) => props.iconHeight, '50px');
|
return this.getPropertyOrDefault<number | string>((props) => props.iconHeight, this.defaultIconHeight);
|
||||||
}
|
}
|
||||||
|
|
||||||
public get iconWidth(): number | string {
|
public get iconWidth(): number | string {
|
||||||
return this.getPropertyOrDefault<number | string>((props) => props.iconWidth, '50px');
|
return this.getPropertyOrDefault<number | string>((props) => props.iconWidth, this.defaultIconWidth);
|
||||||
}
|
}
|
||||||
|
|
||||||
public get title(): string {
|
public get title(): string {
|
||||||
|
|||||||
@@ -51,17 +51,17 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.modelview-toolbar-container .modelview-toolbar-component modelview-button .monaco-text-button.icon {
|
.modelview-toolbar-container .modelview-toolbar-component modelview-button .monaco-text-button.icon {
|
||||||
padding-left: 19px;
|
padding-left: 19px !important;
|
||||||
background-size: 15px;
|
background-size: 15px !important;
|
||||||
margin-right: 0.3em;
|
margin-right: 0.3em;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Vertical button handling */
|
/* Vertical button handling */
|
||||||
.modelview-toolbar-container.toolbar-vertical .modelview-toolbar-component modelview-button .monaco-text-button.icon {
|
.modelview-toolbar-container.toolbar-vertical .modelview-toolbar-component modelview-button .monaco-text-button.icon {
|
||||||
padding: 20px 16px 20px 16px;
|
padding: 20px 16px 20px 16px !important;
|
||||||
background-size: 20px;
|
background-size: 20px !important;
|
||||||
margin-right: 0.3em;
|
margin-right: 0.3em;
|
||||||
background-position: 50% 50%;
|
background-position: 50% 50% !important;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user