Поправки

This commit is contained in:
Book Pauk
2019-01-18 01:31:22 +07:00
parent bea5e9cf37
commit 0043b862ad

View File

@@ -50,19 +50,20 @@ class TextPage extends Vue {
this.realWidth = this.$refs.main.clientWidth; this.realWidth = this.$refs.main.clientWidth;
this.realHeight = this.$refs.main.clientHeight; this.realHeight = this.$refs.main.clientHeight;
if (window.devicePixelRatio) { let ratio = window.devicePixelRatio;
this.canvas.width = this.realWidth*window.devicePixelRatio; if (ratio) {
this.canvas.height = this.realHeight*window.devicePixelRatio; this.canvas.width = this.realWidth*ratio;
this.canvas.height = this.realHeight*ratio;
this.canvas.style.width = this.$refs.main.clientWidth + 'px'; this.canvas.style.width = this.$refs.main.clientWidth + 'px';
this.canvas.style.height = this.$refs.main.clientHeight + 'px'; this.canvas.style.height = this.$refs.main.clientHeight + 'px';
this.context.scale(window.devicePixelRatio, window.devicePixelRatio); this.context.scale(ratio, ratio);
} else { } else {
this.canvas.width = this.realWidth; this.canvas.width = this.realWidth;
this.canvas.height = this.realHeight; this.canvas.height = this.realHeight;
} }
this.lineHeight = this.fontSize + this.lineInterval; this.lineHeight = this.fontSize + this.lineInterval;
this.pageLineCount = Math.floor(this.canvas.height/this.lineHeight); this.pageLineCount = Math.floor(this.realHeight/this.lineHeight);
this.w = this.realWidth - 2*this.indent; this.w = this.realWidth - 2*this.indent;
this.h = this.realHeight; this.h = this.realHeight;
@@ -110,12 +111,12 @@ class TextPage extends Vue {
this.textColor = 'black'; this.textColor = 'black';
this.backgroundColor = '#478355'; this.backgroundColor = '#478355';
this.fontStyle = '';// 'bold','italic' this.fontStyle = '';// 'bold','italic'
this.fontSize = 33;// px this.fontSize = 34;// px
this.fontName = 'Arial'; this.fontName = 'Arial';
this.lineInterval = 10;// px, межстрочный интервал this.lineInterval = 7;// px, межстрочный интервал
this.textAlignJustify = true;// выравнивание по ширине this.textAlignJustify = true;// выравнивание по ширине
this.p = 50;// px, отступ параграфа this.p = 50;// px, отступ параграфа
this.indent = 10;// px, отступ всего текста слева и справа this.indent = 15;// px, отступ всего текста слева и справа
this.wordWrap = true; this.wordWrap = true;
this.calcDrawProps(); this.calcDrawProps();