feat(control): grid snap, NPC context actions, and overlay dim fix
Re-enable users-branch UI, snap session tokens to square/hex grid from the control preview, refine inactive/open-info NPC menus, block marker actions while an effect brush is active, and dim materials/NPC overlays only when they are open. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -185,6 +185,15 @@ export function NpcsApp() {
|
||||
() => activeIds.map((id) => npcs.find((n) => n.id === id)).filter((n): n is ProjectNpc => Boolean(n)),
|
||||
[activeIds, npcs],
|
||||
);
|
||||
/** Описание: сфокусированный НПС (открытие информации / последний выбор), иначе все активные. */
|
||||
const detailNpcs = useMemo(() => {
|
||||
const focusId = overlay?.focusNpcId ?? null;
|
||||
if (focusId) {
|
||||
const focused = npcs.find((n) => n.id === focusId);
|
||||
if (focused) return [focused];
|
||||
}
|
||||
return selectedNpcs;
|
||||
}, [npcs, overlay?.focusNpcId, selectedNpcs]);
|
||||
|
||||
const filteredNpcs = useMemo(() => {
|
||||
const q = query.trim().toLowerCase();
|
||||
@@ -226,7 +235,7 @@ export function NpcsApp() {
|
||||
|
||||
const relationsByNpcId = useMemo(() => {
|
||||
const map = new Map<NpcId, { id: string; text: string }[]>();
|
||||
for (const npc of selectedNpcs) {
|
||||
for (const npc of detailNpcs) {
|
||||
const list = relations
|
||||
.filter((r) => r.sourceNpcId === npc.id)
|
||||
.map((r) => {
|
||||
@@ -236,7 +245,7 @@ export function NpcsApp() {
|
||||
map.set(npc.id, list);
|
||||
}
|
||||
return map;
|
||||
}, [npcs, relations, selectedNpcs]);
|
||||
}, [detailNpcs, npcs, relations]);
|
||||
|
||||
const onSelectTile = useCallback(
|
||||
(id: NpcId) => {
|
||||
@@ -304,8 +313,8 @@ export function NpcsApp() {
|
||||
|
||||
<div className={styles.body}>
|
||||
<div className={styles.detail}>
|
||||
{selectedNpcs.length > 0 ? (
|
||||
selectedNpcs.map((npc) => {
|
||||
{detailNpcs.length > 0 ? (
|
||||
detailNpcs.map((npc) => {
|
||||
const safeHtml = sanitizeSceneDescriptionHtml(npc.description);
|
||||
const npcRelations = relationsByNpcId.get(npc.id) ?? [];
|
||||
return (
|
||||
|
||||
Reference in New Issue
Block a user