Skip to content

feat: Add "clear canvas" functionality#23

Open
hayzedd2 wants to merge 3 commits into
akinloluwami:mainfrom
hayzedd2:feat/clear-canvas
Open

feat: Add "clear canvas" functionality#23
hayzedd2 wants to merge 3 commits into
akinloluwami:mainfrom
hayzedd2:feat/clear-canvas

Conversation

@hayzedd2
Copy link
Copy Markdown

@hayzedd2 hayzedd2 commented Apr 29, 2026

Overview

Added a "Clear Canvas" button to the editor header. This gives users a quick way to wipe their workspace clean and start a new design without manually deleting every object.

Changes Made

  1. New clearCanvas Logic:
    -Added a function to the scene editor that resets the objects array to empty and clears any active selection focus.

  2. New Component: EditorClearCanvas (editor-clear-canvas.tsx):

    • Created a standalone component to house the "Clear Canvas" button.
    • Styled it consistently with the adjacent Export button.
    • Accepts an onClearCanvas callback via props that executes the action
  3. Integration in create.tsx layout:

    • Positioned the new <EditorClearCanvas /> component in the application header.
    • Wired the onClearCanvas callback to invoke editorRef.current?.clearCanvas().

How to test

  • Open the editor and add a few shapes or images.
  • Click the new "Clear Canvas" button in the top header.
  • Verify: The canvas should be completely empty, and any active selection boxes should disappear.

Summary by cubic

Add a Clear Canvas button to the editor header so users can wipe all objects and selections in one click. It also exits any active edit mode to prevent stuck text edits.

  • New Features
    • New EditorClearCanvas component with consistent styling and a refresh icon.
    • Added clearCanvas() to SceneEditorHandle to empty objects, clear selection, and end text editing.
    • Integrated in create.tsx header, wired to editorRef.current?.clearCanvas().

Written for commit 8062d76. Summary will update on new commits. Review in cubic

@vercel
Copy link
Copy Markdown

vercel Bot commented Apr 29, 2026

@hayzedd2 is attempting to deploy a commit to the Akinkunmi Team on Vercel.

A member of the Team first needs to authorize it.

Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 issue found across 4 files

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="frontend/src/components/scene-editor.tsx">

<violation number="1" location="frontend/src/components/scene-editor.tsx:1295">
P2: `clearCanvas` does not reset `textEditingId`, leaving stale edit-mode state after deleting all objects and causing behavior like blocked paste until edit mode is cleared.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

Comment thread frontend/src/components/scene-editor.tsx
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant