mirror of
https://github.com/rommapp/romm.git
synced 2026-12-02 18:18:47 +01:00
changes from bot review
This commit is contained in:
@@ -210,17 +210,17 @@ const onMouseLeave = () => {
|
||||
gameIsHovering.value = false;
|
||||
};
|
||||
|
||||
emitter?.on("playGame", (romId: number) => {
|
||||
const handlePlayGame = (romId: number) => {
|
||||
if (romId !== props.rom.id) return;
|
||||
|
||||
// Trigger animation based on game type
|
||||
if (animateCD.value) {
|
||||
animateCDSpin();
|
||||
animateCDLoad();
|
||||
} else if (animateCartridge.value) {
|
||||
animateLoadCart();
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
emitter?.on("playGame", handlePlayGame);
|
||||
|
||||
onMounted(() => {
|
||||
if (tiltCardRef.value && !smAndDown.value && props.enable3DTilt) {
|
||||
@@ -238,7 +238,7 @@ onBeforeUnmount(() => {
|
||||
if (tiltCardRef.value?.vanillaTilt && props.enable3DTilt) {
|
||||
tiltCardRef.value.vanillaTilt.destroy();
|
||||
}
|
||||
emitter?.off("playGame");
|
||||
emitter?.off("playGame", handlePlayGame);
|
||||
stopCDAnimation();
|
||||
});
|
||||
</script>
|
||||
|
||||
@@ -60,17 +60,17 @@ const computedAspectRatio = computed(() => {
|
||||
galleryViewStore.defaultAspectRatioCover;
|
||||
return parseFloat(ratio.toString());
|
||||
});
|
||||
emitter?.on("showMatchRomDialog", (romToSearch) => {
|
||||
|
||||
const handleShowMatchRomDialog = (romToSearch: SimpleRom) => {
|
||||
rom.value = romToSearch;
|
||||
show.value = true;
|
||||
matchedRoms.value = [];
|
||||
|
||||
// Use name as search term, only when it's matched
|
||||
// Otherwise use the filename without tags and extensions
|
||||
searchText.value = romToSearch.is_identified
|
||||
? (romToSearch.name ?? "")
|
||||
: romToSearch.fs_name_no_tags;
|
||||
});
|
||||
};
|
||||
emitter?.on("showMatchRomDialog", handleShowMatchRomDialog);
|
||||
|
||||
const missingCoverImage = computed(() =>
|
||||
getMissingCoverImage(rom.value?.name || rom.value?.fs_name || ""),
|
||||
);
|
||||
@@ -314,7 +314,7 @@ function closeDialog() {
|
||||
}
|
||||
|
||||
onBeforeUnmount(() => {
|
||||
emitter?.off("showMatchRomDialog");
|
||||
emitter?.off("showMatchRomDialog", handleShowMatchRomDialog);
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
@@ -20,13 +20,20 @@ const filteredCovers = ref<SearchCoverSchema[]>();
|
||||
const panels = ref([0]);
|
||||
|
||||
const emitter = inject<Emitter<Events>>("emitter");
|
||||
emitter?.on("showSearchCoverDialog", ({ term, aspectRatio = null }) => {
|
||||
|
||||
const handleShowSearchCoverDialog = ({
|
||||
term,
|
||||
aspectRatio = null,
|
||||
}: {
|
||||
term: string;
|
||||
aspectRatio: number | null;
|
||||
}) => {
|
||||
searchText.value = term;
|
||||
show.value = true;
|
||||
// TODO: set default aspect ratio to 2/3
|
||||
if (aspectRatio) coverAspectRatio.value = aspectRatio;
|
||||
if (searchText.value) searchCovers();
|
||||
});
|
||||
};
|
||||
emitter?.on("showSearchCoverDialog", handleShowSearchCoverDialog);
|
||||
|
||||
const coverAspectRatio = ref(
|
||||
parseFloat(galleryViewStore.defaultAspectRatioCover.toString()),
|
||||
@@ -105,7 +112,7 @@ function closeDialog() {
|
||||
}
|
||||
|
||||
onBeforeUnmount(() => {
|
||||
emitter?.off("showSearchCoverDialog");
|
||||
emitter?.off("showSearchCoverDialog", handleShowSearchCoverDialog);
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
@@ -22,20 +22,15 @@ export const ANIMATION_CONFIG = {
|
||||
};
|
||||
|
||||
function getTranslateY(el: HTMLElement) {
|
||||
const st = window.getComputedStyle(el);
|
||||
const tr = st.transform;
|
||||
if (!tr || tr === "none") return 0;
|
||||
const transform = window.getComputedStyle(el).transform;
|
||||
if (!transform || transform === "none") return 0;
|
||||
|
||||
const m = tr.match(/\(([^)]+)\)/);
|
||||
if (!m) return 0;
|
||||
|
||||
const values = m[1].split(",").map((v) => parseFloat(v.trim()));
|
||||
if (tr.startsWith("matrix3d")) {
|
||||
// matrix3d(...) has 16 values, translation is at indexes 12,13,14 (tx, ty, tz)
|
||||
return values[13] || 0; // ty
|
||||
} else {
|
||||
// matrix(a, b, c, d, tx, ty) -> ty is index 5
|
||||
return values[5] || 0;
|
||||
try {
|
||||
const matrix = new DOMMatrix(transform);
|
||||
return matrix.m42; // m42 is the ty value (vertical translation)
|
||||
} catch (e) {
|
||||
console.error("Failed to parse transform matrix:", e);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -109,6 +104,7 @@ export function useGameAnimation({
|
||||
// Update velocity and angle with acceleration
|
||||
velocity +=
|
||||
(accelerate.value ? accelerationRate : decelerationRate) * deltaTime;
|
||||
// Clamp the velocity
|
||||
velocity = Math.min(maxRotationSpeed, Math.max(0, velocity));
|
||||
angle = (angle + velocity * deltaTime) % 360;
|
||||
|
||||
|
||||
@@ -747,7 +747,7 @@ export function platformCategoryToIcon(category: string) {
|
||||
|
||||
export const FRONTEND_RESOURCES_PATH = "/assets/romm/resources";
|
||||
|
||||
export const CD_BASED_SYSTEMS = [
|
||||
export const CD_BASED_SYSTEMS = new Set([
|
||||
"3do", // 3DO
|
||||
"amiga-cd32", // Amiga CD32
|
||||
"atari-jaguar-cd", // Atari Jaguar CD
|
||||
@@ -778,8 +778,8 @@ export const CD_BASED_SYSTEMS = [
|
||||
"xbox", // Xbox
|
||||
"xbox360", // Xbox 360
|
||||
"xboxone", // Xbox One
|
||||
];
|
||||
]);
|
||||
|
||||
export function isCDBasedSystem(platformSlug: string): boolean {
|
||||
return CD_BASED_SYSTEMS.includes(platformSlug);
|
||||
return CD_BASED_SYSTEMS.has(platformSlug.toLowerCase());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user