T45d Site · Components: comments one short line
This commit is contained in:
1 parent
8712fd0389
commit
8d647e632f
4 files changed
+4
-4
No files matched your search
@@ -1,7 +1,7 @@
|
|||||||
import { useEffect, useRef } from "react";
|
import { useEffect, useRef } from "react";
|
||||||
import { componentCount } from "./data";
|
import { componentCount } from "./data";
|
||||||
|
|
||||||
/** The search field; Slash focuses it, Enter takes the first match. */
|
/** Search: Slash focuses it, Enter opens the first match. */
|
||||||
export function Find({ query, onQuery, onEnter, className }: { query: string; onQuery: (q: string) => void; onEnter: () => void; className: string }) {
|
export function Find({ query, onQuery, onEnter, className }: { query: string; onQuery: (q: string) => void; onEnter: () => void; className: string }) {
|
||||||
const field = useRef<HTMLInputElement>(null);
|
const field = useRef<HTMLInputElement>(null);
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ interface Props {
|
|||||||
lift?: number | null;
|
lift?: number | null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Grows once shown; a press regrows it or picks a block. */
|
/** Grows once shown; a press regrows or picks. */
|
||||||
export function Iso({ model, label, className, onHover, onPick, lift }: Props) {
|
export function Iso({ model, label, className, onHover, onPick, lift }: Props) {
|
||||||
const canvas = useRef<HTMLCanvasElement>(null);
|
const canvas = useRef<HTMLCanvasElement>(null);
|
||||||
const mini = useRef<ReturnType<typeof miniature> | null>(null);
|
const mini = useRef<ReturnType<typeof miniature> | null>(null);
|
||||||
|
|||||||
@@ -112,7 +112,7 @@ export function miniature(canvas: HTMLCanvasElement, model: Block[], still: bool
|
|||||||
if (!frame) frame = requestAnimationFrame(draw);
|
if (!frame) frame = requestAnimationFrame(draw);
|
||||||
};
|
};
|
||||||
|
|
||||||
/** Model index of the grown block at a point, not the table. */
|
/** The grown block at a point, by model index. */
|
||||||
const pick = (x: number, y: number): number | null => {
|
const pick = (x: number, y: number): number | null => {
|
||||||
const r = canvas.getBoundingClientRect();
|
const r = canvas.getBoundingClientRect();
|
||||||
const dpr = canvas.width / r.width;
|
const dpr = canvas.width / r.width;
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ export function smooth(): { lenis: Lenis; end: () => void } {
|
|||||||
return { lenis: own, end: () => (own.destroy(), (lenis = null)) };
|
return { lenis: own, end: () => (own.destroy(), (lenis = null)) };
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Holds the page still at once, a glide in flight included. */
|
/** Holds the page still at once, glide included. */
|
||||||
export function hold(still: boolean): void {
|
export function hold(still: boolean): void {
|
||||||
if (still) lenis?.stop();
|
if (still) lenis?.stop();
|
||||||
else lenis?.start();
|
else lenis?.start();
|
||||||
|
|||||||
Reference in new issue
Block a user