|
@@ -4,6 +4,7 @@ import { Canvas, CircleMenu, ButtonInput, StringInput, ContextMenu, Tips, Search
|
|
|
import { FileEditor } from './editors/FileEditor.js';
|
|
|
import { exportJSON } from './NodeEditorUtils.js';
|
|
|
import { init, ClassLib, getNodeEditorClass, getNodeList } from './NodeEditorLib.js';
|
|
|
+import { SplitscreenManager } from './SplitscreenManager.js';
|
|
|
|
|
|
init();
|
|
|
|
|
@@ -38,6 +39,7 @@ export class NodeEditor extends THREE.EventDispatcher {
|
|
|
this.domElement = domElement;
|
|
|
|
|
|
this._preview = false;
|
|
|
+ this._splitscreen = false;
|
|
|
|
|
|
this.search = null;
|
|
|
|
|
@@ -47,6 +49,7 @@ export class NodeEditor extends THREE.EventDispatcher {
|
|
|
this.nodesContext = null;
|
|
|
this.examplesContext = null;
|
|
|
|
|
|
+ this._initSplitview();
|
|
|
this._initUpload();
|
|
|
this._initTips();
|
|
|
this._initMenu();
|
|
@@ -55,7 +58,6 @@ export class NodeEditor extends THREE.EventDispatcher {
|
|
|
this._initExamplesContext();
|
|
|
this._initShortcuts();
|
|
|
this._initParams();
|
|
|
-
|
|
|
}
|
|
|
|
|
|
setSize( width, height ) {
|
|
@@ -113,6 +115,9 @@ export class NodeEditor extends THREE.EventDispatcher {
|
|
|
|
|
|
if ( value ) {
|
|
|
|
|
|
+ this._wasSplitscreen = this.splitscreen;
|
|
|
+ this.splitscreen = false;
|
|
|
+
|
|
|
this.menu.dom.remove();
|
|
|
this.canvas.dom.remove();
|
|
|
this.search.dom.remove();
|
|
@@ -129,6 +134,12 @@ export class NodeEditor extends THREE.EventDispatcher {
|
|
|
|
|
|
this.previewMenu.dom.remove();
|
|
|
|
|
|
+ if (this._wasSplitscreen == true) {
|
|
|
+
|
|
|
+ this.splitscreen = true;
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
|
|
|
this._preview = value;
|
|
@@ -141,6 +152,22 @@ export class NodeEditor extends THREE.EventDispatcher {
|
|
|
|
|
|
}
|
|
|
|
|
|
+ set splitscreen( value ) {
|
|
|
+
|
|
|
+ if ( this._splitscreen === value ) return;
|
|
|
+
|
|
|
+ this.splitview.setSplitview( value );
|
|
|
+
|
|
|
+ this._splitscreen = value;
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ get splitscreen() {
|
|
|
+
|
|
|
+ return this._splitscreen;
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
newProject() {
|
|
|
|
|
|
const canvas = this.canvas;
|
|
@@ -180,6 +207,12 @@ export class NodeEditor extends THREE.EventDispatcher {
|
|
|
|
|
|
}
|
|
|
|
|
|
+ _initSplitview() {
|
|
|
+
|
|
|
+ this.splitview = new SplitscreenManager( this );
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
_initUpload() {
|
|
|
|
|
|
const canvas = this.canvas;
|
|
@@ -231,6 +264,7 @@ export class NodeEditor extends THREE.EventDispatcher {
|
|
|
previewMenu.setAlign( 'top left' );
|
|
|
|
|
|
const previewButton = new ButtonInput().setIcon( 'ti ti-brand-threejs' ).setToolTip( 'Preview' );
|
|
|
+ const splitscreenButton = new ButtonInput().setIcon( 'ti ti-layout-sidebar-right-expand' ).setToolTip( 'Splitscreen' );
|
|
|
const menuButton = new ButtonInput().setIcon( 'ti ti-apps' ).setToolTip( 'Add' );
|
|
|
const examplesButton = new ButtonInput().setIcon( 'ti ti-file-symlink' ).setToolTip( 'Examples' );
|
|
|
const newButton = new ButtonInput().setIcon( 'ti ti-file' ).setToolTip( 'New' );
|
|
@@ -242,6 +276,13 @@ export class NodeEditor extends THREE.EventDispatcher {
|
|
|
previewButton.onClick( () => this.preview = true );
|
|
|
editorButton.onClick( () => this.preview = false );
|
|
|
|
|
|
+ splitscreenButton.onClick( () => {
|
|
|
+
|
|
|
+ this.splitscreen = !this.splitscreen;
|
|
|
+ splitscreenButton.setIcon(this.splitscreen ? 'ti ti-layout-sidebar-right-collapse' : 'ti ti-layout-sidebar-right-expand');
|
|
|
+
|
|
|
+ });
|
|
|
+
|
|
|
menuButton.onClick( () => this.nodesContext.open() );
|
|
|
examplesButton.onClick( () => this.examplesContext.open() );
|
|
|
|
|
@@ -289,6 +330,7 @@ export class NodeEditor extends THREE.EventDispatcher {
|
|
|
} );
|
|
|
|
|
|
menu.add( previewButton )
|
|
|
+ .add( splitscreenButton )
|
|
|
.add( newButton )
|
|
|
.add( examplesButton )
|
|
|
.add( openButton )
|
|
@@ -297,7 +339,7 @@ export class NodeEditor extends THREE.EventDispatcher {
|
|
|
|
|
|
previewMenu.add( editorButton );
|
|
|
|
|
|
- this.domElement.append( menu.dom );
|
|
|
+ this.domElement.appendChild(menu.dom);
|
|
|
|
|
|
this.menu = menu;
|
|
|
this.previewMenu = previewMenu;
|