Xóa scene con mà không xóa scene cha

This commit is contained in:
2026-06-09 21:26:47 +07:00
parent d39d3b3d53
commit 67825b04cc
22 changed files with 1185 additions and 1486 deletions
+8 -3
View File
@@ -167,10 +167,15 @@ function applyViewerSecurity() {
const panoramaViewer = document.getElementById('panorama-viewer');
const handleContextMenu = (e) => {
// Nếu click trúng vào hotspot hiện có thì không xử lý tại đây
// để listener của hotspot (trong renderCustomHotspot) được chạy.
if (e.target.closest('.pnlm-custom-hotspot')) {
return;
}
e.preventDefault();
e.stopPropagation();
e.stopImmediatePropagation();
return false; // Ngăn chặn menu chuột phải mặc định của trình duyệt
// Nếu viewer đang hoạt động, lấy tọa độ Pitch/Yaw tại điểm click
if (activeViewer) {
@@ -203,8 +208,8 @@ function applyViewerSecurity() {
};
// Sử dụng capture phase (true) để bắt sự kiện trước khi nó chạm đến Pannellum
// container.addEventListener('contextmenu', handleContextMenu, true); // Bỏ gắn sự kiện này
// panoramaViewer.addEventListener('contextmenu', handleContextMenu, true); // Bỏ gắn sự kiện này
container.addEventListener('contextmenu', handleContextMenu, true);
panoramaViewer.addEventListener('contextmenu', handleContextMenu, true);
// Block drag and drop
container.addEventListener('dragstart', (e) => {