impr: remove redundant base class methods

This commit is contained in:
liihuu 2024-09-18 23:41:52 +08:00
parent 342bf64bc9
commit 67c58d3284
2 changed files with 6 additions and 10 deletions

View File

@ -24,11 +24,11 @@ import { createDom } from '../common/utils/dom'
import { getPixelRatio } from '../common/utils/canvas'
export default abstract class DrawWidget<P extends DrawPane = DrawPane> extends Widget<P> {
private _mainCanvas: Canvas
private _overlayCanvas: Canvas
private readonly _mainCanvas: Canvas
private readonly _overlayCanvas: Canvas
override init (rootContainer: HTMLElement): void {
super.init(rootContainer)
constructor(rootContainer: HTMLElement, pane: P) {
super(rootContainer, pane)
this._mainCanvas = new Canvas({
position: 'absolute',
top: '0',

View File

@ -26,7 +26,7 @@ export default abstract class Widget<P extends Pane = Pane> extends Eventful imp
/**
* root container
*/
private _rootContainer: HTMLElement
private readonly _rootContainer: HTMLElement
/**
* Parent pane
@ -36,17 +36,13 @@ export default abstract class Widget<P extends Pane = Pane> extends Eventful imp
/**
* wrapper container
*/
private _container: HTMLElement
private readonly _container: HTMLElement
private readonly _bounding: Bounding = createDefaultBounding()
constructor (rootContainer: HTMLElement, pane: P) {
super()
this._pane = pane
this.init(rootContainer)
}
init (rootContainer: HTMLElement): void {
this._rootContainer = rootContainer
this._container = this.createContainer()
rootContainer.appendChild(this._container)