ClosedFeaturemedium

[layouts/canvas]

#10Opened by SALFeb 10, 2026, 10:26 AM
S
SAL
about 1 month ago

add option to have a horizontal scrolling canvas

---

*Related doc: `layouts/canvas`*

2 Comments

S
SAL
about 1 month ago

**AI Analysis** (by Claude)

# Issue Analysis: Horizontal Scrolling Canvas

## 1. Root Cause Analysis

Currently, the canvas layout likely uses a traditional vertical scrolling approach. This feature request aims to add a horizontal scrolling option, which would be useful for:

- Timeline-based layouts

- Gallery/portfolio presentations

- Horizontal navigation experiences

- Mobile-first horizontal card layouts

The implementation needs to handle both layout orientation and drag-and-drop interactions within a horizontally scrolling container.

## 2. Affected Files

**Primary Files:**

- `src/components/canvas/Canvas.tsx` - Main canvas component

- `src/components/canvas/CanvasContainer.tsx` - Canvas wrapper/container

- `src/stores/canvasStore.ts` - Canvas state management (Zustand)

- `src/types/canvas.ts` - Canvas type definitions

**Secondary Files:**

- `src/components/ui/ScrollArea.tsx` - Custom scroll component

- `src/components/canvas/CanvasToolbar.tsx` - Canvas controls/settings

- `src/components/dnd/DragDropProvider.tsx` - @dnd-kit configuration

- `src/styles/canvas.css` - Canvas-specific styles

- `src/hooks/useCanvasLayout.ts` - Canvas layout hook (if exists)

**Configuration Files:**

- `tailwind.config.js` - For horizontal scroll utilities

- `src/lib/canvas/layoutUtils.ts` - Layout calculation utilities

## 3. Resolution Approach

### Step 1: Extend Canvas Types

```typescript

// src/types/canvas.ts

export interface CanvasSettings {

orientation: 'vertical' | 'horizontal';

scrollBehavior: 'smooth' | 'auto';

// ... existing properties

}

```

### Step 2: Update Canvas Store

```typescript

// src/stores/canvasStore.ts

interface CanvasStore {

settings: CanvasSettings;

setOrientation: (orientation: 'vertical' | 'horizontal') => void;

// ... existing methods

}

```

### Step 3: Modify Canvas Container

- Add conditional CSS classes for horizontal vs vertical layout

- Implement horizontal scroll behavior

- Adjust @dnd-kit sensor configuration for horizontal dragging

- Handle overflow and scrolling mechanics

### Step 4: Update Canvas Component

- Modify element positioning logic

- Adjust drag constraints for horizontal movement

- Update grid/snap functionality for horizontal layouts

- Ensure proper element spacing and alignment

### Step 5: Add UI Controls

- Add orientation toggle in CanvasToolbar

- Include horizontal scroll indicators

- Implement keyboard navigation (arrow keys)

### Step 6: Style Implementation

```css

/* src/styles/canvas.css */

.canvas-horizontal {

display: flex;

flex-direction: row;

overflow-x: auto;

overflow-y: hidden;

scroll-behavior: smooth;

}

.canvas-vertical {

display: flex;

flex-direction: column;

overflow-y: auto;

overflow-x: hidden;

}

```

### Step 7: DnD Configuration Updates

- Modify @dnd-kit collision detection for horizontal layouts

- Update drop zone calculations

- Adjust drag overlay positioning

## 4. Complexity Estimate

**Medium Complexity**

**Reasoning:**

- Requires changes across multiple components and systems

- Need to handle both layout orientations dynamically

- @dnd-kit integration adds complexity for drag calculations

- Responsive behavior needs consideration for mobile

- Not complex enough to be "Complex" as it's primarily UI/layout changes

- More than "Simple" due to drag-and-drop integration and state management

## 5. Dependencies

**Prerequisites:**

- Canvas component architecture should be stable

- @dnd-kit integration should be working properly

- Canvas store (Zustand) implementation should be complete

**Potential Blockers:**

- If canvas drag-and-drop is not yet implemented, this would be blocked

- Mobile responsive behavior might need additional consideration

- Performance testing needed for large horizontal layouts

- Browser compatibility for smooth horizontal scrolling

**Nice-to-Have Before Implementation:**

- Canvas grid/snap system completed

- Canvas zoom functionality (affects horizontal scroll calculations)

- Canvas performance optimizations for large layouts

**Testing Requirements:**

- Cross-browser horizontal scroll behavior

- Touch/swipe gestures on mobile devices

- Drag-and-drop accuracy in horizontal mode

- Performance with many elements in horizontal layout

S
SAL
about 1 month ago

Reviewed, updated docs, and deployed on main

Sign in to comment on this issue.

1
vote
Status
Closed
Priority
medium
Type
feature
Created
Feb 10, 2026