feat:adjust background when paper direction change
This commit is contained in:
@@ -1,16 +1,16 @@
|
|||||||
import { IEditorOption } from '../../../interface/Editor'
|
|
||||||
import { Draw } from '../Draw'
|
import { Draw } from '../Draw'
|
||||||
|
|
||||||
export class Background {
|
export class Background {
|
||||||
|
|
||||||
private options: Required<IEditorOption>
|
private draw: Draw
|
||||||
|
|
||||||
constructor(draw: Draw) {
|
constructor(draw: Draw) {
|
||||||
this.options = draw.getOptions()
|
this.draw = draw
|
||||||
}
|
}
|
||||||
|
|
||||||
public render(ctx: CanvasRenderingContext2D) {
|
public render(ctx: CanvasRenderingContext2D) {
|
||||||
const { width, height } = this.options
|
const width = this.draw.getOriginalWidth()
|
||||||
|
const height = this.draw.getOriginalHeight()
|
||||||
ctx.save()
|
ctx.save()
|
||||||
ctx.fillStyle = '#ffffff'
|
ctx.fillStyle = '#ffffff'
|
||||||
ctx.fillRect(0, 0, width, height)
|
ctx.fillRect(0, 0, width, height)
|
||||||
|
|||||||
Reference in New Issue
Block a user