Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions packages/core/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ export {
isOperationDoorType,
SECTIONAL_GARAGE_RENDER_OPEN_SCALE,
} from './lib/door-operation'
export { getDefaultLevelName, getLevelDisplayName } from './lib/level-name'
export {
type Point2D as PolygonPoint2D,
pointInPolygon as pointInPolygon2D,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { LevelNode } from '@pascal-app/core'
import type { LevelNode } from '../schema'

export function getDefaultLevelName(level: number): string {
if (level === 0) return 'Ground Floor'
Expand Down
4 changes: 2 additions & 2 deletions packages/editor/src/components/tools/zone/zone-tool.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ export const ZoneTool: React.FC = () => {
const [gridX, gridZ] = snapWorldXZForActiveBuilding(
event.position[0],
event.position[2],
0.5,
useEditor.getState().gridSnapStep,
).local
cursorPosition = [gridX, gridZ]
levelYRef.current = event.localPosition[1]
Expand Down Expand Up @@ -217,7 +217,7 @@ export const ZoneTool: React.FC = () => {
const [gridX, gridZ] = snapWorldXZForActiveBuilding(
event.position[0],
event.position[2],
0.5,
useEditor.getState().gridSnapStep,
).local
let clickPoint: [number, number] = [gridX, gridZ]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { useViewer } from '@pascal-app/viewer'
import { Check, ChevronDown, Eye, EyeOff, Layers2, Plus, Trash2 } from 'lucide-react'
import { useCallback, useRef, useState } from 'react'
import { useShallow } from 'zustand/react/shallow'
import { getLevelDisplayName } from '../../../lib/level-name'
import { getLevelDisplayName } from '@pascal-app/core'
import { createLocalGuideImage } from '../../../lib/local-guide-image'
import { cn } from '../../../lib/utils'
import useEditor, { type GridSnapStep } from '../../../store/use-editor'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { useEffect, useState } from 'react'
import { create } from 'zustand'
import { useShallow } from 'zustand/shallow'
import { Dialog, DialogContent, DialogTitle } from './../../../components/ui/primitives/dialog'
import { getLevelDisplayName } from '../../../lib/level-name'
import { getLevelDisplayName } from '@pascal-app/core'
import { useCommandRegistry } from '../../../store/use-command-registry'
import { usePaletteViewRegistry } from '../../../store/use-palette-view-registry'

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ import {
buildLevelDuplicateCreateOps,
type LevelDuplicatePreset,
} from '../../lib/level-duplication'
import { getDefaultLevelName, getLevelDisplayName } from '../../lib/level-name'
import { getDefaultLevelName, getLevelDisplayName } from '@pascal-app/core'
import { deleteLevelWithFallbackSelection } from '../../lib/level-selection'
import {
getEditorClipboardSnapshot,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use client'

import type { AssetInput } from '@pascal-app/core'
import { resolveCdnUrl } from '@pascal-app/viewer'
import { resolveCdnUrl, useViewer } from '@pascal-app/viewer'
import Image from 'next/image'
import { useEffect } from 'react'
import {
Expand Down Expand Up @@ -96,6 +96,10 @@ export function ItemCatalog({
key={index}
onClick={() => {
triggerSFX('sfx:menu-click')
// Drop the current selection before arming placement — keeping
// it would route shortcuts (rotate & co) to both the ghost and
// the selected node.
useViewer.getState().setSelection({ selectedIds: [], zoneId: null })
setSelectedItem(item)
setTool('item')
setMode('build')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import type { LevelNode } from '@pascal-app/core'
import { useEffect, useState } from 'react'
import type { LevelDuplicatePreset } from '../../lib/level-duplication'
import { getLevelDisplayName } from '../../lib/level-name'
import { getLevelDisplayName } from '@pascal-app/core'
import { cn } from '../../lib/utils'
import {
Dialog,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ import {
buildLevelDuplicateCreateOps,
type LevelDuplicatePreset,
} from './../../../../../lib/level-duplication'
import { getDefaultLevelName } from './../../../../../lib/level-name'
import { getDefaultLevelName } from '@pascal-app/core'
import { deleteLevelWithFallbackSelection } from './../../../../../lib/level-selection'
import { createLocalGuideImage } from './../../../../../lib/local-guide-image'
import { cn } from './../../../../../lib/utils'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { useViewer } from '@pascal-app/viewer'
import { Layers } from 'lucide-react'
import { memo, useCallback, useState } from 'react'
import { useShallow } from 'zustand/react/shallow'
import { getDefaultLevelName } from '../../../../../lib/level-name'
import { getDefaultLevelName } from '@pascal-app/core'
import { InlineRenameInput } from './inline-rename-input'
import { focusTreeNode, TreeNode, TreeNodeWrapper } from './tree-node'
import { TreeNodeActions } from './tree-node-actions'
Expand Down
2 changes: 1 addition & 1 deletion packages/editor/src/components/viewer-overlay.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {
type AnyNodeId,
type BuildingNode,
emitter,
getLevelDisplayName,
type LevelNode,
useScene,
type ZoneNode,
Expand All @@ -30,7 +31,6 @@ import {
} from 'lucide-react'
import Link from 'next/link'
import { useShallow } from 'zustand/react/shallow'
import { getLevelDisplayName } from '../lib/level-name'
import { cn } from '../lib/utils'
import { ActionButton } from './ui/action-menu/action-button'
import {
Expand Down
4 changes: 4 additions & 0 deletions packages/nodes/src/shelf/parametrics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,5 +76,9 @@ export const shelfParametrics: ParametricDescriptor<ShelfNode> = {
{ key: 'height', kind: 'number', unit: 'm', min: 0.05, max: 2.5, step: 0.05 },
],
},
{
label: 'Position',
fields: [{ key: 'position', kind: 'vec3' }],
},
],
}
Loading