Makes editor only get created onece.

This commit is contained in:
Quicksticks-oss committed 2024-03-22 16:33:41 -04:00
1 parent 2c0d26e278
commit 0084db8dbb
1 file changed
+14
+14
View File
@@ -20,6 +20,7 @@ import { BokehPass } from 'three/addons/postprocessing/BokehPass.js';
import { createFFmpeg, fetchFile } from '@ffmpeg/ffmpeg';
import {API2, Clip2} from './timeline.tsx';
import { faL } from '@fortawesome/free-solid-svg-icons';
if (typeof window !== 'undefined') {
import('ccapture.js').then(module => {
@@ -35,6 +36,15 @@ class Editor {
// Default params.
constructor() {
// For making sure the editor only gets created onece.
this.can_initailize = false;
let one_element = document.getElementById("created-one-element");
if(one_element != null) { return; }
let newElement = document.createElement("div");
newElement.id = "created-one-element";
document.body.appendChild(newElement);
// Version and name.
this.version = "v0.1";
@@ -90,12 +100,16 @@ class Editor {
// Audio Engine.
this.audio_manager = null;
this.can_initailize = true;
console.log("Created Editor.");
}
// Initializes the main scene and ThreeJS essentials.
initialize() {
if(this.can_initailize == false) { return; }
// Gets the canvas.
this.canvReference = document.getElementById("video-scene");