feat: Add initial random rotation for cards, introduce a PointerTrackingContext for pointer management, and include a design document for spatial workspace architecture.
This commit is contained in:
@@ -16,6 +16,7 @@ import '../styles/workspace/workspace-items.css';
|
||||
import '../styles/workspace/workspace-cards.css';
|
||||
import { useWorkspaceSelectionContext } from '../app/WorkspaceSelectionContext';
|
||||
import { createDocumentEntryKey } from '../app/entryKey';
|
||||
import { PointerTrackingProvider, usePointerTracking } from './PointerTrackingContext';
|
||||
import type { Identifier } from '../types/identifiers';
|
||||
import type { DocumentsListEntry, Document } from '../types/documents';
|
||||
|
||||
@@ -77,9 +78,10 @@ const DesktopDocumentContainer: React.FC<React.ComponentProps<typeof DesktopDocu
|
||||
/>
|
||||
);
|
||||
});
|
||||
|
||||
DesktopDocumentContainer.displayName = 'DesktopDocumentContainer';
|
||||
|
||||
const DesktopWorkspace: React.FC<DesktopWorkspaceProps> = ({
|
||||
const DesktopWorkspaceContent: React.FC<DesktopWorkspaceProps> = ({
|
||||
entries,
|
||||
ensureAssetUrl,
|
||||
getDocumentAsset,
|
||||
@@ -89,6 +91,7 @@ const DesktopWorkspace: React.FC<DesktopWorkspaceProps> = ({
|
||||
tenantId,
|
||||
viewId,
|
||||
}) => {
|
||||
const { addPointer, removePointer } = usePointerTracking();
|
||||
const containerRef = useRef<HTMLDivElement>(null);
|
||||
const [isLayoutReady, setIsLayoutReady] = useState(false);
|
||||
|
||||
@@ -219,10 +222,26 @@ const DesktopWorkspace: React.FC<DesktopWorkspaceProps> = ({
|
||||
onKeyDown={handleShellKeyDown}
|
||||
onPointerDown={(e) => {
|
||||
if (e.target === e.currentTarget) {
|
||||
// Register background pointer
|
||||
addPointer(e.pointerId);
|
||||
(e.target as Element).setPointerCapture(e.pointerId);
|
||||
|
||||
onClearSelection();
|
||||
focusShell();
|
||||
}
|
||||
}}
|
||||
onPointerUp={(e) => {
|
||||
if (e.target === e.currentTarget) {
|
||||
removePointer(e.pointerId);
|
||||
(e.target as Element).releasePointerCapture(e.pointerId);
|
||||
}
|
||||
}}
|
||||
onPointerCancel={(e) => {
|
||||
if (e.target === e.currentTarget) {
|
||||
removePointer(e.pointerId);
|
||||
(e.target as Element).releasePointerCapture(e.pointerId);
|
||||
}
|
||||
}}
|
||||
>
|
||||
{isLayoutReady && items.map((doc, index) => {
|
||||
const docId = doc.id ? String(doc.id) : `temp-${index}`;
|
||||
@@ -295,4 +314,12 @@ const DesktopWorkspace: React.FC<DesktopWorkspaceProps> = ({
|
||||
);
|
||||
};
|
||||
|
||||
const DesktopWorkspace: React.FC<DesktopWorkspaceProps> = (props) => {
|
||||
return (
|
||||
<PointerTrackingProvider>
|
||||
<DesktopWorkspaceContent {...props} />
|
||||
</PointerTrackingProvider>
|
||||
);
|
||||
};
|
||||
|
||||
export default DesktopWorkspace;
|
||||
|
||||
Reference in New Issue
Block a user