diff --git a/src/main.js b/src/main.js index 34fe61a..f87a3d9 100644 --- a/src/main.js +++ b/src/main.js @@ -93,7 +93,7 @@ import { AnimationData } from "./models/animation.js"; import { - Layer, + VectorLayer, AudioTrack, initializeLayerDependencies } from "./models/layer.js"; @@ -638,7 +638,7 @@ function redo() { // ============================================================================ // ============================================================================ -// Layer system classes (Layer, AudioTrack) +// Layer system classes (VectorLayer, AudioTrack, VideoLayer) // have been moved to src/models/layer.js and are imported at the top of this file // ============================================================================ diff --git a/src/models/graphics-object.js b/src/models/graphics-object.js index 4f8044b..07adc4d 100644 --- a/src/models/graphics-object.js +++ b/src/models/graphics-object.js @@ -1,7 +1,7 @@ // GraphicsObject model: Main container for layers and animation import { context, config, pointerList, startProps } from '../state.js'; -import { Layer, AudioTrack } from './layer.js'; +import { VectorLayer, AudioTrack } from './layer.js'; import { TempShape } from './shapes.js'; import { AnimationCurve, Keyframe } from './animation.js'; import { Widget } from '../widgets.js'; @@ -54,7 +54,7 @@ class GraphicsObject extends Widget { this.audioTracks = []; if (initialChildType === 'layer') { - this.children = [new Layer(uuid + "-L1", this)]; + this.children = [new VectorLayer(uuid + "-L1", this)]; this.currentLayer = 0; // Set first layer as active } else if (initialChildType === 'midi') { const midiTrack = new AudioTrack(uuid + "-M1", "MIDI 1", 'midi'); @@ -103,7 +103,7 @@ class GraphicsObject extends Widget { graphicsObject.parent = pointerList[json.parent] } for (let layer of json.layers) { - graphicsObject.layers.push(Layer.fromJSON(layer, graphicsObject)); + graphicsObject.layers.push(VectorLayer.fromJSON(layer, graphicsObject)); } // Handle audioTracks (may not exist in older files) if (json.audioTracks) { diff --git a/src/models/layer.js b/src/models/layer.js index 463e286..55a66de 100644 --- a/src/models/layer.js +++ b/src/models/layer.js @@ -1,4 +1,4 @@ -// Layer models: Layer and AudioLayer classes +// Layer models: VectorLayer, AudioTrack, and VideoLayer classes import { context, config, pointerList } from '../state.js'; import { Frame, AnimationData, Keyframe, tempFrame } from './animation.js'; @@ -65,7 +65,7 @@ export function initializeLayerDependencies(deps) { actions = deps.actions; } -class Layer extends Widget { +class VectorLayer extends Widget { constructor(uuid, parentObject = null) { super(0,0) if (!uuid) { @@ -73,7 +73,7 @@ class Layer extends Widget { } else { this.idx = uuid; } - this.name = "Layer"; + this.name = "VectorLayer"; // LEGACY: Keep frames array for backwards compatibility during migration this.frames = [new Frame("keyframe", this.idx + "-F1")]; this.animationData = new AnimationData(this); @@ -86,7 +86,7 @@ class Layer extends Widget { this.shapes = [] } static fromJSON(json, parentObject = null) { - const layer = new Layer(json.idx, parentObject); + const layer = new VectorLayer(json.idx, parentObject); for (let i in json.children) { const child = json.children[i]; const childObject = GraphicsObject.fromJSON(child); @@ -136,7 +136,7 @@ class Layer extends Widget { } toJSON(randomizeUuid = false) { const json = {}; - json.type = "Layer"; + json.type = "VectorLayer"; if (randomizeUuid) { json.idx = uuidv4(); json.name = this.name + " copy"; @@ -468,7 +468,7 @@ class Layer extends Widget { } } copy(idx) { - let newLayer = new Layer(idx.slice(0, 8) + this.idx.slice(8)); + let newLayer = new VectorLayer(idx.slice(0, 8) + this.idx.slice(8)); let idxMapping = {}; for (let child of this.children) { let newChild = child.copy(idx); @@ -1245,4 +1245,4 @@ class AudioTrack { } } -export { Layer, AudioTrack }; +export { VectorLayer, AudioTrack };