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:
parent
c43ddfef2a
commit
ac2c4e788f
1 changed files with 6 additions and 1 deletions
|
@ -180,7 +180,7 @@ function startModifyElement(event) {
|
||||||
|
|
||||||
// Listen for "dragend" event to update the element's position
|
// Listen for "dragend" event to update the element's position
|
||||||
event.target.addEventListener("dragend", function (event) {
|
event.target.addEventListener("dragend", function (event) {
|
||||||
console.log(event); // TODO: Display, obviously.
|
updateElementLocation(event);
|
||||||
});
|
});
|
||||||
|
|
||||||
var propertiesTitle = document.getElementById("propertiesTitle");
|
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() {
|
function toggleDebugVisibility() {
|
||||||
const debugElement = document.getElementById("propertiesDebug");
|
const debugElement = document.getElementById("propertiesDebug");
|
||||||
debugElement.classList.toggle("hide");
|
debugElement.classList.toggle("hide");
|
||||||
|
|
Loading…
Reference in a new issue