Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Misc tweaks/updates to cimbar.js encoder UI #97

Merged
merged 9 commits into from
Jun 29, 2024
Merged

Misc tweaks/updates to cimbar.js encoder UI #97

merged 9 commits into from
Jun 29, 2024

Conversation

sz3
Copy link
Owner

@sz3 sz3 commented Jun 28, 2024

A bunch of small stuff:

  • error message is now displayed when webGL fails init (WebGL issue #95)
  • toggling the menu now temporarily pauses barcode animation for 15 frames (1 second)
    • of all the tricks I tried to get auto-focus to work better, pausing the animation is far and away the best
  • on mobile, the touch event (press the screen anywhere) will also pause the feed
  • new background. Very exciting and cool.
  • auto-expand canvas to fill window on larger displays (was previously capped to the cimbar res of 1024x1024 +padding).
    • long overdue, probably
  • make sure there's always minimum padding around the barcode

sz3 added 9 commits March 31, 2024 22:31
It'll be backspace on keyboard, and on touch event (i.e. only while
pressed) on touch devices. Pausing temporarily helps autofocus find the
image.
+ add auto-realignment logic for the full-canvas "button"?
We'll then have a short pause during menu toggles (and ontouch on
mobile), which should unobtrusively(?) help autofocus
Better? Perhaps. Simpler css, more white (brightness) overall. Grid is
rotated 45 degrees since I think it looks better that way.
This lets the blurNav() method fire more consistently, which is what we
now want (since we're temporarily pausing animation now)
+ make manual backspace pause additive, so if you want to mash the
button and stay paused indefinitely you can
… size

The padding is overdue -- it *can* work without the padding, but it
really helps to have some quiet (black) padding around all 4 edges of
the image.

Expanding the canvas to fill the window (rather than capping it to its
max size) helps on higher resolution (e.g. 4k) displays.
},

resize : function()
{
// reset zoom
var canvas = document.getElementById('canvas');
var width = window.innerWidth;
var height = window.outerHeight;
var width = window.innerWidth - 12;
Copy link
Owner Author

Choose a reason for hiding this comment

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

Magic hardcoded value that (roughly) matches the css border.

if (pause === undefined) {
pause = !Main.isPaused();
}
_pause = pause? 15 : 0;
Copy link
Owner Author

Choose a reason for hiding this comment

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

The 15 is our cooldown frames.

@@ -144,6 +177,9 @@ return {
_renderTime += elapsed;
Main.setHTML( "status", elapsed + " : " + frameCount + " : " + Math.ceil(_renderTime/frameCount));
}
if ( !(_counter & 31) ) {
Copy link
Owner Author

Choose a reason for hiding this comment

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

A bit of a hack -- since we're doing some trickery to make the canvas seem clickable, we need to manually reposition the (absolute positioned) click element if something changes. So we have to check it on an interval.

@@ -194,6 +230,10 @@ window.addEventListener('keydown', function(e) {
Main.clickNav();
e.preventDefault();
}
else if (e.key == 'Backspace' || e.keyCode == 8) {
Copy link
Owner Author

Choose a reason for hiding this comment

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

You can also pause the animation with backspace if you have a keyboard available (i.e. on desktop).

@sz3 sz3 merged commit 8939668 into master Jun 29, 2024
8 checks passed
@sz3 sz3 deleted the ui-misc-tweaks branch June 29, 2024 05:12
@sz3
Copy link
Owner Author

sz3 commented Jul 1, 2024

Added 75d6cfb directly to master to fix up the padding (to -10 from -12) and use innerHeight.

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