Bereinige die Funktion computeOrderedItems, um redundanten Code zu entfernen

This commit is contained in:
2026-02-22 10:44:35 +01:00
parent 03e52026f8
commit 11dbe28876

View File

@@ -41,19 +41,6 @@ document.addEventListener('DOMContentLoaded', function(){
} }
} }
function computeOrderedItems(){
const arr = Array.from(touches.entries()).map(([id,entry])=>({id,el:entry.el,x:entry.x,y:entry.y}));
const cx = arr.reduce((s,a)=>s+a.x,0)/arr.length;
const cy = arr.reduce((s,a)=>s+a.y,0)/arr.length;
arr.forEach(a=>{
const ang = Math.atan2(a.y-cy,a.x-cx) * 180/Math.PI;
a.angle = (ang+360)%360;
a.dist = Math.hypot(a.x-cx,a.y-cy);
});
arr.sort((a,b)=>a.angle-b.angle);
return {items:arr, center:{x:cx,y:cy}};
}
function computeOrderedItems(){ function computeOrderedItems(){
const arr = Array.from(touches.entries()).map(([id,entry])=>({id,el:entry.el,x:entry.x,y:entry.y})); const arr = Array.from(touches.entries()).map(([id,entry])=>({id,el:entry.el,x:entry.x,y:entry.y}));
const cx = arr.reduce((s,a)=>s+a.x,0)/arr.length; const cx = arr.reduce((s,a)=>s+a.x,0)/arr.length;
@@ -172,5 +159,3 @@ document.addEventListener('DOMContentLoaded', function(){
window.addEventListener('mouseup', function(e){ if(!mouseDown) return; mouseDown=false; removeFingerById(mouseId); if(!selectionDone) cancelSelection(); if(touches.size===0) resetWhenAllUp(); }); window.addEventListener('mouseup', function(e){ if(!mouseDown) return; mouseDown=false; removeFingerById(mouseId); if(!selectionDone) cancelSelection(); if(touches.size===0) resetWhenAllUp(); });
}); });
});