feat: Update drag page and other small things

- Add parameter to NewDiv class
- Add instance with content to drag page
- Drag page now also uses frame template
- Use macro for footer in explorer
This commit is contained in:
sthag 2025-06-23 22:31:18 +02:00
parent e572f64259
commit 1ddba29d9c
5 changed files with 40 additions and 29 deletions

View file

@ -1,17 +1,18 @@
// Creates a div element which is draggable
class NewDiv {
constructor(x, y, width, height, backgroundColor) {
constructor(x, y, width, height, backgroundColor, content) {
this.x = x;
this.y = y;
this.width = width;
this.height = height;
this.backgroundColor = backgroundColor;
this.element = null;
this.content = content;
}
// Create the div element
createDiv() {
this.element = document.createElement('div');
this.element = this._content;
this.element.style.position = 'absolute';
this.element.style.left = `${this.x}px`;
this.element.style.top = `${this.y}px`;
@ -93,6 +94,19 @@ class NewDiv {
loadData();
}
// FIXME: this.element wird von appendToFrame() verwendet
get content() {
return this._content = this.content;
}
set content(value) {
if (!value) {
value = document.createElement('div');
}
this._content = value;
}
// Append the div to the space
appendToFrame(space) {
this.element.id = `newDiv${space.children.length}`;