Added more logging.
This commit is contained in:
parent
1a3e9b879e
commit
63d1e627ad
@ -1,12 +1,16 @@
|
||||
import {AbstractMesh, Vector3} from "@babylonjs/core";
|
||||
import {DiagramManager} from "../../diagram/diagramManager";
|
||||
import {DiagramObject} from "../../objects/diagramObject";
|
||||
import log from "loglevel";
|
||||
|
||||
export function grabAndClone(diagramManager: DiagramManager, mesh: AbstractMesh, parent: AbstractMesh):
|
||||
DiagramObject {
|
||||
const logger = log.getLogger('grabAndClone');
|
||||
if (diagramManager.isDiagramObject(mesh)) {
|
||||
logger.debug('grabAndClone called with diagram object', mesh.id);
|
||||
const diagramObject = diagramManager.createCopy(mesh.id);
|
||||
if (!diagramObject) {
|
||||
logger.warn('grabAndClone called with invalid diagram object', mesh.id);
|
||||
return null;
|
||||
}
|
||||
diagramObject.baseTransform.setParent(parent);
|
||||
|
||||
@ -11,7 +11,7 @@ import {DiagramObject} from "../objects/diagramObject";
|
||||
|
||||
|
||||
export class DiagramManager {
|
||||
private logger = log.getLogger('DiagramManager');
|
||||
private readonly _logger = log.getLogger('DiagramManager');
|
||||
public readonly _config: AppConfig;
|
||||
private readonly _controllers: Controllers;
|
||||
private readonly _diagramEntityActionManager: ActionManager;
|
||||
@ -49,7 +49,7 @@ export class DiagramManager {
|
||||
}
|
||||
|
||||
});
|
||||
this.logger.debug("DiagramManager constructed");
|
||||
this._logger.debug("DiagramManager constructed");
|
||||
}
|
||||
|
||||
public get actionManager(): AbstractActionManager {
|
||||
@ -76,6 +76,7 @@ export class DiagramManager {
|
||||
public createCopy(id: string): DiagramObject {
|
||||
const diagramObject = this._diagramObjects.get(id);
|
||||
if (!diagramObject) {
|
||||
this._logger.warn('createCopy called with invalid diagram object', id);
|
||||
return null;
|
||||
}
|
||||
const obj = diagramObject.clone();
|
||||
|
||||
@ -109,7 +109,7 @@ export class DiagramObject {
|
||||
|
||||
public clone(): DiagramObject {
|
||||
const clone = new DiagramObject(this._scene, this._eventObservable, {actionManager: this._mesh.actionManager});
|
||||
const newEntity = {...this._diagramEntity};
|
||||
const newEntity: DiagramEntity = {...this._diagramEntity};
|
||||
newEntity.id = 'id' + uuidv4();
|
||||
clone.fromDiagramEntity(this._diagramEntity);
|
||||
this._logger.debug('DiagramObject clone called', clone, this._diagramEntity, newEntity);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user