How a 20,000-Line Legacy Map Editor Was Rebuilt With Cleaner Architecture
A workspace management platform underwent a full rewrite of its interactive office map editor, which had grown to nearly 20,000 lines of TypeScript across 230 files over several years. The original editor, rooted in the AngularJS era, suffered from a monolithic structure where a single component handled everything from rendering to event management, creating an infinite animation loop even when idle. Rather than a risky all-at-once migration, the team built a new administration module in parallel, retaining Fabric.js while restructuring the codebase into focused subsystems — Viewport, Object Registry, and Changes Tracker — each with a single responsibility. A key architectural decision to move the camera via Fabric's viewportTransform, rather than repositioning objects, simplified zooming, panning, exporting, and printing simultaneously. Unexpectedly, implementing high-quality map printing proved more challenging than the rewrite itself, as browser-native printing produced blurry output and leaked editor UI elements into the printed document.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.
Discussion (0)
Log in to join the discussion and vote.
Log in