Scale mobile UI

This commit is contained in:
Idrees Hassan
2025-08-16 20:07:05 -04:00
parent 027a78b43c
commit 54ab24d119
5 changed files with 41 additions and 26 deletions

23
dist/birb.user.js vendored
View File

@@ -1,7 +1,7 @@
// ==UserScript==
// @name Browser Bird
// @namespace https://idreesinc.com
// @version 2025-08-16-4
// @version 2025-08-16-5
// @description birb
// @author Idrees
// @downloadURL https://github.com/IdreesInc/Browser-Bird/raw/refs/heads/main/dist/birb.user.js
@@ -16,7 +16,8 @@
// @ts-ignore
const SHARED_CONFIG = {
cssScale: 1,
birbCssScale: 1,
uiCssScale: 1,
canvasPixelSize: 1,
hopSpeed: 0.07,
hopDistance: 45,
@@ -28,6 +29,7 @@ const DESKTOP_CONFIG = {
};
const MOBILE_CONFIG = {
uiCssScale: 0.9,
flySpeed: 0.125,
};
@@ -35,9 +37,10 @@ const CONFIG = { ...SHARED_CONFIG, ...isMobile() ? MOBILE_CONFIG : DESKTOP_CONFI
let debugMode = location.hostname === "127.0.0.1";
const CSS_SCALE = CONFIG.cssScale;
const BIRB_CSS_SCALE = CONFIG.birbCssScale;
const UI_CSS_SCALE = CONFIG.uiCssScale;
const CANVAS_PIXEL_SIZE = CONFIG.canvasPixelSize;
const WINDOW_PIXEL_SIZE = CANVAS_PIXEL_SIZE * CSS_SCALE;
const WINDOW_PIXEL_SIZE = CANVAS_PIXEL_SIZE * BIRB_CSS_SCALE;
const HOP_SPEED = CONFIG.hopSpeed;
const FLY_SPEED = CONFIG.flySpeed;
const HOP_DISTANCE = CONFIG.hopDistance;
@@ -72,7 +75,8 @@ const STYLESHEET = `@font-face {
--neg-double-border-size: calc(var(--neg-border-size) * 2);
--highlight: #ffa3cb;
--border-color: var(--highlight);
--birb-scale: ${CSS_SCALE};
--birb-scale: ${BIRB_CSS_SCALE};
--ui-scale: ${UI_CSS_SCALE};
}
#birb {
@@ -119,6 +123,7 @@ const STYLESHEET = `@font-face {
box-sizing: border-box;
display: flex;
flex-direction: column;
transform: scale(var(--ui-scale));
animation: pop-in 0.08s;
transition-timing-function: ease-in;
}
@@ -141,7 +146,7 @@ const STYLESHEET = `@font-face {
@keyframes pop-in {
0% { opacity: 1; transform: scale(0.1); }
100% { opacity: 1; transform: scale(1); }
100% { opacity: 1; transform: scale(var(--ui-scale)); }
}
.birb-window-header {
@@ -918,6 +923,7 @@ Promise.all([loadSpriteSheetPixels(SPRITE_SHEET), loadSpriteSheetPixels(DECORATI
new MenuItem("Field Guide", insertFieldGuide),
// new MenuItem("Decorations", insertDecoration),
new DebugMenuItem("Applications", () => switchMenuItems(otherItems), false),
new MenuItem("Sticky Note", newStickyNote),
new MenuItem(`Hide ${birdBirb()}`, hideBirb),
new DebugMenuItem("Reset Data", resetSaveData),
new DebugMenuItem("Unlock All", () => {
@@ -928,7 +934,6 @@ Promise.all([loadSpriteSheetPixels(SPRITE_SHEET), loadSpriteSheetPixels(DECORATI
new DebugMenuItem("Disable Debug", () => {
debugMode = false;
}),
new MenuItem("Add Sticky Note", newStickyNote),
new Separator(),
new MenuItem("Settings", () => switchMenuItems(settingsItems), false),
];
@@ -1969,11 +1974,11 @@ Promise.all([loadSpriteSheetPixels(SPRITE_SHEET), loadSpriteSheetPixels(DECORATI
}
function getCanvasWidth() {
return canvas.width * CSS_SCALE
return canvas.width * BIRB_CSS_SCALE
}
function getCanvasHeight() {
return canvas.height * CSS_SCALE
return canvas.height * BIRB_CSS_SCALE
}
function hop() {