Fixed Circular Dependency.
This commit is contained in:
parent
dc3c3c56a1
commit
b788b64df5
@ -14,13 +14,9 @@ import {isDiagramEntity} from "./functions/isDiagramEntity";
|
|||||||
import {DefaultScene} from "../defaultScene";
|
import {DefaultScene} from "../defaultScene";
|
||||||
import {DiagramMenuManager} from "./diagramMenuManager";
|
import {DiagramMenuManager} from "./diagramMenuManager";
|
||||||
import {ClickMenu} from "../menus/clickMenu";
|
import {ClickMenu} from "../menus/clickMenu";
|
||||||
|
import {DiagramEventObserverMask} from "./types/diagramEventObserverMask";
|
||||||
|
|
||||||
|
|
||||||
export enum DiagramEventObserverMask {
|
|
||||||
ALL = -1,
|
|
||||||
FROM_DB = 1,
|
|
||||||
TO_DB = 2,
|
|
||||||
}
|
|
||||||
export class DiagramManager {
|
export class DiagramManager {
|
||||||
private logger = log.getLogger('DiagramManager');
|
private logger = log.getLogger('DiagramManager');
|
||||||
public readonly _config: AppConfig;
|
public readonly _config: AppConfig;
|
||||||
|
|||||||
@ -1,6 +1,5 @@
|
|||||||
import {DiagramEvent, DiagramEventType} from "./types/diagramEntity";
|
import {DiagramEvent, DiagramEventType} from "./types/diagramEntity";
|
||||||
import {AbstractMesh, ActionEvent, Observable, Scene, TransformNode, Vector3} from "@babylonjs/core";
|
import {AbstractMesh, ActionEvent, Observable, Scene, TransformNode, Vector3} from "@babylonjs/core";
|
||||||
import {DiagramEventObserverMask} from "./diagramManager";
|
|
||||||
import {InputTextView} from "../information/inputTextView";
|
import {InputTextView} from "../information/inputTextView";
|
||||||
import {toDiagramEntity} from "./functions/toDiagramEntity";
|
import {toDiagramEntity} from "./functions/toDiagramEntity";
|
||||||
import {DefaultScene} from "../defaultScene";
|
import {DefaultScene} from "../defaultScene";
|
||||||
@ -11,6 +10,7 @@ import {ScaleMenu} from "../menus/scaleMenu";
|
|||||||
import {ClickMenu} from "../menus/clickMenu";
|
import {ClickMenu} from "../menus/clickMenu";
|
||||||
import {ConfigMenu} from "../menus/configMenu";
|
import {ConfigMenu} from "../menus/configMenu";
|
||||||
import {AppConfig} from "../util/appConfig";
|
import {AppConfig} from "../util/appConfig";
|
||||||
|
import {DiagramEventObserverMask} from "./types/diagramEventObserverMask";
|
||||||
|
|
||||||
|
|
||||||
export class DiagramMenuManager {
|
export class DiagramMenuManager {
|
||||||
|
|||||||
5
src/diagram/types/diagramEventObserverMask.ts
Normal file
5
src/diagram/types/diagramEventObserverMask.ts
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
export enum DiagramEventObserverMask {
|
||||||
|
ALL = -1,
|
||||||
|
FROM_DB = 1,
|
||||||
|
TO_DB = 2,
|
||||||
|
}
|
||||||
@ -1,15 +1,17 @@
|
|||||||
import {AbstractMesh, ActionEvent, Observable, Scene, TransformNode, Vector3} from "@babylonjs/core";
|
import {AbstractMesh, ActionEvent, Observable, Scene, TransformNode, Vector3} from "@babylonjs/core";
|
||||||
import {DiagramEvent, DiagramEventType} from "../diagram/types/diagramEntity";
|
import {DiagramEvent, DiagramEventType} from "../diagram/types/diagramEntity";
|
||||||
import {toDiagramEntity} from "../diagram/functions/toDiagramEntity";
|
import {toDiagramEntity} from "../diagram/functions/toDiagramEntity";
|
||||||
import {DiagramEventObserverMask} from "../diagram/diagramManager";
|
|
||||||
import {DiagramConnection} from "../diagram/diagramConnection";
|
import {DiagramConnection} from "../diagram/diagramConnection";
|
||||||
import {isDiagramEntity} from "../diagram/functions/isDiagramEntity";
|
import {isDiagramEntity} from "../diagram/functions/isDiagramEntity";
|
||||||
import {HtmlButton} from "babylon-html";
|
import {HtmlButton} from "babylon-html";
|
||||||
|
import {DiagramEventObserverMask} from "../diagram/types/diagramEventObserverMask";
|
||||||
|
|
||||||
|
const POINTER_UP = "pointerup";
|
||||||
export class ClickMenu {
|
export class ClickMenu {
|
||||||
private readonly _mesh: AbstractMesh;
|
private readonly _mesh: AbstractMesh;
|
||||||
private readonly transform: TransformNode;
|
private readonly transform: TransformNode;
|
||||||
private connection: DiagramConnection = null;
|
private connection: DiagramConnection = null;
|
||||||
|
|
||||||
public onClickMenuObservable: Observable<ActionEvent> = new Observable<ActionEvent>();
|
public onClickMenuObservable: Observable<ActionEvent> = new Observable<ActionEvent>();
|
||||||
private _diagramEventObservable: Observable<DiagramEvent>;
|
private _diagramEventObservable: Observable<DiagramEvent>;
|
||||||
|
|
||||||
@ -23,7 +25,7 @@ export class ClickMenu {
|
|||||||
|
|
||||||
const removeButton: HtmlButton = this.makeNewButton("Remove", "remove", scene, x += .11);
|
const removeButton: HtmlButton = this.makeNewButton("Remove", "remove", scene, x += .11);
|
||||||
removeButton.onPointerObservable.add((eventData) => {
|
removeButton.onPointerObservable.add((eventData) => {
|
||||||
if (eventData.sourceEvent.type == "pointerup") {
|
if (isUp(eventData)) {
|
||||||
this.onClickMenuObservable.notifyObservers(eventData);
|
this.onClickMenuObservable.notifyObservers(eventData);
|
||||||
this.dispose();
|
this.dispose();
|
||||||
}
|
}
|
||||||
@ -32,7 +34,7 @@ export class ClickMenu {
|
|||||||
|
|
||||||
const labelButton: HtmlButton = this.makeNewButton("Label", "label", scene, x += .11);
|
const labelButton: HtmlButton = this.makeNewButton("Label", "label", scene, x += .11);
|
||||||
labelButton.onPointerObservable.add((eventData) => {
|
labelButton.onPointerObservable.add((eventData) => {
|
||||||
if (eventData.sourceEvent.type == "pointerup") {
|
if (isUp(eventData)) {
|
||||||
this.onClickMenuObservable.notifyObservers(eventData);
|
this.onClickMenuObservable.notifyObservers(eventData);
|
||||||
this.dispose();
|
this.dispose();
|
||||||
}
|
}
|
||||||
@ -40,15 +42,14 @@ export class ClickMenu {
|
|||||||
|
|
||||||
const connectButton: HtmlButton = this.makeNewButton("Connect", "connect", scene, x += .11);
|
const connectButton: HtmlButton = this.makeNewButton("Connect", "connect", scene, x += .11);
|
||||||
connectButton.onPointerObservable.add((eventData) => {
|
connectButton.onPointerObservable.add((eventData) => {
|
||||||
if (eventData.sourceEvent.type == "pointerup") {
|
if (isUp(eventData)) {
|
||||||
this.createMeshConnection(this._mesh, grip, eventData.additionalData.pickedPoint.clone());
|
this.createMeshConnection(this._mesh, grip, eventData.additionalData.pickedPoint.clone());
|
||||||
|
|
||||||
}
|
}
|
||||||
}, -1, false, this, false);
|
}, -1, false, this, false);
|
||||||
|
|
||||||
const closeButton: HtmlButton = this.makeNewButton("Close", "close", scene, x += .11);
|
const closeButton: HtmlButton = this.makeNewButton("Close", "close", scene, x += .11);
|
||||||
closeButton.onPointerObservable.add((eventData) => {
|
closeButton.onPointerObservable.add((eventData) => {
|
||||||
if (eventData.sourceEvent.type == "pointerup") {
|
if (isUp(eventData)) {
|
||||||
this.onClickMenuObservable.notifyObservers(eventData);
|
this.onClickMenuObservable.notifyObservers(eventData);
|
||||||
this.dispose();
|
this.dispose();
|
||||||
}
|
}
|
||||||
@ -56,7 +57,7 @@ export class ClickMenu {
|
|||||||
|
|
||||||
const sizeButton: HtmlButton = this.makeNewButton("Size", "size", scene, x += .11);
|
const sizeButton: HtmlButton = this.makeNewButton("Size", "size", scene, x += .11);
|
||||||
sizeButton.onPointerObservable.add((eventData) => {
|
sizeButton.onPointerObservable.add((eventData) => {
|
||||||
if (eventData.sourceEvent.type == "pointerup") {
|
if (isUp(eventData)) {
|
||||||
this.onClickMenuObservable.notifyObservers(eventData);
|
this.onClickMenuObservable.notifyObservers(eventData);
|
||||||
}
|
}
|
||||||
}, -1, false, this, false);
|
}, -1, false, this, false);
|
||||||
@ -108,3 +109,7 @@ export class ClickMenu {
|
|||||||
this.transform.dispose(false, true);
|
this.transform.dispose(false, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function isUp(event: ActionEvent): boolean {
|
||||||
|
return event?.sourceEvent?.type == POINTER_UP;
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue
Block a user