Skip to content

fix: viewport type safety and canvas.element -> canvas.dom#1997

Merged
willeastcott merged 4 commits intomainfrom
fix/camera-preview-types
Apr 12, 2026
Merged

fix: viewport type safety and canvas.element -> canvas.dom#1997
willeastcott merged 4 commits intomainfrom
fix/camera-preview-types

Conversation

@willeastcott
Copy link
Copy Markdown
Contributor

@willeastcott willeastcott commented Apr 12, 2026

Summary

  • Fix type errors in viewport files by properly typing the canvas returned from viewport:canvas as Canvas | null
  • Replace deprecated canvas.element with canvas.dom in viewport-tap.ts and viewport-rect-select.ts
  • Type ViewportApplication constructor options to extend the base Application options
  • Cast editorSettings.showFog to boolean to resolve type mismatch
  • Clean up camera-preview types: import EntityObserver, widen selector:change type param to string | null, remove redundant truthiness checks

Test plan

  • Verify viewport renders correctly
  • Verify camera preview panel works (pin/unpin, click to switch)
  • Verify rectangle selection overlay appears and tracks the cursor
  • Verify tap/click interactions in the viewport work as before

Remove non-existent FogType import, type app variable, use top-level
import for EntityObserver, replace deprecated .element with .dom,
convert function expressions to arrow functions, and remove redundant
null checks.

Made-with: Cursor
Type canvas as Canvas, replace deprecated .element with .dom,
and cast editorSettings.showFog to boolean.

Made-with: Cursor
@vercel
Copy link
Copy Markdown

vercel bot commented Apr 12, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
editor Ready Ready Preview, Comment Apr 12, 2026 10:11pm

Request Review

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Improves type-safety across the editor viewport subsystem while migrating PCUI element access from deprecated .element to .dom, and tightening a few event/camera-preview typings.

Changes:

  • Replace deprecated canvas.element / btnPin.element usages with canvas.dom / btnPin.dom in viewport interaction modules.
  • Improve typing around viewport:canvas call sites and ViewportApplication constructor options.
  • Adjust camera preview typings (import EntityObserver, widen selector:change type parameter, and simplify redundant checks).

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

Show a summary per file
File Description
src/editor/viewport/viewport.ts Uses canvas.dom for app/device input initialization and types app as ViewportApplication.
src/editor/viewport/viewport-tap.ts Types viewport:canvas as Canvas | null and migrates bounding-rect/event handling to canvas.dom.
src/editor/viewport/viewport-rect-select.ts Types viewport:canvas as Canvas | null and appends overlay via canvas.dom.
src/editor/viewport/viewport-application.ts Extends constructor option typing from base Application options and resolves showFog assignment type mismatch.
src/editor/viewport/camera/camera-preview.ts Migrates to .dom, refines some typings, and adjusts selector:change signature.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@willeastcott willeastcott merged commit b81357a into main Apr 12, 2026
7 checks passed
@willeastcott willeastcott deleted the fix/camera-preview-types branch April 12, 2026 22:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: viewport bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants