This commit is contained in:
2025-09-10 06:55:28 +08:00
parent 28ee50e4c8
commit 9b3edf3300

View File

@@ -238,7 +238,10 @@
backgroundContainer.appendChild(centerDot);
backgroundContainer.removeEventListener('click', handleMapClick);
saveAllElements(); // 中心点标记后自动保存
// 修复中心点保存 - 添加详细日志
console.log('[中心点] 已标记中心点:', { left: centerDot.style.left, top: centerDot.style.top });
saveAllElements(); // 确保保存中心点
}
backgroundContainer.addEventListener('click', handleMapClick);
@@ -399,7 +402,13 @@
}
localStorage.setItem('savedElements', JSON.stringify(elements));
// 控制台输出详细保存信息
// 添加详细保存信息
const centerElement = elements.find(el => el.type === 'center');
if (centerElement) {
console.log(`[${new Date().toLocaleTimeString()}] 中心点已保存:`, centerElement);
} else {
console.log(`[${new Date().toLocaleTimeString()}] 未检测到中心点,未保存`);
}
console.log(`[${new Date().toLocaleTimeString()}] 自动保存完成: 共${elements.length}个元素`);
console.log('保存内容:', elements);
}
@@ -425,6 +434,7 @@
centerDot.style.left = item.left;
centerDot.style.top = item.top;
backgroundContainer.appendChild(centerDot);
console.log('[加载] 已恢复中心点:', item);
}
});
}