Skip to content

refactor(GcodePreview): auto-zoom without cropping#1867

Merged
pedrolamas merged 3 commits into
fluidd-core:developfrom
pedrolamas:pedrolamas/gcode-preview-zoom
Jun 3, 2026
Merged

refactor(GcodePreview): auto-zoom without cropping#1867
pedrolamas merged 3 commits into
fluidd-core:developfrom
pedrolamas:pedrolamas/gcode-preview-zoom

Conversation

@pedrolamas

Copy link
Copy Markdown
Member

Perform auto-zoom to print content without cropping the bed.

Signed-off-by: Pedro Lamas <pedrolamas@gmail.com>
@pedrolamas pedrolamas added this to the 1.37.2 milestone Jun 3, 2026
@pedrolamas pedrolamas requested a review from Copilot June 3, 2026 20:44
@pedrolamas pedrolamas added the FR - Enhancement New feature or request label Jun 3, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Refactors the G-code preview widget’s auto-zoom behavior so the SVG viewBox always includes the bed, and auto-zoom is performed via pan/zoom transforms (instead of shrinking the viewBox and potentially clipping the bed).

Changes:

  • Trigger auto-zoom when enabling the setting and when auto-zoom dependencies change (bounds, flipX, flipY).
  • Remove autoZoom-driven viewBox shrinking; keep viewBox bed-inclusive at all times.
  • Add zoomToBounds() to compute a pan/zoom transform that centers and fits the print bounds.

Comment thread src/components/widgets/gcode-preview/GcodePreview.vue

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 1 comment.

Comment thread src/components/widgets/gcode-preview/GcodePreview.vue

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 1 comment.

Comment thread src/components/widgets/gcode-preview/GcodePreview.vue
Move auto-zoom side-effects out of the computed setter and into a
`@Watch('autoZoom')` handler so the preview fits/resets consistently
whether the setting changes locally or syncs from the server.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Signed-off-by: Pedro Lamas <pedrolamas@gmail.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 1 comment.

Comment thread src/components/widgets/gcode-preview/GcodePreview.vue
`viewBox` (and thus `zoomToBounds()`) depends on `bedSize`, but the
re-fit watcher didn't track it. When bed limits arrive after connect or
change on a printer switch, the applied pan/zoom transform went stale.
Add `bedSize` as an auto-zoom dependency.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Signed-off-by: Pedro Lamas <pedrolamas@gmail.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 1 comment.

Comment thread src/components/widgets/gcode-preview/GcodePreview.vue

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 1 comment.

Comment thread src/components/widgets/gcode-preview/GcodePreview.vue

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

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

@pedrolamas pedrolamas merged commit 85fee0a into fluidd-core:develop Jun 3, 2026
4 checks passed
@pedrolamas pedrolamas deleted the pedrolamas/gcode-preview-zoom branch June 3, 2026 21:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

FR - Enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants