πŸ“ Case Study β€” Web Application

Building ARCH_OS
A Floor Plan Designer

An exploration into creating a professional-grade floor planning application with real-time manipulation, undo/redo history, and an intuitive drag-and-drop interfaceβ€”all in pure vanilla JavaScript.

2 Weeks
Development
1,200+
Lines of Code
25+
Asset Types
0
Dependencies
Scroll to Explore

Project Overview

Understanding the vision behind ARCH_OS and its core objectives

What is ARCH_OS?

ARCH_OS is a web-based floor plan designer that enables users to create, edit, and visualize room layouts through an intuitive drag-and-drop interface. Built entirely with vanilla JavaScript, it demonstrates that complex interactive applications don't require heavy frameworks.

The project was inspired by professional tools like SketchUp and RoomSketcher, with a focus on accessibility, performance, and modern UI/UX patterns. It serves as both a practical tool and a showcase of advanced DOM manipulation techniques.

🎯

Drag & Drop Interface

Intuitive object placement with grid snapping for precision

↩️

Full History System

Unlimited undo/redo with complete state preservation

πŸ”

Infinite Canvas

Pan and zoom across a 6000Γ—6000px workspace

πŸ“

Real Measurements

Automatic dimension display in meters (1px = 2cm)

Assets
25+ Assets

Problem & Solution

Identifying the gap in the market and creating meaningful value

πŸ”

The Problem

Existing floor planning tools are often bloated, expensive, or require account creation. Most web-based alternatives lack polish and professional features.

  • βœ• Professional tools cost $100-500+ annually
  • βœ• Web apps often require sign-up/login
  • βœ• Limited or clunky furniture libraries
  • βœ• No undo/redo in many free tools
  • βœ• Poor performance with many objects
πŸ’‘

The Solution

ARCH_OS provides a free, instant-access floor planner with professional features and modern UX patterns.

  • βœ“ 100% free with no account required
  • βœ“ Works instantly in any browser
  • βœ“ 25+ categorized, styled furniture pieces
  • βœ“ Full undo/redo history system
  • βœ“ Optimized for smooth 60fps performance

Tech Stack

The tools and techniques powering ARCH_OS

⚑

Vanilla JavaScript

Pure ES6+ JavaScript with no frameworks. Demonstrates that complex interactive UIs don't require React, Vue, or Angular.

ES6+ DOM API Events State Management
🎨

CSS3 Advanced

CSS custom properties, clip-path for complex shapes, pseudo-elements for furniture details, and CSS transforms for rotation.

Variables Clip-Path Transforms Grid
πŸ–±οΈ

Mouse Events

Complex mouse interaction handling for drag, pan, right-click context menus, and wheel zoom with proper event propagation.

Drag & Drop Context Menu Wheel Zoom
πŸ“¦

State Architecture

Centralized state object managing mode, zoom, pan, selection, drag state, and full history for undo/redo operations.

Single Source History Stack Serialization
πŸ”§

Configuration System

Data-driven furniture definitions with dimensions, styles, z-index, and CSS classesβ€”making new assets trivial to add.

Data-Driven Extensible JSON-like
⌨️

Keyboard Shortcuts

Professional-grade keyboard support with Ctrl+Z/Y for history, Delete for removal, R for rotation, and Space for pan toggle.

Shortcuts Accessibility Power Users

System Design

How the application is structured for maintainability and performance

Configuration
CONFIG Object
Grid size, item definitions, dimensions, styles
β†’
State Management
STATE Object
Mode, zoom, pan, selection, history
β†’
Event Handlers
Interaction Layer
Mouse, keyboard, context menu events
β†’
DOM Rendering
Visual Output
Canvas transforms, object positioning

Challenges & Solutions

Key technical obstacles and how they were overcome

01
πŸ–±οΈ

Complex Mouse Interaction States

The Problem: Managing multiple interaction modes (select, pan, drag) simultaneously while preventing conflicts. For example, clicking an object while in pan mode shouldn't select it, and dragging should work differently from panning.

Solution

Implemented a state machine with distinct modes and sub-states. Each mouse event checks the current mode and active operations before deciding the action. Used separate state flags for panning.active and drag.active to handle concurrent interactions.

// State machine approach
if(state.mode === 'pan' || e.button === 1) {
  state.panning.active = true;
  // Handle pan logic...
  return; // Exit early
}
if(e.target.classList.contains('obj')) {
  state.drag.active = true;
  // Handle drag logic...
}
02
πŸ”

Zoom-Aware Coordinate Transformation

The Problem: When zoomed in or out, mouse coordinates don't map 1:1 to canvas coordinates. Dragging at 50% zoom would move objects half as far as expected; at 200% zoom, twice as far.

Solution

Applied inverse zoom transformation to all coordinate calculations. Mouse delta is divided by the current zoom level to get the true canvas-space movement, ensuring consistent behavior at any zoom level.

// Zoom-compensated dragging
const dx = (e.clientX - state.drag.startX) / state.zoom;
const dy = (e.clientY - state.drag.startY) / state.zoom;

// Snap to grid after transformation
let nx = Math.round((initLeft + dx) / CONFIG.grid) * CONFIG.grid;
03
↩️

Implementing Undo/Redo with Full Fidelity

The Problem: Saving complete application state for undo/redo while maintaining all object properties (position, rotation, z-index, custom styles) and handling the history pointer correctly when new actions branch from a past state.

Solution

Serialize all DOM elements to a JSON snapshot on each action. Store both inline styles and dataset attributes. When branching (new action after undo), prune the future states. Restore by clearing the canvas and recreating elements from JSON.

