diff --git a/core/flyout_button.ts b/core/flyout_button.ts index 498b9b1ad..93a090f21 100644 --- a/core/flyout_button.ts +++ b/core/flyout_button.ts @@ -59,14 +59,14 @@ export class FlyoutButton { * @param workspace The workspace in which to place this button. * @param targetWorkspace The flyout's target workspace. * @param json The JSON specifying the label/button. - * @param isLabel_ Whether this button should be styled as a label. + * @param isFlyoutLabel Whether this button should be styled as a label. * @internal */ constructor( private readonly workspace: WorkspaceSvg, private readonly targetWorkspace: WorkspaceSvg, json: toolbox.ButtonOrLabelInfo, - private readonly isLabel_: boolean, + private readonly isFlyoutLabel: boolean, ) { this.text = json['text']; @@ -93,7 +93,9 @@ export class FlyoutButton { * @returns The button's SVG group. */ createDom(): SVGElement { - let cssClass = this.isLabel_ ? 'blocklyFlyoutLabel' : 'blocklyFlyoutButton'; + let cssClass = this.isFlyoutLabel + ? 'blocklyFlyoutLabel' + : 'blocklyFlyoutButton'; if (this.cssClass) { cssClass += ' ' + this.cssClass; } @@ -105,7 +107,7 @@ export class FlyoutButton { ); let shadow; - if (!this.isLabel_) { + if (!this.isFlyoutLabel) { // Shadow rectangle (light source does not mirror in RTL). shadow = dom.createSvgElement( Svg.RECT, @@ -123,7 +125,7 @@ export class FlyoutButton { const rect = dom.createSvgElement( Svg.RECT, { - 'class': this.isLabel_ + 'class': this.isFlyoutLabel ? 'blocklyFlyoutLabelBackground' : 'blocklyFlyoutButtonBackground', 'rx': FlyoutButton.BORDER_RADIUS, @@ -135,7 +137,7 @@ export class FlyoutButton { const svgText = dom.createSvgElement( Svg.TEXT, { - 'class': this.isLabel_ ? 'blocklyFlyoutLabelText' : 'blocklyText', + 'class': this.isFlyoutLabel ? 'blocklyFlyoutLabelText' : 'blocklyText', 'x': 0, 'y': 0, 'text-anchor': 'middle', @@ -148,7 +150,7 @@ export class FlyoutButton { text += '\u200F'; } svgText.textContent = text; - if (this.isLabel_) { + if (this.isFlyoutLabel) { this.svgText = svgText; this.workspace .getThemeManager() @@ -172,7 +174,7 @@ export class FlyoutButton { ); this.height = fontMetrics.height; - if (!this.isLabel_) { + if (!this.isFlyoutLabel) { this.width += 2 * FlyoutButton.TEXT_MARGIN_X; this.height += 2 * FlyoutButton.TEXT_MARGIN_Y; shadow?.setAttribute('width', String(this.width)); @@ -228,7 +230,7 @@ export class FlyoutButton { /** @returns Whether or not the button is a label. */ isLabel(): boolean { - return this.isLabel_; + return this.isFlyoutLabel; } /** @@ -279,19 +281,19 @@ export class FlyoutButton { gesture.cancel(); } - if (this.isLabel_ && this.callbackKey) { + if (this.isFlyoutLabel && this.callbackKey) { console.warn( 'Labels should not have callbacks. Label text: ' + this.text, ); } else if ( - !this.isLabel_ && + !this.isFlyoutLabel && !( this.callbackKey && this.targetWorkspace.getButtonCallback(this.callbackKey) ) ) { console.warn('Buttons should have callbacks. Button text: ' + this.text); - } else if (!this.isLabel_) { + } else if (!this.isFlyoutLabel) { const callback = this.targetWorkspace.getButtonCallback(this.callbackKey); if (callback) { callback(this);