How do you programatically adjust the window layout/sizes?
Opened this issue · 7 comments
Found it!
__initialWindowLayout: {
main: { position: { x: 0, y: 0 } },
equalizer: { position: { x: 0, y: 116 } },
playlist: { position: { x: 275, y: 0 }, size: [0, 4] }
}Has anyone figured out the wizardry that is involved in placing the windows where? It's kinda like the numbers that you put into the position spots are used as a seed in a pseudorandom number gen. And it places the windows like that.
It's kinda weird how this thing can do literally anything, but if you want to place the element at a specific position, that is just out of the question. Top left corner only bruh.
I tried changing the element's top and left properties but, if it doesn't render at farthest top left corner, it think that it cant go any further left or up.
Well, I figured it out.
useEffect(() => {
let intervalId;
const positionElement = (elem) => {
let x, y
for (const [index, each] of Array.from(elem.children).entries()) {
x = 400
y = 100 + (index+1) * 116;
elem.style.transform = `translate(${x}px, ${y}px)`
}
elem.parentElement.parentElement.style.visibility = 'visible'
}
const checkElement = () => {
const elem = document.querySelector('#webamp > div > div');
if (elem) {
clearInterval(intervalId);
positionElement(elem)
}
};
if (isOpen) {
intervalId = setInterval(checkElement, 100);
}
return () => {
clearInterval(intervalId);
};
}, [isOpen]);One of the hackiest things I've ever done but it works.
And that doesn't work either. If I manually set the position in any way, it thinks that where ever i place it is 0, 0. So it just can't be done haha.
And that doesn't work either. If I manually set the position in any way, it thinks that where ever i place it is 0, 0. So it just can't be done haha.
Did you check this out?
