tidy(ui): misc cleanup

This commit is contained in:
psychedelicious
2024-09-01 12:54:07 +10:00
parent b24f8e2b26
commit 487422a53f
3 changed files with 6 additions and 6 deletions

View File

@@ -65,6 +65,9 @@ export class CanvasEntityLayerAdapter extends CanvasModuleBase {
*/
renderer: CanvasEntityRenderer;
/**
* Whether this is the first render of the entity layer.
*/
isFirstRender: boolean = true;
constructor(state: CanvasEntityLayerAdapter['state'], manager: CanvasEntityLayerAdapter['manager']) {
@@ -101,7 +104,7 @@ export class CanvasEntityLayerAdapter extends CanvasModuleBase {
return getEntityIdentifier(this.state);
};
update = async (arg?: { state: CanvasEntityLayerAdapter['state'] }) => {
update = async (arg?: { state: CanvasEntityLayerAdapter['state'] }): Promise<void> => {
const state = get(arg, 'state', this.state);
const prevState = this.state;
@@ -164,7 +167,6 @@ export class CanvasEntityLayerAdapter extends CanvasModuleBase {
};
getCanvas = (rect?: Rect): HTMLCanvasElement => {
// TODO(psyche) - cache this - maybe with package `memoizee`? Would require careful review of cache invalidation
this.log.trace({ rect }, 'Getting canvas');
// The opacity may have been changed in response to user selecting a different entity category, so we must restore
// the original opacity before rendering the canvas

View File

@@ -164,7 +164,6 @@ export class CanvasEntityMaskAdapter extends CanvasModuleBase {
};
getCanvas = (rect?: Rect): HTMLCanvasElement => {
// TODO(psyche): Cache this?
// The opacity may have been changed in response to user selecting a different entity category, and the mask regions
// should be fully opaque - set opacity to 1 before rendering the canvas
const attrs: GroupConfig = { opacity: 1 };

View File

@@ -30,7 +30,7 @@ export class CanvasEraserToolPreview extends CanvasModuleBase {
manager: CanvasManager;
log: Logger;
config: EraserToolPreviewConfig;
config: EraserToolPreviewConfig = DEFAULT_CONFIG;
konva: {
group: Konva.Group;
@@ -39,14 +39,13 @@ export class CanvasEraserToolPreview extends CanvasModuleBase {
outerBorder: Konva.Ring;
};
constructor(parent: CanvasToolModule, config?: Partial<EraserToolPreviewConfig>) {
constructor(parent: CanvasToolModule) {
super();
this.id = getPrefixedId(this.type);
this.parent = parent;
this.manager = this.parent.manager;
this.path = this.manager.buildPath(this);
this.log = this.manager.buildLogger(this);
this.config = { ...DEFAULT_CONFIG, ...config };
this.log.debug('Creating module');