Fixed State Issues, should be good to go.

This commit is contained in:
CrossPr0duct committed 2025-02-24 21:02:19 -05:00
1 parent ffd52845e5
commit f821d12cdf
3 files changed
+10 -5

No files matched your search

+2 -1
View File
@@ -379,7 +379,7 @@ export class Engine {
// Listen to Toolbar Main
uiEvents.toolbarMain.UNDO.onClick(() => this.undoStackManager.undo());
uiEvents.toolbarMain.REDO.onClick(() => this.undoStackManager.redo());
uiEvents.toolbarMain.SAVE.onClick(async (/*event*/) => {
await this.realTimeDrawEngine.saveOutput();
});
@@ -467,6 +467,7 @@ export class Engine {
});
uiEvents.onAddShapeToEngine((shapeData) => {
this.setAppMode(AppModes.SELECT);
switch (shapeData.shape) {
case "circle":
this.addShape(ShapeType.CIRCLE, 100);
@@ -50,7 +50,7 @@ export class CommandManager {
}
createNode(node: MediaNode) {
console.log("CREATE?!?!?!?!")
const command = new CreateCommand({
nodes: new Set<MediaNode>([node]),
mediaLayerRef: this.mediaLayerRef,
@@ -376,7 +376,7 @@ export class RealTimeDrawEngine {
});
}
public findImageNodeById(id: string): (ImageNode | TextNode | ShapeNode | undefined) {
public findImageNodeById(id: string): (ImageNode | TextNode | ShapeNode | PaintNode | undefined) {
return this.imageNodes.find(node => {
if (node.kNode) {
return node.kNode.id() === id;
@@ -528,8 +528,6 @@ export class RealTimeDrawEngine {
await this.render();
};
public async addNodes(node: MediaNode) {
if (node instanceof ImageNode ||
node instanceof TextNode ||
@@ -541,6 +539,12 @@ export class RealTimeDrawEngine {
console.log(this.imageNodes)
node.kNode.on("dragend", this.handleNodeDragEnd);
}
// ensure the layer doesn't move if added while painting.
if (this.isEnabled) {
this.disableDragging();
}
await this.render();
}