Thay đổi ngày 20260609
This commit is contained in:
@@ -945,15 +945,15 @@ async function handleEditDeleteScene(scene) {
|
||||
editPrivacyBtn.onclick = () => {
|
||||
returnToDashboardAfterEdit = false;
|
||||
closeActionModal();
|
||||
// Mở modal metadata, false vì ảnh trên map luôn là ảnh mẹ (không phải child)
|
||||
openEditMetadataModal(scene, false);
|
||||
// Sử dụng thuộc tính isChildScene từ backend để quyết định quyền chỉnh sửa
|
||||
openEditMetadataModal(scene, scene.isChildScene);
|
||||
};
|
||||
|
||||
// Gán sự kiện cho nút Sửa
|
||||
editBtn.onclick = () => {
|
||||
returnToDashboardAfterEdit = false;
|
||||
closeActionModal();
|
||||
openEditMetadataModal(scene, false);
|
||||
openEditMetadataModal(scene, scene.isChildScene);
|
||||
};
|
||||
|
||||
// Gán sự kiện cho nút Xóa
|
||||
@@ -1546,8 +1546,7 @@ async function loadMyScenes() {
|
||||
dashboardReturnTab = 'my-scenes';
|
||||
returnToDashboardAfterEdit = true;
|
||||
closeDashboard();
|
||||
// Mặc định truyền false cho isChild, logic backend sẽ xử lý cascade privacy sau
|
||||
openEditMetadataModal(scene, false);
|
||||
openEditMetadataModal(scene, scene.isChildScene);
|
||||
};
|
||||
|
||||
// Xử lý nút Xóa (Sẽ được hoàn thiện ở Bước 4)
|
||||
@@ -1966,7 +1965,10 @@ window.openEditFromMedia = function(scene, isChild = false) {
|
||||
/**
|
||||
* Mở Modal sửa thông tin Metadata chuyên biệt
|
||||
*/
|
||||
window.openEditMetadataModal = function(scene, isChild = false) {
|
||||
window.openEditMetadataModal = function(scene, isChildArg = null) {
|
||||
// Ưu tiên isChildScene từ object scene, hoặc giá trị truyền vào thủ công
|
||||
const isChild = isChildArg !== null ? isChildArg : (!!scene.isChildScene);
|
||||
|
||||
currentEditingScene = scene; // Lưu lại để dùng cho chia sẻ
|
||||
// Load dữ liệu chia sẻ hiện tại
|
||||
sharedUsersData = scene.sharedWith || [];
|
||||
|
||||
+19
-19
@@ -43,6 +43,17 @@ function renderCustomHotspot(hotSpotDiv, args) {
|
||||
callout.appendChild(title);
|
||||
|
||||
hotSpotDiv.appendChild(callout);
|
||||
|
||||
// Gắn sự kiện chuột phải trực tiếp vào bong bóng callout
|
||||
callout.addEventListener('contextmenu', (e) => {
|
||||
e.preventDefault();
|
||||
e.stopPropagation(); // Ngăn chặn sự kiện lan truyền lên viewer
|
||||
|
||||
// Kiểm tra quyền và mở menu chỉnh sửa hotspot
|
||||
if (typeof window.openHotspotMenu === 'function') {
|
||||
window.openHotspotMenu(args.hotspotData); // Truyền dữ liệu hotspot đầy đủ
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -88,7 +99,8 @@ function initPanoramaViewer(imageUrl, hotspots = [], ownerId = null, initialPitc
|
||||
createTooltipFunc: renderCustomHotspot,
|
||||
createTooltipArgs: {
|
||||
title: h.title || target?.name || target?.title || "Điểm điều hướng",
|
||||
thumbUrl: thumbUrl
|
||||
thumbUrl: thumbUrl,
|
||||
hotspotData: h // Truyền toàn bộ dữ liệu hotspot vào args để sử dụng trong renderCustomHotspot
|
||||
},
|
||||
id: h._id,
|
||||
clickHandlerFunc: () => {
|
||||
@@ -158,6 +170,7 @@ function applyViewerSecurity() {
|
||||
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) {
|
||||
@@ -177,25 +190,12 @@ function applyViewerSecurity() {
|
||||
const pitch = coords[0];
|
||||
const yaw = coords[1];
|
||||
|
||||
// Kiểm tra xem có hotspot nào gần điểm click không (ngưỡng 2 độ)
|
||||
const existing = currentHotspots.find(h =>
|
||||
Math.abs((h.coordinates?.pitch || h.pitch) - pitch) < 2 &&
|
||||
Math.abs((h.coordinates?.yaw || h.yaw) - yaw) < 2
|
||||
);
|
||||
|
||||
// Nếu không được phép, dừng xử lý và chặn menu mặc định
|
||||
if (!isAuthorized) return false;
|
||||
|
||||
if (existing) {
|
||||
// ĐÃ CÓ Hotspot -> Hiện Menu: [Sửa Hotspot] / [Xóa Hotspot]
|
||||
if (typeof window.openHotspotMenu === 'function') {
|
||||
window.openHotspotMenu(existing);
|
||||
}
|
||||
} else {
|
||||
// CHƯA CÓ Hotspot -> Hiện Form: [Tạo mới Hotspot]
|
||||
if (typeof window.handleHotspotCreation === 'function') {
|
||||
window.handleHotspotCreation(pitch, yaw, null);
|
||||
}
|
||||
// Nếu click chuột phải vào vùng trống, mở form tạo hotspot mới
|
||||
if (typeof window.handleHotspotCreation === 'function') {
|
||||
window.handleHotspotCreation(pitch, yaw, null);
|
||||
}
|
||||
console.log(`Coordinates captured: Pitch ${pitch}, Yaw ${yaw}`);
|
||||
}
|
||||
@@ -203,8 +203,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);
|
||||
panoramaViewer.addEventListener('contextmenu', handleContextMenu, true);
|
||||
// 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
|
||||
|
||||
// Block drag and drop
|
||||
container.addEventListener('dragstart', (e) => {
|
||||
|
||||
Reference in New Issue
Block a user