fix(core): fix scaling greater than 1x, fix automatic document updates
This commit is contained in:
@@ -32,21 +32,25 @@ export class DeDocument extends DeesElement {
|
||||
|
||||
@property({
|
||||
type: String,
|
||||
reflect: true,
|
||||
})
|
||||
public format: 'a4' = 'a4';
|
||||
|
||||
@property({
|
||||
type: Number,
|
||||
reflect: true,
|
||||
})
|
||||
public viewWidth: number = null;
|
||||
|
||||
@property({
|
||||
type: Number,
|
||||
reflect: true,
|
||||
})
|
||||
public viewHeight: number = null;
|
||||
|
||||
@property({
|
||||
type: Boolean,
|
||||
reflect: true,
|
||||
})
|
||||
printMode = false;
|
||||
|
||||
@@ -60,7 +64,6 @@ export class DeDocument extends DeesElement {
|
||||
return valueArg;
|
||||
}
|
||||
},
|
||||
|
||||
})
|
||||
public letterData: plugins.tsclass.business.ILetter;
|
||||
|
||||
@@ -117,6 +120,7 @@ export class DeDocument extends DeesElement {
|
||||
this.renderDocument();
|
||||
}
|
||||
|
||||
public latestRenderedLetterData: plugins.tsclass.business.ILetter = null;
|
||||
public async renderDocument() {
|
||||
const domtools = await this.domtoolsPromise;
|
||||
const documentContainer = this.shadowRoot.querySelector('.documentContainer');
|
||||
@@ -172,10 +176,16 @@ export class DeDocument extends DeesElement {
|
||||
page.pageTotalNumber = pageCounter;
|
||||
}
|
||||
this.adjustDePageScaling();
|
||||
this.latestRenderedLetterData = this.letterData;
|
||||
}
|
||||
|
||||
updated(changedProperties: Map<string | number | symbol, unknown>): void {
|
||||
async updated(changedProperties: Map<string | number | symbol, unknown>): void {
|
||||
super.updated(changedProperties);
|
||||
const domtools = await this.domtoolsPromise;
|
||||
const renderedDocIsUpToDate = domtools.convenience.smartjson.deepEqualObjects(this.letterData, this.latestRenderedLetterData);
|
||||
if (!renderedDocIsUpToDate) {
|
||||
this.renderDocument();
|
||||
}
|
||||
|
||||
if (changedProperties.has('viewHeight') || changedProperties.has('viewWidth')) {
|
||||
this.adjustDePageScaling();
|
||||
|
Reference in New Issue
Block a user