From 2fa2fab1eefe4e90edf021c3109c738ea2235e6d Mon Sep 17 00:00:00 2001 From: Aaron Louie Date: Wed, 23 Sep 2020 23:39:19 -0400 Subject: [PATCH] Fixes print layout bugs --- src/app/app-routing.module.spec.ts | 1 - src/app/config/defaults.ts | 2 +- src/app/models/appDefaults.interface.ts | 2 ++ src/app/models/labelLayout.interface.ts | 7 +--- .../print-layout/print-layout.component.html | 6 ++-- .../print-layout/print-layout.component.scss | 15 +-------- .../print-layout/print-layout.component.ts | 32 ++++++++++++------- src/app/print/print.component.scss | 9 +++--- src/app/print/print.component.ts | 23 +++++++++++++ src/app/services/settings.service.ts | 2 -- src/app/settings/settings.component.html | 2 -- 11 files changed, 56 insertions(+), 45 deletions(-) diff --git a/src/app/app-routing.module.spec.ts b/src/app/app-routing.module.spec.ts index 4eda89a..e03028d 100644 --- a/src/app/app-routing.module.spec.ts +++ b/src/app/app-routing.module.spec.ts @@ -72,7 +72,6 @@ describe('Router: App', () => { }); it('navigate to "" redirects you to /', async () => { - console.log('mockEnvironment', mockEnvironment); const success = await fixture.ngZone.run(() => router.navigate([''])); expect(success).toBeTruthy(); expect(location.path()).toBe('/'); diff --git a/src/app/config/defaults.ts b/src/app/config/defaults.ts index 6808737..1c89e70 100644 --- a/src/app/config/defaults.ts +++ b/src/app/config/defaults.ts @@ -12,7 +12,7 @@ export const labelLayouts = { name: '32mm Round Label - 2up', type: 'round_32mm_2up', numCols: 2, - columnGap: 1.3, + columnGap: 3.4, }), }; diff --git a/src/app/models/appDefaults.interface.ts b/src/app/models/appDefaults.interface.ts index 2e0da58..17838a4 100644 --- a/src/app/models/appDefaults.interface.ts +++ b/src/app/models/appDefaults.interface.ts @@ -45,6 +45,8 @@ export class AppDefaults { } else { this[k] = defaultOptions[k]; } + } else if (k === 'labelLayout') { + this[k] = new LabelLayout(options[k]); } else { this[k] = options[k] || defaultOptions[k]; } diff --git a/src/app/models/labelLayout.interface.ts b/src/app/models/labelLayout.interface.ts index 4bfa4fc..72fb750 100644 --- a/src/app/models/labelLayout.interface.ts +++ b/src/app/models/labelLayout.interface.ts @@ -44,7 +44,6 @@ export class LabelLayout { return { bottomTextMargin: this._toUnits(this.bottomTextMargin), columnGap: this._toUnits(this.columnGap), - columnGapWidth: this._toUnits(this.columnGapWidth), fontSize: this._toUnits(this.fontSize), labelSize: this._toUnits(this.labelSize), labelSizeWithMargins: this._toUnits(this.labelSizeWithMargins), @@ -58,16 +57,12 @@ export class LabelLayout { }; } - get columnGapWidth(): number { - return this.columnGap; - } - get labelSizeWithMargins(): number { return (this.labelSize + (this.marginSize * 2)); } get pageWidth(): number { - return (this.labelSizeWithMargins * this.numCols) + (this.columnGap * this.numCols - 1); + return (this.labelSizeWithMargins * this.numCols); } get pageHeight(): number { diff --git a/src/app/print-layout/print-layout.component.html b/src/app/print-layout/print-layout.component.html index 24067c5..bfacf75 100644 --- a/src/app/print-layout/print-layout.component.html +++ b/src/app/print-layout/print-layout.component.html @@ -1,8 +1,8 @@