fix membrana
This commit is contained in:
1 parent
369638bf98
commit
bc7e77b007
2 files changed
+23
-2
No files matched your search
@@ -3,7 +3,7 @@ import { Canvas, useThree } from "@react-three/fiber";
|
||||
import { CameraControls, Grid } from "@react-three/drei";
|
||||
import * as THREE from "three";
|
||||
import { useAtlasStore, type BodyRegion, type ClipAxis } from "../../store/useAtlasStore.js";
|
||||
import { SystemModel } from "./SystemModel.js";
|
||||
import { SystemModel, CELL_MEMBRANE_SLUG } from "./SystemModel.js";
|
||||
import type { Structure } from "../../lib/api.js";
|
||||
|
||||
// Sistemas apresentados como diagrama 2D (fotomicrografia real com
|
||||
@@ -260,7 +260,14 @@ function ClickSelector({
|
||||
ndc.set(x, y);
|
||||
raycaster.setFromCamera(ndc, camera);
|
||||
const hits = raycaster.intersectObjects(scene.children, true);
|
||||
const hit = hits.find((h) => h.object.visible && h.object.name && bySlug.has(h.object.name));
|
||||
const valid = hits.filter((h) => h.object.visible && h.object.name && bySlug.has(h.object.name));
|
||||
// A membrana plasmática da célula é semitransparente de propósito
|
||||
// (ver SystemModel.tsx) justamente pra deixar ver as organelas por
|
||||
// dentro — clicar nela não pode "capturar" o clique antes de
|
||||
// chegar na organela real por trás; só vira o resultado do clique
|
||||
// se não houver mais nada na frente/atrás dela nesse raio.
|
||||
const hit =
|
||||
valid.find((h) => h.object.name !== CELL_MEMBRANE_SLUG) ?? valid[0];
|
||||
if (hit && (!best || hit.distance < best.distance)) {
|
||||
best = { distance: hit.distance, slug: hit.object.name };
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user