Editor canvas interaction
The editor canvas is the direct manipulation surface for the visual builder. It renders the page at one or more device widths and lets an author select, place, resize, move, and reorder blocks while keeping the page structure and visual position aligned.
Canvas workspace
The canvas workspace presents the current block tree inside a scaled page surface. A separate editing overlay follows the rendered blocks so selection tools and manipulation controls do not change the page content itself. See also Visual builder workspace and Block composition system.
Responsive canvas views
Each visible breakpoint is a page view with its own width. The editor can show desktop, tablet, and mobile views together or focus on one view. Selection and drop feedback follow the breakpoint under the pointer, so an action is applied to the view that the author is using.
References: frontend/…/BuilderCanvas.vue• L57-87 frontend/…/useCanvasMarqueeSelection.ts• L253-269 frontend/…/useCanvasDropZone.ts• L70-85
Editing overlay
The editing overlay provides the boundary between page rendering and editor controls. It marks selected blocks, displays resize and spacing handles, and routes clicks or drops to the rendered block below. This lets authors work on the page without treating the editor controls as page content.
References: frontend/…/BuilderBlock.vue• L1-41 frontend/…/BlockEditor.vue• L1-42 frontend/…/BuilderCanvas.vue• L89-95
Block selection
Selection identifies the block or blocks that later actions affect. The canvas supports direct selection, modifier-key selection, keyboard movement through the block tree, and selection from an empty area through marquee selection.
Direct selection
A click in select mode selects the block at the pointer and makes the Layers view follow it. A Shift-click selects a range and a Command-click or Control-click toggles one block without losing the other selected blocks. A double-click enters the suitable content editor for text, links, buttons, images, or HTML content.
References: frontend/…/useBlockEventHandlers.ts• L30-79 frontend/…/canvasStore.ts• L126-157 frontend/…/useCanvasUtils.ts• L208-214
Marquee selection
A marquee is a rectangle drawn from an empty part of the canvas in select mode. The canvas waits for a small pointer movement before starting it, then selects top-level eligible blocks whose area overlaps the rectangle by more than half or is fully inside it. A modifier key adds the result to the starting selection. Nested blocks are reduced to their fully contained ancestor so one drag does not select an entire nested path.
The selection rectangle is tied to the breakpoint under its starting point. The canvas previews the result during the drag and commits the final selection when the pointer is released.
References: frontend/…/useCanvasMarqueeSelection.ts• L7-10 frontend/…/useCanvasMarqueeSelection.ts• L103-125 frontend/…/useCanvasMarqueeSelection.ts• L272-357
Keyboard navigation
Arrow keys move selection through siblings, parents, children, and the next branch in the block tree. This gives an author a structural way to reach a block when direct targeting is difficult or when the canvas has overlapping content.
References: frontend/…/useCanvasEvents.ts• L162-233
Block manipulation
The canvas offers different manipulation behaviors based on the block layout and the active editor mode. In-flow blocks move through the page structure, while independently positioned blocks move by changing their visual position.
In-flow reordering
Dragging an in-flow block starts after a small pointer threshold. The original block keeps its layout slot while a ghost follows the pointer. The editor resolves the intended parent and insertion point from the visible layout, then changes the block tree once when the drag ends.
The same interaction supports vertical and horizontal layouts, wrapped rows, and grids. Hovering the center of a container means nest inside it. Hovering its outer edge means place the block beside it. Escape cancels the drag without changing the page.
References: frontend/…/useBlockReorder.ts• L14-31 frontend/…/useBlockReorder.ts• L155-203 frontend/…/useBlockReorder.ts• L248-318
Free positioning
A movable block can be dragged to change its visual position when its position mode allows independent placement. Pointer distance is converted from screen space to canvas space, so movement remains consistent at different zoom levels. The author can also set the position mode and its top, left, right, or bottom anchors through the position controls.
References: frontend/…/BlockEditor.vue• L273-343 frontend/…/BlockPositionHandler.vue• L78-116 frontend/…/BuilderCanvas.ts• L13-23
Resizing
Resize handles change a selected block’s width or height. Edge handles change one dimension and corner handles can change both. Holding Shift keeps the aspect ratio for ordinary blocks. Text blocks use the resize gesture to change font size instead of the box size. The opposite edge stays visually fixed when the block can be repositioned.
References: frontend/…/BlockEditor.vue• L64-75 frontend/…/BoxResizer.vue• L7-30 frontend/…/BoxResizer.vue• L139-221
Position modes
Position mode defines whether a block follows normal page flow or uses an independent anchor. Auto uses normal flow. Free, fixed, and sticky modes expose anchor values for direct placement. Relative mode keeps the block in flow while allowing positional offsets. Choosing normal flow clears the stored anchors, and an independently positioned child causes its parent to provide a positioning reference.
References: frontend/…/BlockPositionHandler.vue• L1-19 frontend/…/BlockPositionHandler.vue• L78-116
Alignment and snapping
Snapping helps an author align a freely positioned block with the page or its parent. During a move or resize, the canvas compares the block edges with key page and parent lines and applies a small correction when they are close.
Snap guides
The guide system exposes vertical and horizontal lines while a move or resize is active. It can align block edges with the left, center, or right of the page and with matching parent boundaries. The correction is scaled back into canvas units, which keeps the snap behavior stable while the canvas is zoomed.
References: frontend/…/guidesTracker.ts• L5-25 frontend/…/guidesTracker.ts• L98-160 frontend/…/BlockSnapGuides.vue• L1-20
Drop indicators
Reordering uses an insertion line instead of changing the live layout during the drag. The line shows the resolved position in the current row or column. A container outline appears when the target is a different container, with a distinct accent for component-owned content. This feedback separates “place beside” from “nest inside” before the author releases the pointer.
References: frontend/…/DropIndicator.vue• L1-19 frontend/…/dropGeometry.ts• L123-177 frontend/…/useBlockReorder.ts• L211-241
Canvas navigation
Pan and zoom change the author’s view without changing the page model. They use canvas translation and scale values, while pointer distances for manipulation are converted through the current scale.
Pan and zoom controls
The canvas supports panning with the move mode and with ordinary wheel movement. Control-wheel or Command-wheel zooms around the pointer so the point under inspection stays in place. Zoom is limited to a usable range, and the canvas also provides reset, incremental zoom, and fit-to-view actions.
References: frontend/…/panAndZoom.ts• L4-57 frontend/…/panAndZoom.ts• L59-130 frontend/…/useCanvasUtils.ts• L117-145
View fitting
Initial layout and fit-to-view place the visible page inside the canvas area with working space around it. When the editor focuses a selected block that is outside the viewport, it may reduce the scale and translate the canvas so the block returns to view.
References: frontend/…/useCanvasUtils.ts• L25-111 frontend/…/useCanvasUtils.ts• L180-206 frontend/…/BuilderCanvas.vue• L97-103
Drop-zone behavior
The canvas is a drop target for blocks, reusable components, block templates, images, video, and font files. It first resolves the block and insertion position under the pointer, then applies the drop as an add, replace, or asset update according to the source and any modifier key.
Block and template drops
A component or block template normally enters the resolved parent at the shown insertion index. Holding Shift replaces the targeted block instead. The drop target skips blocks that cannot contain children and moves upward until it finds a valid parent. A placeholder and hover state show the target before the drop is committed.
References: frontend/…/useCanvasDropZone.ts• L31-68 frontend/…/useCanvasDropZone.ts• L104-198 frontend/…/useCanvasDropZone.ts• L200-240
Asset drops
A dropped file enters the same target-resolution path. Images can become new image blocks, replace an image or SVG, or become a container background with Shift. Video becomes a video block or updates an existing video block. Font files update the selected block’s font after upload rather than becoming canvas content.
References: frontend/…/useCanvasDropZone.ts• L242-299
Read-only boundaries
Read-only mode blocks edits, drops, and marquee selection. A version preview can still use the canvas view and its pan and zoom state, but it does not change the draft content. See Editing state and history for the broader save and history model.
References: frontend/…/useCanvasDropZone.ts• L31-46 frontend/…/useCanvasMarqueeSelection.ts• L228-250 frontend/…/canvasStore.ts• L67-101
Change checklist
When these files or sections are changed, remember to consider these:
- Changes to block hit testing or breakpoint attributes must preserve the link between the pointer location, the rendered view, and the selected block.
- Changes to canvas scale or translation must keep drag, resize, guide, marquee, and drop coordinates in the same screen-to-canvas space.
- Changes to layout direction or child order must update both the insertion-index rules and the drop indicator geometry.
- Changes to position modes must preserve the contract between direct movement, resize edge correction, and the position controls.
- Changes to drop-source handling must keep add, replace, asset upload, and font upload behavior distinct.
- Changes to read-only or preview state must prevent content mutation without disabling view navigation.
Important failure modes
| Trigger | Consequence | Guard |
|---|---|---|
| The pointer resolves to a block from the wrong breakpoint | Selection or a drop is shown on a different responsive view | Resolve the breakpoint from the rendered element under the pointer before applying the action |
| A drag removes the source from layout during target measurement | Grid or wrapped layouts shift and the insertion index becomes wrong | Keep the source hidden in place and draw the target line as an overlay |
| Screen-space movement is applied without the current canvas scale | Move and resize distance changes when the author zooms | Convert pointer deltas through the active scale |
| A marquee drag is treated as a click after release | The block under the pointer replaces the intended multi-selection | Suppress the trailing click after a committed marquee |
| A drop targets a block that cannot contain children | The new content has no valid parent or replaces the wrong level | Walk upward to a valid parent and use the explicit replacement path for Shift drops |
| Editing begins in read-only preview | A preview action changes draft content or history | Disable mutation and history while the preview root is active |
Key files
| File | Why to read it |
|---|---|
| frontend/…/BuilderCanvas.vue | Primary canvas surface, breakpoint views, overlay, and navigation state |
| frontend/…/BuilderBlock.vue | Relationship between rendered blocks and their editor overlays |
| frontend/…/BlockEditor.vue | Selection boundary and entry point for move, resize, position, and drop actions |
| frontend/…/useBlockReorder.ts | Pointer-based in-flow reorder and nest-versus-sibling behavior |
| frontend/…/dropGeometry.ts | Layout-independent insertion and indicator rules |
| frontend/…/useCanvasMarqueeSelection.ts | Marquee scope, overlap rules, and selection commit |
| frontend/…/useCanvasDropZone.ts | Canvas drop resolution and block, template, and asset outcomes |
| frontend/…/panAndZoom.ts | Pointer-centered zoom and wheel-based canvas navigation |
| frontend/…/BoxResizer.vue | Direct resize behavior and text sizing through the resize gesture |
| frontend/…/guidesTracker.ts | Alignment targets and snap corrections |