|
|
|
@ -1,5 +1,6 @@ |
|
|
|
// SPDX-FileCopyrightText: Copyright The ThingsBoard Authors
|
|
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
|
|
// SPDX-FileCopyrightText: Modifications Copyright ThingsBoard, Inc.
|
|
|
|
// SPDX-License-Identifier: Apache-2.0 AND BUSL-1.1
|
|
|
|
import { AfterViewInit, Component, ElementRef, Input, OnDestroy, ViewChild } from '@angular/core'; |
|
|
|
import { PageComponent } from '@shared/components/page.component'; |
|
|
|
import { WidgetContext } from '@home/models/widget-component.models'; |
|
|
|
@ -10,7 +11,6 @@ import { isDefined } from '@core/utils'; |
|
|
|
import { IWidgetSubscription, SubscriptionInfo, WidgetSubscriptionOptions } from '@core/api/widget-api.models'; |
|
|
|
import { DatasourceType, widgetType } from '@shared/models/widget.models'; |
|
|
|
import { EntityType } from '@shared/models/entity-type.models'; |
|
|
|
import { MatSlideToggle } from '@angular/material/slide-toggle'; |
|
|
|
import { ThemePalette } from '@angular/material/core'; |
|
|
|
|
|
|
|
const switchAspectRation = 2.7893; |
|
|
|
@ -241,7 +241,7 @@ export class SwitchComponent extends PageComponent implements AfterViewInit, OnD |
|
|
|
|
|
|
|
private setFontSize(element: JQuery<HTMLElement>, text: string, fontSize: number, maxWidth: number) { |
|
|
|
let textWidth = this.measureTextWidth(text, fontSize); |
|
|
|
while (textWidth > maxWidth) { |
|
|
|
while (textWidth > maxWidth && fontSize > 1) { |
|
|
|
fontSize--; |
|
|
|
textWidth = this.measureTextWidth(text, fontSize); |
|
|
|
} |
|
|
|
|