From 3839a6761e56b0b896f62d8fadaaae6fbc3e2bac Mon Sep 17 00:00:00 2001 From: tegwick Date: Mon, 10 Nov 2025 23:10:33 +0100 Subject: [PATCH] fix: improve control positioning and drag behavior MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Update compass positioning to be top-aligned instead of center-aligned - Fix drag offset calculation to maintain cursor position at icon - Ensure expanded controls appear top-aligned with anchor position - Apply fixes to both viewing and edit mode Control implementations - Improve user experience with more intuitive positioning and dragging 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude --- markitect/clean_document_manager.py | 985 ++++++++++++++++++---------- 1 file changed, 640 insertions(+), 345 deletions(-) diff --git a/markitect/clean_document_manager.py b/markitect/clean_document_manager.py index d9b71ad9..975bde44 100644 --- a/markitect/clean_document_manager.py +++ b/markitect/clean_document_manager.py @@ -1177,268 +1177,412 @@ class CleanDocumentManager: console.error("Scroll indicators failed to initialize:", error); }} - // Step 4: Initialize DocumentNavigator (lazy loading for all modes) - try {{ - const documentNavigator = {{ - navElement: null, - isExpanded: false, - isDragging: false, - dragOffset: {{ x: 0, y: 0 }}, - originalPosition: {{ top: '80px', left: '20px' }}, + // Step 4: Define abstract Control class for UI controls + const Control = {{ + // Abstract control properties + element: null, + isExpanded: false, + isDragging: false, + dragOffset: {{ x: 0, y: 0 }}, + originalPosition: {{ top: '80px', left: '20px' }}, - createControl: function() {{ - console.log("📋 Creating DocumentNavigator control for view mode..."); + // Configuration properties (to be overridden by subclasses) + config: {{ + icon: '?', + title: 'Control', + className: 'control', + defaultContent: 'Template only', + ariaLabel: 'Control', + position: 'w' // Default compass position: west (middle-left) + }}, - this.navElement = document.createElement('nav'); - this.navElement.className = 'document-navigator'; - this.navElement.innerHTML = ` - -