Skip to content

Commit

Permalink
Refactor CanvasManager methods: rename removeLayer to getLayer and ad…
Browse files Browse the repository at this point in the history
…d new removeLayer method
  • Loading branch information
BlackRam-oss committed Feb 3, 2025
1 parent 1bd2ecd commit 3cc5172
Showing 1 changed file with 17 additions and 3 deletions.
20 changes: 17 additions & 3 deletions src/managers/CanvasManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -998,21 +998,35 @@ export default class CanvasManager {
console.error(`[Pixi’VN] The alias ${CANVAS_APP_GAME_LAYER_ALIAS} is reserved`);
return;
}
layer.label = label;
return CanvasManagerStatic.app.stage.addChild(layer);
}

/**
* Remove a layer from the canvas.
* @param label The label of the layer to be removed.
* Get a layer from the canvas.
* @param label The label of the layer.
* @returns The layer.
* @example
* ```typescript
* const uiLayer = canvas.removeLayer("ui");
* const uiLayer = canvas.getLayer("ui");
* ```
*/
getLayer(label: string) {
return CanvasManagerStatic.app.stage.getChildByLabel(label);
}

/**
* Remove a layer from the canvas.
* @param label The label of the layer to be removed.
* @example
* ```typescript
* canvas.removeLayer("ui");
* ```
*/
removeLayer(label: string) {
CanvasManagerStatic.app.stage.getChildrenByLabel(label);
}

/* Other Methods */

/**
Expand Down

0 comments on commit 3cc5172

Please sign in to comment.