// Prune future on new action
if(state.historyPtr < state.history.length - 1) {
  state.history = state.history.slice(0, state.historyPtr + 1);
}

// Serialize current state
document.querySelectorAll('.obj').forEach(el => {
  snapshot.push({
    css: el.className,
    style: el.getAttribute('style'),
    data: { ...el.dataset }
  });
});
04
🎨

Complex CSS-Only Furniture Rendering

The Problem: Creating visually distinct furniture pieces (L-shaped sofas, stoves with burners, toilets with tanks) without using images or SVG, while keeping the DOM lightweight.

Solution

Leveraged CSS pseudo-elements (::before, ::after), clip-path polygons for L-shapes, and background-image gradients for patterns. Each furniture type is a single div with CSS classes that add visual complexity.

/* L-shaped sofa with clip-path */
.s-sofa-l {
  background: #3b82f6;
  clip-path: polygon(
    0 0, 100% 0, 100% 100%,
    40% 100%, 40% 40%, 0 40%
  );
}

/* Stove burners with radial gradient */
.s-stove::before {
  background-image: radial-gradient(
    #1f2937 30%, transparent 31%
  );
  background-size: 50% 50%;
}
05
πŸ“

Grid Snapping with Rotation

The Problem: Objects can be rotated to any angle, but they should still snap to the grid by their origin point. After rotation, the visual bounding box changes but the snap point should remain consistent.

Solution

Applied rotation via CSS transform (which doesn't affect layout position) while keeping the left/top coordinates as the snap reference. This separates visual rotation from positioning, making grid snap calculations straightforward.

// Rotation doesn't affect position
function rotateItem(deg) {
  let r = parseInt(state.sel.dataset.rot) + deg;
  state.sel.style.transform = `rotate(${r}deg)`;
  state.sel.dataset.rot = r;
  // left/top unchanged!
}

Key Features

What makes ARCH_OS a capable floor planning tool

πŸ–±οΈ

Drag & Drop

Click any asset in the library to spawn it on the canvas. Drag to reposition with smooth, responsive movement.

πŸ“

Grid Snapping

25px grid ensures precise alignment. Objects snap automatically for professional-looking layouts.

↩️

Undo/Redo

Full history system with Ctrl+Z and Ctrl+Y support. Never lose work with unlimited undo levels.

πŸ”„

Rotation

Rotate any object 45Β° or 90Β° via context menu or 'R' key. Perfect for angled furniture arrangements.

πŸ”

Pan & Zoom

Navigate the large 6000Γ—6000px canvas with hand tool panning and Ctrl+Wheel zoom (20%-300%).

πŸ“š

Asset Library

25+ furniture pieces across 6 categories: Structure, Bedroom, Living, Kitchen/Bath, Office, and Outdoors.

πŸ“

Real Dimensions

Selected objects show their dimensions in meters. Scale is 50px = 1m for real-world accuracy.

πŸ“Š

Layer Control

Bring to front or send to back via context menu. Z-index management for overlapping elements.

⌨️

Keyboard Shortcuts

Power user shortcuts: R (rotate), Delete (remove), Space (pan toggle), [ ] (layers).

By The Numbers

Project metrics and performance achievements

60
FPS Performance
<50
KB Total Size
25+
Furniture Assets
∞
Undo Levels

Key Learnings

What I gained from building ARCH_OS

01

State Machine Patterns

Managing complex interaction modes (select, pan, drag) requires careful state design. A single mode flag isn't enoughβ€”you need sub-states for concurrent operations.

02

Coordinate Space Transformations

Working with zoom requires understanding the difference between screen space and canvas space. Every coordinate must be transformed appropriately.

03

CSS as a Rendering Engine

CSS pseudo-elements, clip-path, and gradients can create surprisingly complex visuals without images or canvasβ€”keeping the bundle size minimal.

04

History System Design

Undo/redo is more than a stack. You need to handle branching (pruning future on new action), efficient serialization, and UI state synchronization.

05

Event Delegation & Propagation

Understanding when to stopPropagation() vs. let events bubble is crucial for nested interactive elements that all need click handling.

06

Configuration-Driven Design

Defining furniture as data objects rather than hardcoded functions makes the system extensible. Adding a new asset is just adding a config entry.

Future Enhancements

Ideas and features planned for future iterations

πŸ’Ύ

Save & Load Projects

Export floor plans as JSON files and reload them later. Enable sharing designs with others via file transfer.

Planned
πŸ“Έ

Export to Image

Capture the canvas as PNG or SVG for presentations, printing, or sharing on social media.

Planned
πŸ“

Measurement Tool

Draw lines between points to measure distances. Essential for checking furniture fits in spaces.

In Progress
🎨

Custom Colors

Color picker for walls, floors, and furniture. Match your actual room colors for realistic planning.

Planned
πŸ“

Resize Handles

Drag corner handles to resize objects dynamically. Custom-size walls and furniture pieces.

In Progress
🏠

Room Templates

Pre-built room layouts (bedroom, kitchen, office) to jumpstart your designs quickly.

Planned
πŸ“±

Touch Support

Full tablet and mobile support with pinch-to-zoom, two-finger pan, and touch-friendly UI.

Exploring
🌐

3D Preview

Generate a basic 3D walkthrough view of your floor plan using Three.js or similar library.

Exploring
πŸ‘₯

Real-Time Collaboration

Multiple users editing the same floor plan simultaneously with WebSocket sync.

Exploring
🏠

Ready to Design Your Space?

Start planning your dream room layout with ARCH_OS. No sign-up required, works instantly in your browser, and it's completely free. Drag, drop, and create!