diff --git a/libs/drawing-engine/src/engine/CanvasHistory.ts b/libs/drawing-engine/src/engine/CanvasHistory.ts index efc8177..80ecb9d 100644 --- a/libs/drawing-engine/src/engine/CanvasHistory.ts +++ b/libs/drawing-engine/src/engine/CanvasHistory.ts @@ -122,7 +122,7 @@ export class CanvasHistory { const current = await this.getCurrentIncompleteEntry() current.entry.actions.push(toolInfo) - await this.db.actions.put(current.key, current.entry) + await this.db.actions.put(current.entry) return current } @@ -194,7 +194,7 @@ export class CanvasHistory { const nextKey = this.history[0] drawEntry = await this.db.actions.get(nextKey) } else { - this.db.actions.put(key, state) + this.db.actions.put(state) drawEntry = state } diff --git a/libs/drawing-engine/src/engine/Database.ts b/libs/drawing-engine/src/engine/Database.ts index 383f3fb..e348b4b 100644 --- a/libs/drawing-engine/src/engine/Database.ts +++ b/libs/drawing-engine/src/engine/Database.ts @@ -77,7 +77,7 @@ export class Database(storeName: StoreName) { return { add: (state: Schema[StoreName]) => this.add(storeName, state), - put: (key: IDBValidKey, state: Schema[StoreName]) => this.put(storeName, key, state), + put: (state: Schema[StoreName], key?: IDBValidKey) => this.put(storeName, state, key), count: () => this.count(storeName), get: (key: IDBValidKey) => this.get(storeName, key), getAll: () => this.getAll(storeName), @@ -89,11 +89,11 @@ export class Database(storeName: StoreName, key: IDBValidKey) { + public get(storeName: StoreName, key: IDBValidKey): Promise { return this.promisifyRequest(this.getObjectStore(storeName, "readonly").get(key)) } - public getAll(storeName: StoreName) { + public getAll(storeName: StoreName): Promise { return this.promisifyRequest(this.getObjectStore(storeName, "readonly").getAll()) } @@ -109,7 +109,7 @@ export class Database(storeName: StoreName, key: IDBValidKey, state: Schema[StoreName]) { + public put(storeName: StoreName, state: Schema[StoreName], key?: IDBValidKey) { return this.promisifyRequest(this.getObjectStore(storeName, "readwrite").put(state, key)) } diff --git a/libs/drawing-engine/src/programs/base/PositionColorProgramBase.ts b/libs/drawing-engine/src/programs/base/PositionColorProgramBase.ts index d004ae4..b23e2a7 100644 --- a/libs/drawing-engine/src/programs/base/PositionColorProgramBase.ts +++ b/libs/drawing-engine/src/programs/base/PositionColorProgramBase.ts @@ -35,7 +35,7 @@ export abstract class PositionColorProgramBase extends BaseProgram< } protected setColor(color: Color): typeof this { - this.gl.uniform3fv(this.getUniformLocation("color"), color.vec3) + this.gl.uniform3fv(this.getUniformLocation("color"), color.vector) return this } diff --git a/libs/shared/src/lib/Color.ts b/libs/shared/src/lib/Color.ts index e7c5d03..3524f7a 100644 --- a/libs/shared/src/lib/Color.ts +++ b/libs/shared/src/lib/Color.ts @@ -28,7 +28,7 @@ export type HsvArray = [ export class Color { static readonly BLACK = new Color(0, 0, 0) static readonly WHITE = new Color(255, 255, 255) - private vector: Uint8ClampedArray + public readonly vector: Uint8ClampedArray public constructor(colorString: string, _?: never, __?: never, ___?: never) public constructor(vector: Readonly, _?: never, __?: never, ___?: never) @@ -79,10 +79,6 @@ export class Color { throw new Error("Invalid color parameters") } - get vec3(): Readonly { - return this.vector - } - public copy(): Color { return new Color(this.vector) }