Skip to content

Commit

Permalink
fixup! fixup! fixup! fixup! fixup! fixup! Disable canvastable dopaint
Browse files Browse the repository at this point in the history
  • Loading branch information
shadowbas authored and bas080 committed Jan 28, 2025
1 parent 6eb5a01 commit b9b1467
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 11 deletions.
3 changes: 2 additions & 1 deletion src/app/app.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,7 @@ export class AppComponent implements OnInit, AfterViewInit, CanvasTableSelectLis
} else {
this.dynamicSearchFieldPlaceHolder = null;
}
this.calculateWidthDependentElements();
// this.calculateWidthDependentElements();
}

ngOnInit(): void {
Expand Down Expand Up @@ -754,6 +754,7 @@ export class AppComponent implements OnInit, AfterViewInit, CanvasTableSelectLis
});
}

// TODO: fix this shit
calculateWidthDependentElements() {
if (this.toolbarListButtonContainer) {
const toolbarlistwidth = (this.toolbarListButtonContainer.nativeElement as HTMLDivElement).clientWidth;
Expand Down
11 changes: 7 additions & 4 deletions src/app/canvastable/canvastable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import {
NgModule, Component, AfterViewInit,
Input, Output,
ElementRef,
DoCheck, EventEmitter, OnInit, ViewChild
EventEmitter, OnInit, ViewChild
} from '@angular/core';
import { CommonModule } from '@angular/common';
import { MatLegacyButtonModule as MatButtonModule } from '@angular/material/legacy-button';
Expand Down Expand Up @@ -111,8 +111,8 @@ export class CanvasTableComponent implements AfterViewInit, OnInit {
private canv: HTMLCanvasElement;

// private ctx: CanvasRenderingContext2D;
private wantedCanvasWidth = 300;
private wantedCanvasHeight = 300;
// private wantedCanvasWidth = 300;
// private wantedCanvasHeight = 300;

private _rowheight = 28;
// private fontheight = 14;
Expand Down Expand Up @@ -769,11 +769,14 @@ export class CanvasTableComponent implements AfterViewInit, OnInit {
}

public autoAdjustColumnWidths(minwidth: number, tryFitScreenWidth = false) {
// Make innert
return

if (!this.canv || this._columns.length === 0) {
return;
}

const canvasWidth = Math.floor(this.wantedCanvasWidth / window.devicePixelRatio) - this.scrollbarwidth - 2;
const canvasWidth = Math.floor(window.devicePixelRatio) - this.scrollbarwidth - 2;

const columnsTotalWidth = () => this.columns.reduce((prev, curr) => prev + curr.width, 0);

Expand Down
14 changes: 8 additions & 6 deletions src/app/mailviewer/singlemailviewer.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@ import {
ViewChildren,
QueryList,
ElementRef,
AfterViewInit,
DoCheck
AfterViewInit
} from '@angular/core';
import { DomSanitizer } from '@angular/platform-browser';
import DOMPurify from 'dompurify';
Expand Down Expand Up @@ -69,7 +68,7 @@ const TOOLBAR_BUTTON_WIDTH = 30;
templateUrl: 'singlemailviewer.component.html',
styleUrls: ['singlemailviewer.component.scss']
})
export class SingleMailViewerComponent implements OnInit, DoCheck, AfterViewInit {
export class SingleMailViewerComponent implements OnInit, AfterViewInit {

_messageId = null; // Message id or filename

Expand Down Expand Up @@ -243,10 +242,13 @@ export class SingleMailViewerComponent implements OnInit, DoCheck, AfterViewInit
this.calculateWidthDependentElements();
}

ngDoCheck() {
this.calculateWidthDependentElements();
}
// Should be doing it on resize.
// ADD THIS BACK TEMPORARY COMMENT OUT.
// ngDoCheck() {
// this.calculateWidthDependentElements();
// }

// TODO: This needs to be fixed
calculateWidthDependentElements() {
if (this.toolbarButtonContainer) {
const toolbarwidth = (this.toolbarButtonContainer.nativeElement as HTMLDivElement).clientWidth;
Expand Down

0 comments on commit b9b1467

Please sign in to comment.