Skip to content

Commit

Permalink
added viewport config
Browse files Browse the repository at this point in the history
  • Loading branch information
Andcool-Systems committed Dec 31, 2024
1 parent 6ad3077 commit bdc72d5
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
8 changes: 8 additions & 0 deletions src/app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import meta from '@/app/meta.json';
import { merge } from 'lodash';
import Footer from "./modules/components/Footer";
import Header from "./modules/components/Header";
import type { Viewport } from 'next'

export const generateMetadata = async (): Promise<Metadata | undefined> => {
const headersList = headers();
Expand All @@ -18,6 +19,13 @@ export const generateMetadata = async (): Promise<Metadata | undefined> => {
return merge({}, base, extend) as Metadata;
}

export const viewport: Viewport = {
width: 'device-width',
initialScale: 0.9,
maximumScale: 0.9,
userScalable: false
}

export default function RootLayout({ children }: Readonly<{ children: React.ReactNode }>) {
return (
<CookiesProvider>
Expand Down
9 changes: 5 additions & 4 deletions src/app/modules/components/SkinView.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import { useEffect, useRef } from 'react';
import { CSSProperties, useEffect, useRef } from 'react';
import { PlayerAnimation, PlayerObject, SkinViewer, WalkingAnimation } from 'skinview3d';


interface SkinView3DOptions {
SKIN: string,
CAPE: string,
className: string,
style?: CSSProperties,
slim: boolean,
id: string,
width?: number,
Expand All @@ -28,7 +29,7 @@ export class TPose extends PlayerAnimation {
}


const SkinView3D = ({ SKIN, CAPE, className, slim, id, width, height, pose, background }: SkinView3DOptions): JSX.Element => {
const SkinView3D = ({ SKIN, CAPE, className, slim, id, width, height, pose, background, style }: SkinView3DOptions): JSX.Element => {
const canvasRef = useRef<HTMLCanvasElement>();
const skinViewRef = useRef<SkinViewer>();

Expand Down Expand Up @@ -69,7 +70,7 @@ const SkinView3D = ({ SKIN, CAPE, className, slim, id, width, height, pose, back
skinViewRef.current.camera.position.z = 15;

skinViewRef.current.scene.position.y = -2.5;
skinViewRef.current.loadBackground(background || "/static/background.png");
background && skinViewRef.current.loadBackground(background);

skinViewRef.current.loadSkin(SKIN ? SKIN : "/static/workshop_base.png", { model: slim ? "slim" : "default" });
CAPE && skinViewRef.current.loadSkin(CAPE);
Expand Down Expand Up @@ -97,7 +98,7 @@ const SkinView3D = ({ SKIN, CAPE, className, slim, id, width, height, pose, back
}, [pose]);

return (
<div id={id} className={className}>
<div id={id} className={className} style={style}>
<canvas ref={canvasRef} />
</div>
)
Expand Down

0 comments on commit bdc72d5

Please sign in to comment.