feat(editor): implement element location update on

dragend

Replaced a placeholder console.log with a concrete implementation of the
`updateElementLocation` function in the `startModifyElement` event
listener. This function calculates a new angular position (`theta`)
based on the element's offset after dragging it in the editor and
updates the element's `theta-start` attribute accordingly. This change
leads to a more dynamic and interactive user experience in the editor by
allowing users to reposition elements visually and have those changes
reflected immediately.
This commit is contained in:
Kumi 2024-03-28 13:09:48 +01:00
parent c43ddfef2a
commit ac2c4e788f
Signed by: kumi
GPG key ID: ECBCC9082395383F

View file

@ -180,7 +180,7 @@ function startModifyElement(event) {
// Listen for "dragend" event to update the element's position
event.target.addEventListener("dragend", function (event) {
console.log(event); // TODO: Display, obviously.
updateElementLocation(event);
});
var propertiesTitle = document.getElementById("propertiesTitle");
@ -350,6 +350,11 @@ document.addEventListener("loadedQuackscapeScene", function (event) {
}
});
function updateElementLocation(event) {
const theta = cartesianToTheta(event.detail.offset.x, event.detail.offset.z);
event.target.setAttribute("theta-start", theta);
}
function toggleDebugVisibility() {
const debugElement = document.getElementById("propertiesDebug");
debugElement.classList.toggle("hide");