Update app_enhanced.py
Browse files- app_enhanced.py +10 -8
app_enhanced.py
CHANGED
|
@@ -344,7 +344,7 @@ INDEX_HTML = '''
|
|
| 344 |
/* HANDLES FOR DRAGGING */
|
| 345 |
.handle {
|
| 346 |
position: absolute;
|
| 347 |
-
/* UPDATED:
|
| 348 |
width: 30px; height: 30px;
|
| 349 |
background: #ff4757;
|
| 350 |
border: 3px solid white;
|
|
@@ -522,12 +522,10 @@ INDEX_HTML = '''
|
|
| 522 |
let isProcessing = false;
|
| 523 |
let interval, selectedBubble = null, selectedPanel = null;
|
| 524 |
|
| 525 |
-
// DRAG
|
| 526 |
let dragMode = null; // 'layout', 'bubble', 'pan', 'resize-bubble'
|
| 527 |
let dragData = {}; // Stores offsets and active IDs
|
| 528 |
|
| 529 |
-
let activeLayoutHandle = null, activePageId = null;
|
| 530 |
-
|
| 531 |
const DEFAULT_LAYOUT = {
|
| 532 |
width: 1000, height: 700, gutter: 10, tierY: 350,
|
| 533 |
r1: { topX: 500, botX: 500 },
|
|
@@ -725,7 +723,7 @@ INDEX_HTML = '''
|
|
| 725 |
setH('h-tier', w/2, ty);
|
| 726 |
}
|
| 727 |
|
| 728 |
-
// ---
|
| 729 |
|
| 730 |
function startDragHandle(e, pageId, handleRole) {
|
| 731 |
e.stopPropagation(); e.preventDefault();
|
|
@@ -769,9 +767,11 @@ INDEX_HTML = '''
|
|
| 769 |
img.classList.add('panning');
|
| 770 |
}
|
| 771 |
|
| 772 |
-
//
|
| 773 |
document.addEventListener('mousemove', (e) => {
|
| 774 |
if(!dragMode) return;
|
|
|
|
|
|
|
| 775 |
|
| 776 |
if(dragMode === 'layout') {
|
| 777 |
const pageEl = document.getElementById(dragData.pageId);
|
|
@@ -804,8 +804,10 @@ INDEX_HTML = '''
|
|
| 804 |
}
|
| 805 |
else if(dragMode === 'pan') {
|
| 806 |
const d = dragData;
|
| 807 |
-
|
| 808 |
-
|
|
|
|
|
|
|
| 809 |
updateImageTransform(d.el);
|
| 810 |
}
|
| 811 |
});
|
|
|
|
| 344 |
/* HANDLES FOR DRAGGING */
|
| 345 |
.handle {
|
| 346 |
position: absolute;
|
| 347 |
+
/* UPDATED: 30px HANDLES */
|
| 348 |
width: 30px; height: 30px;
|
| 349 |
background: #ff4757;
|
| 350 |
border: 3px solid white;
|
|
|
|
| 522 |
let isProcessing = false;
|
| 523 |
let interval, selectedBubble = null, selectedPanel = null;
|
| 524 |
|
| 525 |
+
// UNIFIED DRAG STATE
|
| 526 |
let dragMode = null; // 'layout', 'bubble', 'pan', 'resize-bubble'
|
| 527 |
let dragData = {}; // Stores offsets and active IDs
|
| 528 |
|
|
|
|
|
|
|
| 529 |
const DEFAULT_LAYOUT = {
|
| 530 |
width: 1000, height: 700, gutter: 10, tierY: 350,
|
| 531 |
r1: { topX: 500, botX: 500 },
|
|
|
|
| 723 |
setH('h-tier', w/2, ty);
|
| 724 |
}
|
| 725 |
|
| 726 |
+
// --- UNIFIED DRAG HANDLERS ---
|
| 727 |
|
| 728 |
function startDragHandle(e, pageId, handleRole) {
|
| 729 |
e.stopPropagation(); e.preventDefault();
|
|
|
|
| 767 |
img.classList.add('panning');
|
| 768 |
}
|
| 769 |
|
| 770 |
+
// --- UNIFIED MOUSE MOVE ---
|
| 771 |
document.addEventListener('mousemove', (e) => {
|
| 772 |
if(!dragMode) return;
|
| 773 |
+
|
| 774 |
+
e.preventDefault(); // Prevent selection/scrolling while dragging
|
| 775 |
|
| 776 |
if(dragMode === 'layout') {
|
| 777 |
const pageEl = document.getElementById(dragData.pageId);
|
|
|
|
| 804 |
}
|
| 805 |
else if(dragMode === 'pan') {
|
| 806 |
const d = dragData;
|
| 807 |
+
const tx = d.startTx + (e.clientX - d.startX);
|
| 808 |
+
const ty = d.startTy + (e.clientY - d.startY);
|
| 809 |
+
d.el.dataset.translateX = tx;
|
| 810 |
+
d.el.dataset.translateY = ty;
|
| 811 |
updateImageTransform(d.el);
|
| 812 |
}
|
| 813 |
});
|