|
@@ -12,8 +12,6 @@ import { WorkbenchComponent } from "./diagram/workbench";
|
|
|
import { GUINode } from "./diagram/guiNode";
|
|
|
import { _TypeStore } from "babylonjs/Misc/typeStore";
|
|
|
import { MessageDialogComponent } from "./sharedComponents/messageDialog";
|
|
|
-import { Control } from "babylonjs-gui/2D/controls/control";
|
|
|
-import { Container } from "babylonjs-gui/2D/controls/container";
|
|
|
|
|
|
require("./main.scss");
|
|
|
|
|
@@ -34,31 +32,13 @@ export class WorkbenchEditor extends React.Component<IGraphEditorProps, IGraphEd
|
|
|
private _leftWidth = DataStorage.ReadNumber("LeftWidth", 200);
|
|
|
private _rightWidth = DataStorage.ReadNumber("RightWidth", 300);
|
|
|
|
|
|
- private _blocks = new Array<Container | Control>();
|
|
|
-
|
|
|
private _onWidgetKeyUpPointer: any;
|
|
|
-
|
|
|
private _popUpWindow: Window;
|
|
|
|
|
|
- /**
|
|
|
- * Creates a node and recursivly creates its parent nodes from it's input
|
|
|
- * @param block
|
|
|
- */
|
|
|
- public createNodeFromObject(block: Control, recursion = true) {
|
|
|
- if (this._blocks.indexOf(block) !== -1) {
|
|
|
- return this._workbenchCanvas.nodes.filter((n) => n.guiControl === block)[0];
|
|
|
- }
|
|
|
-
|
|
|
- this._blocks.push(block);
|
|
|
-
|
|
|
- //TODO: Implement
|
|
|
- const node = null;
|
|
|
- return node;
|
|
|
- }
|
|
|
|
|
|
componentDidMount() {
|
|
|
if (this.props.globalState.hostDocument) {
|
|
|
- this._workbenchCanvas = this.refs["graphCanvas"] as WorkbenchComponent;
|
|
|
+ this._workbenchCanvas = this.refs["workbenchCanvas"] as WorkbenchComponent;
|
|
|
}
|
|
|
|
|
|
if (navigator.userAgent.indexOf("Mobile") !== -1) {
|
|
@@ -84,14 +64,6 @@ export class WorkbenchEditor extends React.Component<IGraphEditorProps, IGraphEd
|
|
|
(evt) => {
|
|
|
if ((evt.keyCode === 46 || evt.keyCode === 8) && !this.props.globalState.blockKeyboardEvents) {
|
|
|
// Delete
|
|
|
- let selectedItems = this._workbenchCanvas.selectedGuiNodes;
|
|
|
-
|
|
|
- for (var selectedItem of selectedItems) {
|
|
|
- selectedItem.dispose();
|
|
|
- }
|
|
|
-
|
|
|
- this.props.globalState.onSelectionChangedObservable.notifyObservers(null);
|
|
|
- return;
|
|
|
}
|
|
|
|
|
|
if (!evt.ctrlKey || this.props.globalState.blockKeyboardEvents) {
|
|
@@ -113,7 +85,6 @@ export class WorkbenchEditor extends React.Component<IGraphEditorProps, IGraphEd
|
|
|
}
|
|
|
} else if (evt.key === "v") {
|
|
|
// Paste
|
|
|
- //TODO: Implement
|
|
|
}
|
|
|
},
|
|
|
false
|
|
@@ -200,7 +171,7 @@ export class WorkbenchEditor extends React.Component<IGraphEditorProps, IGraphEd
|
|
|
}
|
|
|
|
|
|
const deltaX = evt.clientX - this._startX;
|
|
|
- const rootElement = evt.currentTarget.ownerDocument!.getElementById("workbench-editor-workbench-root") as HTMLDivElement;
|
|
|
+ const rootElement = evt.currentTarget.ownerDocument!.getElementById("gui-editor-workbench-root") as HTMLDivElement;
|
|
|
|
|
|
if (forLeft) {
|
|
|
this._leftWidth += deltaX;
|
|
@@ -210,7 +181,6 @@ export class WorkbenchEditor extends React.Component<IGraphEditorProps, IGraphEd
|
|
|
this._rightWidth -= deltaX;
|
|
|
this._rightWidth = Math.max(250, Math.min(500, this._rightWidth));
|
|
|
DataStorage.WriteNumber("RightWidth", this._rightWidth);
|
|
|
- rootElement.ownerDocument!.getElementById("preview")!.style.height = this._rightWidth + "px";
|
|
|
}
|
|
|
|
|
|
rootElement.style.gridTemplateColumns = this.buildColumnLayout();
|
|
@@ -229,8 +199,6 @@ export class WorkbenchEditor extends React.Component<IGraphEditorProps, IGraphEd
|
|
|
|
|
|
let newGuiNode = this._workbenchCanvas.appendBlock(guiElement);
|
|
|
|
|
|
- //TODO: Get correct positioning
|
|
|
-
|
|
|
/*let x = event.clientX; // - event.currentTarget.offsetLeft - this._workbenchCanvas.x;
|
|
|
let y = event.clientY; // - event.currentTarget.offsetTop - this._workbenchCanvas.y - 20;
|
|
|
|
|
@@ -385,7 +353,7 @@ export class WorkbenchEditor extends React.Component<IGraphEditorProps, IGraphEd
|
|
|
event.preventDefault();
|
|
|
}}
|
|
|
>
|
|
|
- <WorkbenchComponent ref={"graphCanvas"} globalState={this.props.globalState} />
|
|
|
+ <WorkbenchComponent ref={"workbenchCanvas"} globalState={this.props.globalState} />
|
|
|
</div>
|
|
|
|
|
|
<div id="rightGrab" onPointerDown={(evt) => this.onPointerDown(evt)} onPointerUp={(evt) => this.onPointerUp(evt)} onPointerMove={(evt) => this.resizeColumns(evt, false)}></div>
|