fix(layout): Board-Handle-Klick ohne Bewegung ueberschreibt board.pos nicht mehr
Ein reiner Klick/Tap auf den Drag-Handle (ohne echtes Verschieben) hat in onUp den gegen die Viewport geclampten --board-x/y-Wert zurueckgelesen und als board.pos persistiert. Bei einem off-screen geclampten Board (nach Fenster-Verkleinerung oder Import von breiterem Screen) zerstoerte das die wahre Position. Jetzt zaehlt erst eine Bewegung > 3px als Drag; ohne Bewegung bleibt board.pos unangetastet.
This commit is contained in:
@@ -31,8 +31,16 @@ function initBoardDragDrop() {
|
|||||||
const rect = boardEl.getBoundingClientRect();
|
const rect = boardEl.getBoundingClientRect();
|
||||||
const offX = e.clientX - rect.left;
|
const offX = e.clientX - rect.left;
|
||||||
const offY = e.clientY - rect.top;
|
const offY = e.clientY - rect.top;
|
||||||
|
const startCX = e.clientX, startCY = e.clientY;
|
||||||
|
// Erst eine echte Bewegung (> 3px) zaehlt als Drag. Ein reiner Klick/Tap auf den Handle darf
|
||||||
|
// board.pos NICHT ueberschreiben: renderBoards() schreibt in --board-x/y den gegen die Viewport
|
||||||
|
// GECLAMPTEN Wert, board.pos bleibt absichtlich der wahre (evtl. off-screen) Wert. onUp liest
|
||||||
|
// --board-x/y zurueck — bei einem No-Move-Klick waere das der Clamp und wuerde die wahre
|
||||||
|
// Position zerstoeren (Phase-5-Review, HIGH/data-loss).
|
||||||
|
let moved = false;
|
||||||
|
|
||||||
function onMove(ev) {
|
function onMove(ev) {
|
||||||
|
if (Math.abs(ev.clientX - startCX) > 3 || Math.abs(ev.clientY - startCY) > 3) moved = true;
|
||||||
const maxX = window.innerWidth - boardEl.offsetWidth;
|
const maxX = window.innerWidth - boardEl.offsetWidth;
|
||||||
const maxY = window.innerHeight - boardEl.offsetHeight;
|
const maxY = window.innerHeight - boardEl.offsetHeight;
|
||||||
const x = Math.max(0, Math.min(maxX, ev.clientX - offX));
|
const x = Math.max(0, Math.min(maxX, ev.clientX - offX));
|
||||||
@@ -54,6 +62,8 @@ function initBoardDragDrop() {
|
|||||||
|
|
||||||
async function onUp() {
|
async function onUp() {
|
||||||
cleanup();
|
cleanup();
|
||||||
|
// Nur bei echtem Verschieben persistieren — sonst board.pos unangetastet lassen.
|
||||||
|
if (!moved) return;
|
||||||
const id = boardEl.dataset.boardId;
|
const id = boardEl.dataset.boardId;
|
||||||
const board = boards.find(b => b.id === id);
|
const board = boards.find(b => b.id === id);
|
||||||
if (board) {
|
if (board) {
|
||||||
|
|||||||
Reference in New Issue
Block a user