Skip to content

Conversation

@jameseaster
Copy link
Contributor

@jameseaster jameseaster commented Jul 30, 2025

Resolves - bug fix


What kind of change does this PR introduce?

  • bug fix

What is the current behavior?

  • webcam errors out

What is the new behavior?

  • webcam works as camera again

Does this PR introduce a breaking change?

  • no

How has this been tested?

  • locally with ngrok on desktop and iOS

Screenshots:

  • n/a

@codecov-commenter
Copy link

codecov-commenter commented Jul 30, 2025

Codecov Report

❌ Patch coverage is 0% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 0.83%. Comparing base (7becbb9) to head (c33b681).
⚠️ Report is 6 commits behind head on main.

Files with missing lines Patch % Lines
components/BarcodeScanner.vue 0.00% 3 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff            @@
##            main     #14      +/-   ##
========================================
- Coverage   0.84%   0.83%   -0.02%     
========================================
  Files          3       3              
  Lines        118     120       +2     
  Branches      19      20       +1     
========================================
  Hits           1       1              
- Misses       117     119       +2     
Files with missing lines Coverage Δ
components/BarcodeScanner.vue 1.00% <0.00%> (-0.03%) ⬇️

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 7becbb9...c33b681. Read the comment docs.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@jameseaster jameseaster marked this pull request as ready for review July 31, 2025 15:23
const height = window.innerHeight;
// must parse float aspect ratio value
const landscapeAspectRatio = parseFloat((width / height).toFixed(3));
const portraitAspectRatio = parseFloat((height / width).toFixed(3));
Copy link
Member

Choose a reason for hiding this comment

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

Can we compute the aspect ratio just once here using something like:

// determine aspect ratio based on portrait/landscape orientation
const aspectRatio = parseFloat(
  isPortrait() ? height / width : width / height).toFixed(3);

And helper in helpers section below:

function _isPortrait() {
  return window.matchMedia('(orientation: portrait)').matches;
}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

So a few things I've found that are a little strange that I'm trying to work around...

The desktop is in portrait mode, but it is not portrait. So for it to fill the whole screen on desktop and mobile, we will want to follow the _isPortrait function you wrote above unless it is desktop. If we are rendering the camera on desktop we want it to act like it is landscape. So we are back to using $q.platform.is.desktop

const aspectRatio = computed(() => {
const width = window.innerWidth;
const height = window.innerHeight;
const isDesktop = !$q.platform.is.desktop;
Copy link
Member

Choose a reason for hiding this comment

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

Let's move the desktop check into the _isPortrait() helper and just say, for now, that desktop is considered never in portrait mode. We'll want to figure out what's broken there in the future.

@dlongley dlongley merged commit 894654a into main Jul 31, 2025
3 checks passed
@dlongley dlongley deleted the bug-fixes branch July 31, 2025 22:00
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.

4 participants