This commit is contained in:
Georges-Antoine Assi
2026-06-22 19:40:56 -04:00
parent d7c5ab7e06
commit 111fc969be
3 changed files with 19 additions and 13 deletions

View File

@@ -10,13 +10,13 @@
// upgrades to the interactive RBox3D the user can spin. Anything missing —
// a different style, an incomplete set, or a failed image — falls straight
// back to the flat GameCover.
import { RBox3D } from "@v2/lib";
import { computed, ref } from "vue";
import { useI18n } from "vue-i18n";
import { RBox3D } from "@v2/lib";
import { useUISettings } from "@/composables/useUISettings";
import type { DetailedRom } from "@/stores/roms";
import { useBoxFaces } from "@/v2/composables/useBoxFaces";
import GameCover from "@/v2/components/shared/GameCover.vue";
import { useBoxFaces } from "@/v2/composables/useBoxFaces";
defineOptions({ inheritAttrs: false });

View File

@@ -13,7 +13,12 @@
// is false for most libraries until they opt in and re-scan. RBox3D is
// only mounted when `complete` is true; otherwise the surface keeps the
// flat cover.
import { computed, toValue, type ComputedRef, type MaybeRefOrGetter } from "vue";
import {
computed,
toValue,
type ComputedRef,
type MaybeRefOrGetter,
} from "vue";
import type { SimpleRom } from "@/stores/roms";
import { FRONTEND_RESOURCES_PATH } from "@/utils";
import { useWebpSupport } from "@/v2/composables/useWebpSupport";

View File

@@ -152,7 +152,10 @@ function endDrag(e: PointerEvent) {
// after a pause (no recent movement) carries no flick.
if (performance.now() - lastMoveAt < FLICK_WINDOW_MS) {
const coast = (v: number) =>
Math.max(-MOMENTUM_MAX, Math.min(MOMENTUM_MAX, v * DRAG_SENSITIVITY * MOMENTUM_FRAMES));
Math.max(
-MOMENTUM_MAX,
Math.min(MOMENTUM_MAX, v * DRAG_SENSITIVITY * MOMENTUM_FRAMES),
);
const dy = coast(velX);
const dp = coast(-velY);
if (Math.abs(dy) > 1 || Math.abs(dp) > 1) {
@@ -211,7 +214,8 @@ function tick() {
if (Math.abs(ax) > Math.abs(rx)) rx = ax;
if (Math.abs(ay) > Math.abs(ry)) ry = ay;
}
const active = Math.abs(rx) > STICK_DEADZONE || Math.abs(ry) > STICK_DEADZONE;
const active =
Math.abs(rx) > STICK_DEADZONE || Math.abs(ry) > STICK_DEADZONE;
stickActive.value = active;
if (active) {
yaw.value += rx * STICK_SPEED;
@@ -371,14 +375,14 @@ const rootStyle = computed(() => ({ aspectRatio: String(frontRatio.value) }));
draggable="false"
@load="onFrontLoad"
@error="emit('error')"
>
/>
<img
class="r-box3d__face r-box3d__face--art"
:src="back"
alt=""
:style="backStyle"
draggable="false"
>
/>
<img
ref="spineImg"
class="r-box3d__face r-box3d__face--art"
@@ -387,19 +391,16 @@ const rootStyle = computed(() => ({ aspectRatio: String(frontRatio.value) }));
:style="leftStyle"
draggable="false"
@load="onSpineLoad"
>
/>
<img
class="r-box3d__face r-box3d__face--art"
:src="spine"
alt=""
:style="rightStyle"
draggable="false"
>
<div class="r-box3d__face r-box3d__face--edge" :style="topStyle" />
<div
class="r-box3d__face r-box3d__face--edge"
:style="bottomStyle"
/>
<div class="r-box3d__face r-box3d__face--edge" :style="topStyle" />
<div class="r-box3d__face r-box3d__face--edge" :style="bottomStyle" />
</div>
</div>
</div>