Skip to content

Commit

Permalink
fix my mess my bad
Browse files Browse the repository at this point in the history
  • Loading branch information
nils-mathieu committed Jan 23, 2024
1 parent cd4dd7f commit b47549f
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 14 deletions.
22 changes: 11 additions & 11 deletions src/lib/3dmap/scene.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@
resetCameraPosition();
return;
}
let shelf = objects[item.shelf];
if (!shelf) return;
let rot = shelf.rot || [0, 0, 0];
let object = objects[item.object];
if (!object) return;
let rot = object.rot || [0, 0, 0];
cameraControls.rotateAzimuthTo(rot[1], true);
cameraControls.moveTo(shelf.pos[0], shelf.pos[1], shelf.pos[2], true);
cameraControls.moveTo(object.pos[0], object.pos[1], object.pos[2], true);
cameraControls.rotatePolarTo(1.0, true);
}
Expand All @@ -47,20 +47,20 @@
<T.DirectionalLight position={[0, 0, 10]} castShadow />
<T.AmbientLight intensity={10} />

<!-- App shelf logic -->
{#each Object.keys(objects) as shelfKey (shelfKey)}
{@const shelf = objects[shelfKey]}
<T.Mesh position={shelf.pos} rotation={shelf.rot ? shelf.rot : [0, 0, 0]} castShadow>
{#if currentItemData && currentItemData.shelf == shelfKey}
<!-- Display the objects that have been loaded for this scene. -->
{#each Object.keys(objects) as objectKey (objectKey)}
{@const object = objects[objectKey]}
<T.Mesh position={object.pos} rotation={object.rot ? object.rot : [0, 0, 0]} castShadow>
{#if currentItemData && currentItemData.object == objectKey}
<HTML zIndexRange={[0, 100]} position.y={2.5} scale={0.5} transform>
<ProductCard enableInfoBtn={true} id={$currentItem}></ProductCard>
</HTML>
{/if}
{#if shelf.name}
{#if object.name}
<Text
position={[0, 1.1, 0.8]}
rotation={[-1.57, 0, 1.57]}
text={shelf.name}
text={object.name}
color="black"
fontSize={0.25}
></Text>
Expand Down
4 changes: 2 additions & 2 deletions src/lib/productcard.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@
<h2 class="font text-md title font-bold">{itemInfo.name}</h2>
<h3 class="-mt-1 text-sm font-light italic">{itemInfo.category}</h3>
<div class="flex flex-row">
{#if itemInfo.shelf != null && itemInfo.shelf in $objectsData}
{#if itemInfo.object != null && itemInfo.object in $objectsData}
<div class="h-4 w-4 rounded-full bg-success"></div>
<div class="-mt-[0.125rem] ml-1 text-sm">{$objectsData[itemInfo.shelf].name}</div>
<div class="-mt-[0.125rem] ml-1 text-sm">{$objectsData[itemInfo.object].name}</div>
{:else}
<div class="h-4 w-4 rounded-full bg-warning font-light"></div>
<div class="-mt-[0.125rem] ml-1 text-sm">Click & Collect</div>
Expand Down
2 changes: 1 addition & 1 deletion src/routes/app/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
// Selection
function selectItemEvent(e, itemId) {
if (allItems[itemId].shelf !== null) {
if (allItems[itemId].object !== null) {
// if item is avail show it on map
$currentItem = $currentItem !== itemId ? itemId : null;
} else {
Expand Down

0 comments on commit b47549f

Please sign in to comment.