Browse Source

UI: revert checkSize method of widget component, clearing width and height of widget context on destroy

pull/11097/head
rusikv 2 years ago
parent
commit
c45cadd478
  1. 19
      ui-ngx/src/app/modules/home/components/widget/widget.component.ts
  2. 2
      ui-ngx/src/app/modules/home/models/widget-component.models.ts

19
ui-ngx/src/app/modules/home/components/widget/widget.component.ts

@ -1545,20 +1545,19 @@ export class WidgetComponent extends PageComponent implements OnInit, AfterViewI
}
private checkSize(): boolean {
const parentWidth = this.widgetContext.$containerParent.width();
const parentHeight = this.widgetContext.$containerParent.height();
const width = this.widgetContext.$container?.width();
const height = this.widgetContext.$container?.height();
const width = this.widgetContext.$containerParent.width();
const height = this.widgetContext.$containerParent.height();
let sizeChanged = false;
if (parentWidth > 0 && parentHeight > 0) {
if (!this.widgetContext.width || !this.widgetContext.height || width !== parentWidth || height !== parentHeight) {
if (!this.widgetContext.width || this.widgetContext.width !== width ||
!this.widgetContext.height || this.widgetContext.height !== height) {
if (width > 0 && height > 0) {
if (this.widgetContext.$container) {
this.widgetContext.$container.css('height', parentHeight + 'px');
this.widgetContext.$container.css('width', parentWidth + 'px');
this.widgetContext.$container.css('height', height + 'px');
this.widgetContext.$container.css('width', width + 'px');
}
this.widgetContext.width = parentWidth;
this.widgetContext.height = parentHeight;
this.widgetContext.width = width;
this.widgetContext.height = height;
sizeChanged = true;
this.widgetSizeDetected = true;
}

2
ui-ngx/src/app/modules/home/models/widget-component.models.ts

@ -449,6 +449,8 @@ export class WidgetContext {
labelPattern.destroy();
}
this.labelPatterns.clear();
this.width = undefined;
this.height = undefined;
this.destroyed = true;
}

Loading…
Cancel
Save